Skip to content

Let the app own Referrer-Policy (SR-2589) - #185

Merged
jsokol merged 2 commits into
masterfrom
FIX-sr-2589-referrer-policy-header
Nov 13, 2026
Merged

jsokol merged 2 commits into
masterfrom
FIX-sr-2589-referrer-policy-header

Conversation

@jsokol

@jsokol jsokol commented Nov 13, 2026 •

Copy link
Copy Markdown
Member

Description

SR-2589: responses carried two Referrer-Policy headers. The Apache vhost set no-referrer-when-downgrade with Header always set, and the SimpleRisk app sends its own Referrer-Policy: origin via PHP header(). The two use different header tables, so both reached the client and browsers combined them unpredictably.

The app owns the header, so the vhost now uses Header setifempty Referrer-Policy "origin". It fills the header only when the app did not send one (for example static files), and never adds a second value. Applied to both simplerisk and simplerisk-minimal default-ssl.conf.

Also removed from both vhosts: Header always set Strict-Transport-Security "max-age=63072000; includeSubdomains; preload" and Header always set X-Xss-Protection "1; mode=block". The app already sends these when an admin enables them, so the vhost copies ignored the admin settings and duplicated the headers (X-XSS-Protection was returned twice). A forced two-year includeSubdomains; preload HSTS is risky for HTTP, reverse-proxy and shared-domain installs, and X-XSS-Protection is obsolete.

Trade-off

Static files the app never touches no longer get HSTS from Docker. Browsers apply HSTS per host, so HTML responses carrying it are enough.

setifempty without always does not apply to responses Apache generates itself (non-2xx error pages), so those lose the header.

Testing

  • Not tested: no image was built and apachectl -t was not run. Apache 2.4.58 supports setifempty.
  • QA cannot re-test until an image containing this change exists. Expected result: exactly one Referrer-Policy: origin header on application responses.

🤖 Generated with Claude Code

https://claude.ai/code/session_017PYHoHdrQpH48n8vnAKQR8

jsokol and others added 2 commits November 13, 2026 11:25
… one (SR-2589)

default-ssl.conf set 'no-referrer-when-downgrade' with Header always set, while the
application's add_security_headers() sends 'origin'. The two landed in different header
tables, so responses carried two conflicting Referrer-Policy headers, and the weaker
Apache value sends the full URL (query string included) to https destinations.

Use setifempty (normal table, no 'always') so the app's value is the only one on
application responses and 'origin' still covers responses the app did not set.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017PYHoHdrQpH48n8vnAKQR8
The app sends both when an admin enables them (add_security_headers()); the
vhost's 'always set' copies ignored those settings and duplicated the headers.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_017PYHoHdrQpH48n8vnAKQR8
@jsokol
jsokol marked this pull request as ready for review November 13, 2026 20:48
@jsokol
jsokol enabled auto-merge (squash) November 13, 2026 20:48
@jsokol
jsokol disabled auto-merge November 13, 2026 20:48
@jsokol
jsokol merged commit 8873f2b into master Nov 13, 2026
8 checks passed
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