Branch: refs/heads/main
Home: https://github.com/dreamwidth/dreamwidth
Commit: 27bf64affee672e39f361826ab22fa37d9d34a06
https://github.com/dreamwidth/dreamwidth/commit/27bf64affee672e39f361826ab22fa37d9d34a06
Author: Mark Smith mark@dreamwidth.org
Date: 2026-02-12 (Thu, 12 Feb 2026)
Changed paths:
M cgi-bin/Apache/LiveJournal.pm
M cgi-bin/Plack/Middleware/DW/SecurityHeaders.pm
Log Message:
Add Referrer-Policy: same-origin header to prevent username leaks
Fixes #3472
When users click external links from their reading page, the browser
sends a Referer header containing their subdomain (e.g.,
bob.dreamwidth.org), allowing external sites to identify individual
Dreamwidth users who clicked the link.
Adding Referrer-Policy: same-origin suppresses the Referer header for
all cross-origin requests while preserving it for same-origin
navigation. Since usernames are embedded in subdomains, weaker policies
like origin-when-cross-origin or strict-origin would still leak the
username.
Applied globally (not just reading pages) because external links can
appear on any page -- entries, comments, profiles, etc.
Audited all Referer header usage in the codebase:
- LJ::check_referer() (used ~15 places for CSRF): safe, returns true
when referer is absent
- Login ret=1 redirect: already broken (reads header_out not header_in)
- OpenID continue_to: returnto param is primary, referer is fallback
- EditIcons factory check: same-origin, unaffected
- Media hotlink protection: check_referer passes on empty referer
- VGift/Admin VGift: unaffected (same-origin or handles empty referer)
- Tracking management: minor cosmetic impact only (cancel button and
viewing style args lost for cross-subdomain navigation)
Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com
To unsubscribe from these emails, change your notification settings at https://github.com/dreamwidth/dreamwidth/settings/notifications