Skip to content

fix(devserver): tighten cors origin validation#203

Merged
Abhijeet Prasad (AbhiPrasad) merged 2 commits intomainfrom
abhi-fix-devserver-cors-origin-match
Apr 7, 2026
Merged

fix(devserver): tighten cors origin validation#203
Abhijeet Prasad (AbhiPrasad) merged 2 commits intomainfrom
abhi-fix-devserver-cors-origin-match

Conversation

@AbhiPrasad
Copy link
Copy Markdown
Member

Use a full regex match for preview Braintrust origins so crafted hostnames that merely share the allowed prefix are rejected. Add focused tests for valid preview origins, suffix bypass attempts, and OPTIONS header reflection behavior.

Use a full regex match for preview Braintrust origins so crafted hostnames
that merely share the allowed prefix are rejected. Add focused tests for
valid preview origins, suffix bypass attempts, and OPTIONS header reflection
behavior.
@starfolkai
Copy link
Copy Markdown

starfolkai bot commented Apr 3, 2026

Drop into this review session: sfk devbox connect pr-203-braintrust-sdk-python-1144 --attach

No serious bugs or issues found 🎉

The match() to fullmatch() fix correctly closes the CORS origin suffix bypass. Tests are colocated with the code they cover and follow existing patterns in the directory.

Note (below threshold, not flagged as an issue): test_cors.py may not be collected by the existing test_cli nox session in py/noxfile.py, which hard-codes test_server_integration.py. Consider adding the new file to that session or broadening it to discover all devserver tests.

@AbhiPrasad Abhijeet Prasad (AbhiPrasad) merged commit 848194e into main Apr 7, 2026
29 checks passed
@AbhiPrasad Abhijeet Prasad (AbhiPrasad) deleted the abhi-fix-devserver-cors-origin-match branch April 7, 2026 16:45
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.

2 participants