o1-labs / o1-labs/Archive-Node-API
Harden CORS allowlist handling and cache behavior
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 19
- Forks
- 9
- Avg merge
- 14h 20m
- Merged PRs (30d)
- 8
Description
Context
Luis' latest review on #184 approved the secure CORS default, but left several non-blocking hardening notes that should not be lost after the production-readiness batch merges.
The shipped behavior is correct for the main rollout, but there are edge cases worth tightening in a follow-up.
Follow-up work
- Treat a bare
*anywhere inside a comma-separatedCORS_ORIGINallowlist as the deliberate wide-open case. TodayCORS_ORIGIN="https://app.example.com,*"silently opens CORS to every origin while the warning says the*entry is unlikely to match. - Add a negative allowlist test proving entries are exact matches, not prefix or substring matches.
- Document or mitigate the
Vary: Origincache behavior for multi-origin allowlists, especially the non-matching case that emitsAccess-Control-Allow-Origin: null. - Keep the interaction with #185 explicit: when
cors: false, Yoga's CORS preflight short-circuit is absent, so #185's localOPTIONSexemption is load-bearing. - If browser clients ever send
x-request-id, updateallowedHeadersfromcontent-typeto include it, otherwise preflight will reject those requests.
Acceptance criteria
-
CORS_ORIGINparsing handles*consistently whether it is the whole value or one entry in a list. - Unit coverage proves a malicious origin such as
https://evil-example.comdoes not matchhttps://example.com. - Deployment docs mention the required
Origincache behavior for CDN/LB layers when using multi-origin allowlists. - The rate-limit preflight dependency is documented in code or tests so the local
OPTIONSexemption is not later removed as redundant.
Related
- #184
- #185
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing CORS_ORIGIN parsing and preflight handling, then review the rate-limit OPTIONS exemption and deployment documentation. Add coverage for wildcard and exact-origin behavior, document the required Origin cache handling and the #185 dependency, and verify all acceptance criteria.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- api, backend, documentation, security
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100