kubeflow / kubeflow/docs-agent

security: Replace CORS allow_origins=["*"] with env-var allowlist

Open
#76 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
42
Forks
111
Avg merge
6d 23m
Merged PRs (30d)
2

Description

Context

server-https/app.py:104 configures CORSMiddleware with allow_origins=["*"].

Problem

A wildcard origin lets any website make credentialed cross-origin requests to the API.

  • This matters especially once PR #67's auth middleware lands —CORS and auth need to be hardened together to actually be effective.

Why This Order

Filed after the Kustomize restructure because the clean fix is injecting ALLOWED_ORIGINS as an env var patched per overlay — empty in base, localhost in generic, production domain in OCI. Doing it before Kustomize means hardcoding values.

Acceptance Criteria

  • allow_origins read from ALLOWED_ORIGINS env var (comma-separated)
  • Defaults to http://localhost:3000 when unset (dev-safe)
  • Kustomize overlays patch the value per environment
  • Requests from unlisted origins receive a proper CORS rejection

Related

  • server-https/app.py:104
  • PR #67 — auth middleware (CORS and auth go together)
  • Parent tracking issue: #72
  • Depends on: Kustomize issue (child A above)
  • Blocks: auth hardening work (tracked in PR #67

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the CORS configuration at server-https/app.py:104, then inspect the Kustomize overlays and the related auth work in PR #67. Trace how environment values are supplied per overlay, and verify that unset, environment-specific, and unlisted-origin requests meet the acceptance criteria.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
backend-api-design, security
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.