Skip to content

[Draft] fix: Explicitly disable CORS credentials in agent_server.py - #736

Open
tteon wants to merge 1 commit into
mainfrom
fix/cors-allow-credentials-10766347084305788347
Open

tteon wants to merge 1 commit into
mainfrom
fix/cors-allow-credentials-10766347084305788347

Conversation

@tteon

@tteon tteon commented Oct 18, 2026

Copy link
Copy Markdown
Owner

Severity

Low

Vulnerability

The runtime/agent_server.py file configures CORSMiddleware with allow_origins set via an environment variable or default array. The allow_credentials flag was omitted. While Starlette defaults to False if omitted, leaving it implicit is an overly permissive default structure, often flagged by static analyzers because future changes enabling broad origins without reviewing credentials could introduce vulnerabilities.

Impact

Explicitly defining allow_credentials=False strengthens the boundary between frontend clients and the API runtime, ensuring the server rejects any credentialed (cookies, TLS client certs, etc.) cross-origin requests by default. This reduces the risk of CSRF or unintended session exposure in multi-tenant or loosely defined CORS environments.

Fix

Added allow_credentials=False to the CORSMiddleware initialization in runtime/agent_server.py.

Validation

Ran bash scripts/ci/run_basic_ci.sh which succeeded. The API endpoints tests passed successfully (uv run pytest extraction/tests/test_api_endpoints.py), ensuring no regressions were introduced to endpoint behavior.

Risks

None. allow_credentials already defaulted to False within Starlette's implementation, so this change simply makes the intent explicit and secure-by-default for future maintenance without altering existing live behavior.

Modified Files:

  • runtime/agent_server.py

PR created automatically by Jules for task 10766347084305788347 started by @tteon

The FastAPI/Starlette CORSMiddleware defaults to `allow_credentials=False` if not specified, but omitting it can flag security policies in scanners and lacks defense-in-depth against future configuration drift. Setting `allow_credentials=False` makes the default explicit and prevents credentialed CORS requests in this environment.

Co-authored-by: tteon <52625664+tteon@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

👋 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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 18, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-18T23:15:02.113642Z 9350f42 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions github-actions Bot added area-runtime Runtime API, policy, memory service, auth, or deployment shell. kind-maintenance Maintenance, chores, dependency hygiene, or repo cleanup. status-needs-triage Needs maintainer triage before work starts or merges. labels Oct 18, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-runtime Runtime API, policy, memory service, auth, or deployment shell. kind-maintenance Maintenance, chores, dependency hygiene, or repo cleanup. status-needs-triage Needs maintainer triage before work starts or merges.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant