fix: add null-origin consent compatibility flag - #925
Conversation
📝 WalkthroughWalkthroughAdds an environment-gated exception allowing ChangesNull-origin consent compatibility
Estimated code review effort: 3 (Moderate) | ~20 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Very interesting, I've adjusted my nginx settings but that's not a bad approach. Will do a little refac but will get this merged, thanks! |
|
@taylorwilsdon Yay! Let me know if I can help in any way to get that merged in. Excited that I'll be able to switch back to the latest Docker image tag soon! |
Description
Adds an explicit opt-in compatibility flag for OAuth 2.1 consent flows where a browser or MCP client sends
Origin: nullonPOST /consent. The bypass is limited to that exact method/path/header shape and leaves normal origin validation in place for all other requests.Context
Origin validation was added in #804, which is useful hardening, but it can also reject legitimate OAuth consent submissions from some browser/MCP-client flows when Chrome sends
Origin: nullafter the OAuth redirect chain. The README currently documents a reverse-proxy workaround for/consent, but that is proxy-specific and awkward for deployments behind Traefik, Caddy, managed ingress, or other setups where conditional header rewriting is not straightforward.In practice, affected deployments have to either pin to an older image from before the origin-validation change or add custom reverse-proxy rules. This PR provides a narrow image-level alternative: pass one env var to allow only the known
POST /consentnull-origin compatibility case, without disabling origin validation globally.Type of Change
Testing
Test commands run:
uv run pytest tests/core/test_well_known_cache_control_middleware.pyuv run ruff check core/server.py tests/core/test_well_known_cache_control_middleware.pyChecklist
Additional Notes
The new
WORKSPACE_MCP_ALLOW_NULL_ORIGIN_CONSENTflag defaults to disabled. When enabled, it allows only literalOrigin: nullonPOST /consent;/mcp,/token,/.well-known/*,GET /consent, and real disallowed origins remain rejected byOriginValidationMiddleware.