Fix cross-origin embedding of public sign-in icons #9

Merged
exler merged 1 commit from camila/public-icon-corp into main 2026-10-18 11:56:39 +02:00
Collaborator

Root cause

Helmet sends Cross-Origin-Resource-Policy: same-origin even for the public icons. Forgejo embeds them from a different origin, so Firefox rejects the successful SVG response with NS_ERROR_DOM_CORP_FAILED.

Fix

  • Set Cross-Origin-Resource-Policy: cross-origin for exactly the black/white hoplite SVG paths, after helmet and before static serving.
  • Keep the default policy for all other resources; no global CORS or security relaxation.

Verification

  • Security-policy regression reproduced failure on both icons before the fix and passes after it. Existing logo and login remain same-origin. No artwork-content tests added.
  • go vet ./..., go test ./..., git diff --check: pass.
  • Actual local application served both icons to a Chromium page on a different origin (port 8937 to 8940); both images loaded with nonzero natural width.
  • CI passed on the x86 runner, including go vet ./... and go test -race ./....

Deployment is still required. Browsers may retain the old header for up to the existing 3600-second asset cache lifetime; reload with cache disabled or append ?v=2 to the icon URL after deployment.

## Root cause Helmet sends `Cross-Origin-Resource-Policy: same-origin` even for the public icons. Forgejo embeds them from a different origin, so Firefox rejects the successful SVG response with `NS_ERROR_DOM_CORP_FAILED`. ## Fix - Set `Cross-Origin-Resource-Policy: cross-origin` for exactly the black/white hoplite SVG paths, after helmet and before static serving. - Keep the default policy for all other resources; no global CORS or security relaxation. ## Verification - Security-policy regression reproduced failure on both icons before the fix and passes after it. Existing logo and login remain same-origin. No artwork-content tests added. - `go vet ./...`, `go test ./...`, `git diff --check`: pass. - Actual local application served both icons to a Chromium page on a different origin (port 8937 to 8940); both images loaded with nonzero natural width. - CI passed on the x86 runner, including `go vet ./...` and `go test -race ./...`. Deployment is still required. Browsers may retain the old header for up to the existing 3600-second asset cache lifetime; reload with cache disabled or append `?v=2` to the icon URL after deployment.
Allow cross-origin embedding of public sign-in icons
All checks were successful
Push Docker Image / test (pull_request) Successful in 1m0s
Push Docker Image / push (pull_request) Has been skipped
Push Docker Image / test (push) Successful in 59s
Push Docker Image / push (push) Successful in 51s
88ce13d056
exler merged commit 88ce13d056 into main 2026-10-18 11:56:39 +02:00
exler deleted branch camila/public-icon-corp 2026-10-18 11:56:39 +02:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
exler/thermopylae!9
No description provided.