[Bug]: Deleting an MCP proxy leaves its API keys in the gateway's memory and in the policy engine
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 83/100
Research direction
In gateway/gateway-controller/pkg/eventlistener, start with handleEvent and compare MCP proxy DELETE handling with the REST API path. The issue names TestHandleEvent_APIDelete_RemovesAPIKeysFromMemoryAndXDS as the existing reference; add a corresponding MCP proxy test using the described config store and mock. Done means the proxy’s keys are removed from the store and RemoveAPIKeysByAPI is called once.
Written by the indexing model from the issue text.
Description
Please select the area the issue is related to
Gateway
Please select the aspect the issue is related to
Aspect/API (API backends, definitions, contracts, interfaces, OpenAPI), Aspect/Other (Anything else which does not match above categories)
Description
When a REST API is deleted, the gateway controller removes the API's keys from three places: the database, the in-memory store, and the policy engine's API key state (xDS). When an MCP proxy is deleted, only the database rows are removed. The keys stay in the controller's in-memory store and in the policy engine until the gateway controller restarts.
| On delete | REST API | MCP proxy |
|---|---|---|
Database rows (api_keys) |
Removed by DeleteConfig |
Removed by DeleteConfig |
In-memory store (store.RemoveAPIKeysByAPI) |
Removed | Kept |
Policy engine API key state (apiKeyXDSManager.RemoveAPIKeysByAPI) |
Removed | Kept |
Steps to Reproduce
The leftover state is internal: the policy engine's config_dump does not list API keys. So the clearest reproduction is the unit-level one below. It uses the same setup as the existing REST test.
- In
gateway/gateway-controller/pkg/eventlistener, build anEventListenerwith astorage.NewConfigStore(), a mockapiKeyXDSManager, and an MCP proxy config (testMCPStoredConfig(...)) added to the store. - Add an API key for the proxy to the store:
store.StoreAPIKey(&models.APIKey{ArtifactUUID: <proxy uuid>, ...}). - Send
eventhub.Event{EventType: eventhub.EventTypeMCPProxy, Action: "DELETE", EntityID: <proxy uuid>}tolistener.handleEvent. - Check the store's API keys for the proxy, and the mock's recorded
RemoveAPIKeysByAPIcalls.
Expected: the key is gone from the store, and RemoveAPIKeysByAPI was called once for the proxy, as for a REST API in TestHandleEvent_APIDelete_RemovesAPIKeysFromMemoryAndXDS.
Actual: the key is still in the store, and RemoveAPIKeysByAPI is never called.
Severity Level of the Issue
Severity/Minor (Non-critical functionality. Can be fixed in future releases)
Environment Details (with versions)
gateway-controller
- Dominant language
- Go
- Stars
- 76
- Forks
- 126
- Avg merge
- 2d 10h
- Merged PRs (30d)
- 183
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- No contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from wso2/api-platform
-
[Bug]: Policy-engine sampler ignores the parent's sampling decision, producing orphan spans and partial tracesPossibly taken @lahiruudayakumara claimed this 9 days ago. OpenArea/Gateway Aspect/Monitoring Severity/Major Type/Bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
wso2/api-platform#3735 ·
Maintainers usually reply within 1 day
-
UpstreamName routing convention for the primary provider is undocumented; fails silently as a 503 instead of a clear errorMay be free again @Shalitha1 claimed this 28 days ago, and no pull request is open. OpenArea/AIPolicies Area/PolicyEngine documentation Severity/Minor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
wso2/api-platform#3537 · 1 comment ·
Maintainers usually reply within 1 day
-
[Bug]: Root README documentation links 404 after docs/gateway and docs/ai-gateway removalPossibly taken @randilt claimed this 47 days ago. OpenAspect/API Aspect/Other hackathon Severity/Trivial Type/Bug
Difficulty 1/5 1-3 hours Newbie friendliness 90/100
wso2/api-platform#3375 ·
Maintainers usually reply within 1 day
-
Area/AIWorkspace Aspect/API Severity/Major Type/Bug
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
wso2/api-platform#3152 ·
Maintainers usually reply within 1 day
-
Aspect/UI Severity/Trivial Type/Bug
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
wso2/api-platform#3074 ·
Maintainers usually reply within 1 day
All issues in wso2/api-platform
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
area/frameworks area/steve kind/bug team/frameworks
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Exclude merge queue branches from push trigger in ci-workflow.yaml to eliminate duplicate CI runsOpenbug infra ready-for-triage triaged
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
redhat-et/ProtoBot#312 · 2 comments · 1 reaction ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day