Files
StarPunk/docs/design/v2.13.1/2026-11-10-avatar-fetch.md
T

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 hairpin extra_hosts entry).
  • 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_URL is fetched with a plain HTTP client (no redirects, 1 MB limit), as MastodonClient already talks to it. Every other host still goes through safe_get, so private addresses stay blocked.
  • cdn.bsky.app/img/<kind>/plain/<did>/<cid> URLs are fetched from the account's PDS with com.atproto.sync.getBlob; the PDS comes from the DID document (plc.directory for did:plc, /.well-known/did.json for did:web). Both requests use safe_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).