-
Notifications
You must be signed in to change notification settings - Fork 614
[BUG][PLUGINS]: RESOURCE_POST_FETCH plugins are executed before invoke_resource() resolves resource templates #2648
Copy link
Copy link
Closed
Labels
MUSTP1: Non-negotiable, critical requirements without which the product is non-functional or unsafeP1: Non-negotiable, critical requirements without which the product is non-functional or unsafebugSomething isn't workingSomething isn't workingpluginspythonPython / backend development (FastAPI)Python / backend development (FastAPI)
Milestone
Description
🐞 Bug Summary
- RESOURCE_POST_FETCH plugins are executed before invoke_resource() resolves resource templates. Because of this ordering, plugins only receive raw/template content, and values introduced during invoke_resource() are not redacted.
🧩 Affected Component
Select the area of the project impacted:
-
mcpgateway- API -
mcpgateway- UI (admin panel) -
mcpgateway.wrapper- stdio wrapper - Federation or Transports
- CLI, Makefiles, or shell scripts
- Container setup (Docker/Podman/Compose)
- Other (explain below)
🔁 Steps to Reproduce
- Enable RESOURCE_POST_FETCH hook with secrets_detection plugin.
- Create a resource whose content is dynamically resolved via invoke_resource() (e.g., template expansion or secret injection).
- Call read_resource() for that resource.
- Observe that secrets added during invoke_resource() appear in the response without being redacted.
🤔 Expected Behavior
What should have happened instead?
- RESOURCE_POST_FETCH should execute after invoke_resource() so plugins receive the fully materialized content.
- Secrets detection should redact sensitive values from the final resolved payload before returning it to the client.
🧠 Environment Info
You can retrieve most of this from the /version endpoint.
| Key | Value |
|---|---|
| Version or commit | e.g. v0.9.0 or main@a1b2c3d |
| Runtime | e.g. Python 3.11, Gunicorn |
| Platform / OS | e.g. Ubuntu 22.04, macOS |
| Container | e.g. Docker, Podman, none |
🧩 Additional Context (optional)
Add any configuration details, flags, or related issues.
Root cause: RESOURCE_POST_FETCH currently runs immediately after DB fetch instead of after resource resolution.
Proposed fix:
Move RESOURCE_POST_FETCH invocation to after content normalization + invoke_resource()
Ensure plugins operate on fully resolved content
Reactions are currently unavailable
Metadata
Metadata
Labels
MUSTP1: Non-negotiable, critical requirements without which the product is non-functional or unsafeP1: Non-negotiable, critical requirements without which the product is non-functional or unsafebugSomething isn't workingSomething isn't workingpluginspythonPython / backend development (FastAPI)Python / backend development (FastAPI)