Skip to content

security: drop pbs.twimg.com hotlink, use inline SVG - #2

Merged
tomfuertes merged 1 commit into
mainfrom
hardening/local-logo-asset
May 1, 2026
Merged

tomfuertes merged 1 commit into
mainfrom
hardening/local-logo-asset

Conversation

@tomfuertes

Copy link
Copy Markdown
Contributor

Summary

  • Replace third-party Twitter image with an inline SVG mark
  • Removes the cross-origin pixel that leaks every admin-UI visit to Twitter
  • Removes a single-vendor availability dependency

Why

Audit item #2: the existing <img src=https://pbs.twimg.com/profile_images/...> discloses every load to Twitter and can break if the image rotates or is removed.

Test plan

  • Load the admin UI; logo renders
  • DevTools shows no requests to twimg.com

The header `<img>` in templates/index.html pointed at
https://pbs.twimg.com/profile_images/.../TX7TW-Mp_400x400.jpg.
That has three problems:

1. Privacy leak — every load of the admin UI sent a request to
   Twitter's CDN, disclosing the visitor's IP and the fact that
   they administer this Hermes instance.
2. Availability — Twitter can rotate or remove the image at any
   time without notice; the admin header would 404.
3. Hotlink to a third-party CDN — bandwidth use is on someone
   else's account and outside our control.

Replace with an inline SVG mark (a stylized "H" with two small
wing flourishes, in the existing brand accent #6272ff on a dark
rounded-square background). Inline SVG instead of a data URI
keeps the markup readable and avoids URL-encoding the `#` in the
color value.

Considered alternatives:
- Self-host the original JPEG: removes the leak but keeps a
  bitmap dependency for a 28px header glyph, and we'd need a
  static-file route in the Starlette app.
- Bundled-asset data URI: same effect as inline SVG but harder
  to inspect/restyle.

Inline SVG is the lowest-overhead option and adds zero new
dependencies. After this change, `grep -rn 'twimg\|profile_images'
templates/ server.py` returns empty.
@tomfuertes
tomfuertes marked this pull request as ready for review May 1, 2026 16:15
@tomfuertes
tomfuertes merged commit 1955980 into main May 1, 2026
@tomfuertes
tomfuertes deleted the hardening/local-logo-asset branch May 1, 2026 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant