Skip to content

🔒 [Security Fix] Enforce Strict Cookie Controls for CSRF in Production#1222

Closed
Hardonian wants to merge 2 commits into
mainfrom
jules-15726436235836208553-4573b2a8
Closed

🔒 [Security Fix] Enforce Strict Cookie Controls for CSRF in Production#1222
Hardonian wants to merge 2 commits into
mainfrom
jules-15726436235836208553-4573b2a8

Conversation

@Hardonian

Copy link
Copy Markdown
Owner

🎯 What: The CSRF token cookie was being generated with httpOnly: false hardcoded and secure: config.security.secureCookies without explicit defaults ensuring strictness in production.
⚠️ Risk: If an application allows JavaScript access to the CSRF cookie (httpOnly: false) in production, it increases the risk that an XSS vulnerability could be used to steal the CSRF token and bypass CSRF protection. In addition, not enforcing the secure flag in production makes it susceptible to Man-in-the-Middle attacks if the site is ever loaded over HTTP.
🛡️ Solution: Updated csrfProtection cookie configuration to enforce httpOnly: true and secure: true when running in production or preview environments. The token remains available to the client via the response body of the /api/csrf-token endpoint, allowing clients to securely authenticate state-changing requests without the need for raw JS access to the cookie.


PR created automatically by Jules for task 15726436235836208553 started by @Hardonian

@google-labs-jules

Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@vercel

vercel Bot commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
settler Error Error Jul 17, 2026 12:12pm

@github-actions

Copy link
Copy Markdown

🔒 Release Safety Check Results

Safety Checks Passed

{"code":"NOT_FOUND","message":"Requested function was not found"}

@github-actions

Copy link
Copy Markdown

🔍 Classification Check Results

  • Total Files: 5292
  • OSS_PUBLIC: 52 ✅
  • PLATFORM_PROPRIETARY: 104
  • INTERNAL_BUSINESS: 1644
  • SECRET_RISK: 0 ✅
  • Violations: 0 ✅

No violations detected. Safe to merge!


📊 View full classification report

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 252ffa3c9b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +91 to +92
httpOnly: isProduction, // Must be accessible to JavaScript in dev, strict in prod
secure: isProduction || config.security.secureCookies, // HTTPS only in production

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reissue existing CSRF cookies with the strict flags

When production users already have a csrf-token from the previous release, this branch is skipped because existingToken is present, so the browser keeps the old HttpOnly=false/possibly non-Secure cookie attributes until the 24-hour expiry; the same skip exists in getCsrfToken. In production/preview, re-set the cookie with the existing token (or clear it) so the stricter attributes take effect immediately after deployment.

Useful? React with 👍 / 👎.

- Replaced `cargo-deny-action@v1` with `@v2` and `github/codeql-action/*@v3` with `@v4` to avoid deprecation errors on Node 24.
- Fixed `gitleaks-action` which now requires `GITHUB_TOKEN` injected instead of `config-path`.
- Updated `packages/logger/tsconfig.json` to emit composite type declarations and added a `references` to it in `packages/agents/tsconfig.json`, resolving the `error TS2307: Cannot find module '@settler/logger'` build failure.
@github-actions

Copy link
Copy Markdown

🔒 Release Safety Check Results

Safety Checks Passed

{"code":"NOT_FOUND","message":"Requested function was not found"}

@github-actions

Copy link
Copy Markdown

🔍 Classification Check Results

  • Total Files: 5292
  • OSS_PUBLIC: 52 ✅
  • PLATFORM_PROPRIETARY: 104
  • INTERNAL_BUSINESS: 1644
  • SECRET_RISK: 0 ✅
  • Violations: 0 ✅

No violations detected. Safe to merge!


📊 View full classification report

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2932abcbb5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +50 to +52
uses: EmbarkStudios/cargo-deny-action@v2
with:
command: check

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Restore the cargo-deny policy file

In this Rust Verify workflow, replacing the CLI invocation that ran from crates/ means the job no longer loads the repository's only deny policy (crates/deny.toml; I checked with find . -maxdepth 2 -name deny.toml). The cargo-deny action runs from the repository root and its docs/action.yml say it defaults to --manifest-path ./Cargo.toml and expects a root deny.toml, so PR/scheduled Rust security checks will either run without Settler's license/source/bans configuration or fail to find it. Please pass the existing config path (or move the file to the root) so the gate keeps enforcing the same policy.

Useful? React with 👍 / 👎.

@Hardonian

Copy link
Copy Markdown
Owner Author

Closed during PR cleanup: mergeable=UNKNOWN base=main. Reopen only with a current verified change.

@Hardonian Hardonian closed this Jul 20, 2026
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