Skip to content

Refuse cross-site mirror jobs and framing of the UI - #574

Merged
andrew merged 2 commits into
git-pkgs:mainfrom
simonchrz:fix/mirror-csrf-ui-framing
Oct 24, 2026
Merged

andrew merged 2 commits into
git-pkgs:mainfrom
simonchrz:fix/mirror-csrf-ui-framing

Conversation

@simonchrz

Copy link
Copy Markdown
Contributor

Two small hardening changes for setups where the API and UI sit behind an ingress that authenticates browsers.

  • POST /api/mirror now requires Content-Type: application/json and answers 415 otherwise. A page on another site could make a visitor's browser post a text/plain form whose body parses as JSON and start mirror jobs; a JSON content type needs a CORS preflight, which the proxy never answers.
  • Every /ui response sends X-Frame-Options: DENY and Content-Security-Policy: frame-ancestors 'none', so another site cannot frame a version page and get the Delete button clicked. Browsed archive files keep their sandbox policy alongside frame-ancestors.

The curl examples in the docs already send the JSON content type.

A page on another site could make a visitor's browser POST a text/plain
body that parses as JSON and start mirror jobs. Browsers only send
application/json cross-origin after a CORS preflight, which the proxy
never answers, so HandleCreate now refuses other content types with 415.
Without X-Frame-Options or a frame-ancestors policy another site could
frame a version page and trick a signed-in user into clicking Delete.
Every /ui response now sends both; browsed archive files keep their
sandbox policy alongside frame-ancestors.
@andrew
andrew merged commit 08e9e7d into git-pkgs:main Oct 24, 2026
6 checks passed
@simonchrz simonchrz added the breaking Changes behaviour users rely on; needs a minor release label Oct 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking Changes behaviour users rely on; needs a minor release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants