Skip to content

fix(deck): replace gorilla/csrf with net/http.CrossOriginProtection - #843

Open
cblecker wants to merge 1 commit into
kubernetes-sigs:mainfrom
cblecker:fix/replace-gorilla-csrf-with-stdlib
Open

fix(deck): replace gorilla/csrf with net/http.CrossOriginProtection#843
cblecker wants to merge 1 commit into
kubernetes-sigs:mainfrom
cblecker:fix/replace-gorilla-csrf-with-stdlib

Conversation

@cblecker

@cblecker cblecker commented Aug 11, 2026

Copy link
Copy Markdown
Member

Summary

  • Replace github.com/gorilla/csrf v1.7.3 (CVE-2025-47909, medium severity) with Go stdlib net/http.CrossOriginProtection (available since Go 1.25)
  • Remove all CSRF token plumbing: cookie-secret derivation for CSRF, token injection into HTML templates, X-CSRF-Token headers in TypeScript, and the csrfToken JS global
  • CSRF protection is now always-on and requires no configuration — it validates Sec-Fetch-Site and Origin headers server-side instead of using the Synchronizer Token Pattern

Test plan

  • go build ./cmd/deck/... compiles clean
  • go test ./cmd/deck/... passes
  • go mod tidy removes gorilla/csrf, retains gorilla/sessions and gorilla/securecookie
  • No remaining csrfToken or gorilla/csrf references in the codebase
  • CI passes
  • Verify POST requests from Deck UI work (same-origin) and cross-origin POSTs are rejected with 403

Replace github.com/gorilla/csrf v1.7.3 (CVE-2025-47909) with Go
stdlib net/http.CrossOriginProtection, available since Go 1.25.

CrossOriginProtection uses Origin/Fetch Metadata validation instead
of the Synchronizer Token Pattern, so all CSRF token plumbing is
removed: cookie-secret derivation for CSRF, token injection into
HTML templates, X-CSRF-Token headers in TypeScript, and the
csrfToken JS global.

CSRF protection is now always-on and requires no configuration.

Assisted-by: Claude:claude-opus-4-6
@netlify

netlify Bot commented Aug 11, 2026

Copy link
Copy Markdown

Deploy Preview for k8s-prow ready!

Name Link
🔨 Latest commit 34fedb6
🔍 Latest deploy log https://app.netlify.com/projects/k8s-prow/deploys/6a7b80a2907fa700089bb6d7
😎 Deploy Preview https://deploy-preview-843--k8s-prow.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@kubernetes-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: cblecker

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubernetes-prow kubernetes-prow Bot added the area/deck Issues or PRs related to prow's deck component label Aug 11, 2026
@kubernetes-prow
kubernetes-prow Bot requested a review from smg247 August 11, 2026 20:05
@kubernetes-prow kubernetes-prow Bot added area/documentation Issues or PRs related to documentation approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Aug 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. area/deck Issues or PRs related to prow's deck component area/documentation Issues or PRs related to documentation cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant