fix: skip global API key check for connector routes#255
Merged
Conversation
Connector routes have their own dedicated ConnectorTokenAuth middleware that enforces X-Connector-Token with constant-time comparison. The global APIKeyAuth middleware was incorrectly requiring the API key on these routes too, forcing connectors to know and send the CP's global API key — a credential they should never need. This adds a prefix skip for /api/v1/connector/ in APIKeyAuth, matching the existing pattern for /health, /ui, and /api/v1/did/ routes. Also adds comprehensive functional tests for the full connector auth chain: - ConnectorTokenAuth (valid/invalid/missing token, audit metadata injection) - ConnectorCapabilityCheck (enabled/disabled/read-only/missing capabilities) - Integration tests proving connector routes reject requests without a valid connector token, even though they bypass the global API key check Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
/api/v1/connector/*) now bypass the globalAPIKeyAuthmiddleware — they have their ownConnectorTokenAuthwhich enforcesX-Connector-Tokenwith constant-time comparisonConnectorTokenAuth,ConnectorCapabilityCheck, and a full integration test proving the middleware chain is secureSecurity verification
The integration tests explicitly prove:
Test plan
🤖 Generated with Claude Code