tests: add MCP auth e2e collection covering discovery, credential matrix, OAuth issuance, refresh rotation, revocation window, and runtime mode flip - #4525
Conversation
|
|
|
Warning Review limit reached
More reviews will be available in 7 minutes and 15 seconds. Learn how PR review limits work. To continue reviewing without waiting, enable usage-based billing in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based credits. 🚦 How do rate limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan refill rate. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, the refill rate gradually slows as usage increases. The highest same-day bursts are limited more strictly. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughExtends the MCP auth Postman collection with config validation, full OAuth virtual-key identity and session identity flows, revocation window tests, and a runtime config flip scenario. The Newman runner gains ChangesMCP Auth E2E Test Suite Expansion
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
395dd0c to
a5fa0bd
Compare
32e4bc0 to
0fc852e
Compare
a5fa0bd to
fb2ee5f
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tests/e2e/api/README.md`:
- Around line 268-269: The documentation comment for MCP auth runner options is
missing the `--mcp-port` flag from the list of supported options. Update the
comment line that documents the runner options (currently showing `--port`,
`--html`, `--json`, `--verbose`, `--bail`) to also include `--mcp-port` with an
appropriate description (e.g., default port number for MCP server). This will
allow users to easily discover and use the flag when configuring local test
runs.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: 76273975-5e1a-4083-b462-b4bf00757edd
📒 Files selected for processing (3)
tests/e2e/api/README.mdtests/e2e/api/collections/bifrost-v1-mcp-auth.postman_collection.jsontests/e2e/api/runners/individual/run-newman-mcp-auth-tests.sh
0fc852e to
69dff03
Compare
fb2ee5f to
6071377
Compare
69dff03 to
a0d848e
Compare
6071377 to
401b8ea
Compare
a0d848e to
e2e77f5
Compare
401b8ea to
bbcb5a4
Compare
6d48620 to
ae74b23
Compare
a8ff1fa to
349ffaa
Compare
ae74b23 to
8407ccc
Compare
349ffaa to
4b068be
Compare
4b068be to
e340e87
Compare
8407ccc to
4aead7a
Compare
e340e87 to
96fc3d0
Compare
4aead7a to
6a8e256
Compare
96fc3d0 to
f4f46cd
Compare
6a8e256 to
fc9b3f1
Compare
f4f46cd to
de7872f
Compare
fc9b3f1 to
d3dfd70
Compare
Merge activity
|
The base branch was changed.
de7872f to
685fcec
Compare
…rix, OAuth issuance, refresh rotation, revocation window, and runtime mode flip (#4525) ## Summary Adds a comprehensive end-to-end test suite for MCP inbound authentication, covering all three server auth modes (`headers`, `both`, `oauth`) in a single Postman collection driven by a dedicated Newman runner. ## Changes - Added `bifrost-v1-mcp-auth.postman_collection.json` with five new test folders: - **Config validation:** asserts that unknown `mcp_server_auth_mode` values and `oauth2_server_config` payloads sent with `headers` mode are rejected with 400, and that the boot mode round-trips correctly through `GET /api/config`. - **Full OAuth flow (virtual-key identity):** covers dynamic client registration, PKCE-S256 authorize, consent bound to a virtual key, token exchange, JWT connect to `/mcp`, refresh rotation, and stolen-token family revocation (replaying a rotated refresh token revokes the entire grant family). - **Revocation window:** issues a fresh grant, revokes it via the management API, then asserts that the refresh token is immediately rejected while the already-issued short-lived access token continues to connect until expiry. - **Full OAuth flow (session identity):** consent mints a server-side session identity, the resulting JWT connects to `/mcp`, and then enabling `enforce_auth_on_inference` at runtime causes that same session token to be rejected. - **Runtime config flip (headers → both):** from a `headers`-mode boot, upgrades to `both` via `PUT /api/config`, confirms discovery endpoints come alive, and verifies header-VK connections are unaffected. - All test scripts branch on the `auth_mode` env-var so a single collection encodes the full credential matrix across modes; steps that do not apply to a given mode are skipped with a passing no-op assertion. - Added `--ignore-redirects` to the Newman invocation in `run-newman-mcp-auth-tests.sh` so that authorize redirects are captured as 302 responses rather than followed, allowing the collection to extract flow IDs from `Location` headers. - Updated `README.md` with a full description of the new collection and runner, including per-mode assertion summaries and local run instructions. ## Type of change - [ ] Bug fix - [ ] Feature - [ ] Refactor - [ ] Documentation - [x] Chore/CI ## Affected areas - [ ] Core (Go) - [x] Transports (HTTP) - [ ] Providers/Integrations - [ ] Plugins - [ ] UI (React) - [ ] Docs ## How to test Run the MCP auth test suite locally from `tests/e2e/api`: ```sh ./runners/individual/run-newman-mcp-auth-tests.sh --binary /path/to/bifrost-http # Optional flags # --port <port> (default 8090) # --html emit HTML report # --json emit JSON report # --verbose verbose Newman output # --bail stop on first failure ``` The runner builds and starts the upstream MCP server (`examples/mcps/http-no-ping-server`), boots a fresh server instance per `mcp_server_auth_mode`, pre-seeds an MCP client and two virtual keys (one active, one inactive), and executes the collection against each mode in sequence. A built `bifrost-http` binary is required. ## Screenshots/Recordings N/A ## Breaking changes - [ ] Yes - [x] No ## Related issues N/A ## Security considerations The collection exercises the full OAuth 2.0 issuance surface including PKCE, refresh rotation, stolen-token family revocation, and the revocation window. No secrets are introduced; all credentials are ephemeral test values seeded by the runner. ## Checklist - [ ] I read `docs/contributing/README.md` and followed the guidelines - [x] I added/updated tests where appropriate - [x] I updated documentation where needed - [ ] I verified builds succeed (Go and UI) - [ ] I verified the CI pipeline passes locally if applicable

Summary
Adds a comprehensive end-to-end test suite for MCP inbound authentication, covering all three server auth modes (
headers,both,oauth) in a single Postman collection driven by a dedicated Newman runner.Changes
bifrost-v1-mcp-auth.postman_collection.jsonwith five new test folders:mcp_server_auth_modevalues andoauth2_server_configpayloads sent withheadersmode are rejected with 400, and that the boot mode round-trips correctly throughGET /api/config./mcp, refresh rotation, and stolen-token family revocation (replaying a rotated refresh token revokes the entire grant family)./mcp, and then enablingenforce_auth_on_inferenceat runtime causes that same session token to be rejected.headers-mode boot, upgrades tobothviaPUT /api/config, confirms discovery endpoints come alive, and verifies header-VK connections are unaffected.auth_modeenv-var so a single collection encodes the full credential matrix across modes; steps that do not apply to a given mode are skipped with a passing no-op assertion.--ignore-redirectsto the Newman invocation inrun-newman-mcp-auth-tests.shso that authorize redirects are captured as 302 responses rather than followed, allowing the collection to extract flow IDs fromLocationheaders.README.mdwith a full description of the new collection and runner, including per-mode assertion summaries and local run instructions.Type of change
Affected areas
How to test
Run the MCP auth test suite locally from
tests/e2e/api:The runner builds and starts the upstream MCP server (
examples/mcps/http-no-ping-server), boots a fresh server instance permcp_server_auth_mode, pre-seeds an MCP client and two virtual keys (one active, one inactive), and executes the collection against each mode in sequence. A builtbifrost-httpbinary is required.Screenshots/Recordings
N/A
Breaking changes
Related issues
N/A
Security considerations
The collection exercises the full OAuth 2.0 issuance surface including PKCE, refresh rotation, stolen-token family revocation, and the revocation window. No secrets are introduced; all credentials are ephemeral test values seeded by the runner.
Checklist
docs/contributing/README.mdand followed the guidelines