tests: add MCP auth mode e2e collection and Newman runner for headers/both/oauth#4524
Conversation
|
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (3)
📝 WalkthroughSummary by CodeRabbitRelease Notes
WalkthroughAdds an e2e test suite for Bifrost MCP authentication. The upstream example HTTP MCP server gains a ChangesMCP Auth E2E Test Suite
Sequence DiagramsequenceDiagram
participant Runner as run-newman-mcp-auth-tests.sh
participant Upstream as http-no-ping-server
participant Bifrost as bifrost-http
participant Newman as newman
Runner->>Upstream: build & start (MCP_SERVER_PORT override)
Runner->>Runner: poll upstream port for readiness
loop auth_mode ∈ {headers, both, oauth}
Runner->>Runner: write_config(auth_mode) → config.json
Runner->>Bifrost: start with config.json
Runner->>Runner: poll logs for "successfully started bifrost"
Runner->>Newman: run bifrost-v1-mcp-auth.postman_collection
Newman->>Bifrost: GET /.well-known/* (discovery gating)
Newman->>Bifrost: POST /mcp initialize (credential matrix)
Bifrost-->>Newman: 200 / 401 + WWW-Authenticate
Newman-->>Runner: exit code → OVERALL_EXIT
Runner->>Bifrost: stop
end
Runner->>Runner: print summary, exit OVERALL_EXIT
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 docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 golangci-lint (2.12.2)level=error msg="[linters_context] typechecking error: pattern ./...: directory prefix . does not contain main module or its selected dependencies" Comment |
5e5e90a to
5ee117b
Compare
7e7c217 to
32e4bc0
Compare
5ee117b to
ce7bb1b
Compare
32e4bc0 to
0fc852e
Compare

Summary
Adds an end-to-end Newman test suite that validates inbound
/mcpauthentication across all three server auth modes (headers,both,oauth). This ensures that enabling OAuth support does not regress existing virtual-key authentication behavior, and that each mode enforces exactly the access guarantees it is supposed to.Changes
Added
bifrost-v1-mcp-auth.postman_collection.json— a Postman collection with two test groups:/.well-known/oauth-protected-resource,/.well-known/oauth-authorization-server, and/.well-known/jwks.jsonreturn 404 inheadersmode and well-formed spec-compliant responses inboth/oauthmodes.x-bf-vk,Authorization: Bearer <vk>,x-api-key, anonymous, inactive virtual key, and an invalid JWT) against each mode. A single collection encodes the full accept/reject matrix by branching on theauth_modeenvironment variable.Added
run-newman-mcp-auth-tests.sh— a shell runner that:http-no-ping-serverMCP example so/mcpexposes real tools.headers→both→oauth) and aggregates pass/fail.--html,--json,--verbose,--bail, and--portflags for flexible CI integration.Core guarantees validated:
headersmode, all virtual-key credential paths connect exactly as before and the OAuth discovery surface is invisible (404).bothmode, header-credential outcomes are unchanged and JWT acceptance is added.oauthmode, header credentials are rejected outright with aWWW-Authenticateresponse.Type of change
Affected areas
How to test
Build the binary first, then run the test runner:
Newman must be installed (
npm install -g newman). The runner will build the upstream MCP server fromexamples/mcps/http-no-ping-serverautomatically.Expected outcome: all three modes pass with
✓ All MCP auth modes passed!.Breaking changes
Related issues
Security considerations
The test suite exercises the authentication boundary for the
/mcpendpoint, including rejection of inactive credentials, invalid JWTs, and header-based credentials in strict OAuth mode. No secrets or PII are introduced; all keys used are test fixtures scoped to the local test server.Checklist
docs/contributing/README.mdand followed the guidelines