1.5 KiB
1.5 KiB
v2.13.1: Avatar fetching in production
Problem
After deploying v2.13.0, backfeed stored responses but no avatar was saved:
- GoToSocial avatars (
https://social.../fileserver/...):SSRFBlockedError: Blocked request to private IP: 172.20.0.5. Inside the container the GoToSocial host resolves to the reverse proxy's internal address (the deployment's hairpinextra_hostsentry). - Bluesky avatars (
https://cdn.bsky.app/img/avatar/...): HTTP 403 from BunnyCDN. From the server, the CDN answers 403 over IPv4 and 200 over IPv6; the container has no IPv6 route. From elsewhere IPv4 works.
Fix (starpunk/avatars.py, _download)
- The host of
GOTOSOCIAL_URLis fetched with a plain HTTP client (no redirects, 1 MB limit), asMastodonClientalready talks to it. Every other host still goes throughsafe_get, so private addresses stay blocked. cdn.bsky.app/img/<kind>/plain/<did>/<cid>URLs are fetched from the account's PDS withcom.atproto.sync.getBlob; the PDS comes from the DID document (plc.directoryfordid:plc,/.well-known/did.jsonfordid:web). Both requests usesafe_get. The cache file is still named after the original URL.
Verification
tests/test_backfeed.py::test_avatars_from_own_gotosocial_and_bluesky_pds: own GoToSocial on a private address is fetched, a Bluesky CDN URL is fetched from its PDS, another private address is still refused.- Checked against the real PLC directory and a bsky.network PDS.
- From the production server: getBlob over IPv4 returns the image (200).