security: drop pbs.twimg.com hotlink, use inline SVG - #2
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
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