[TASK][PLUGINS]: Add unit tests for secrets detection plugins
โ Test Summary
Add unit tests for plugins/secrets_detection module covering pattern detection, container scanning.
๐งช Test Type
Choose one or more applicable categories:
- [x] Unit tests (Python)
- [ ] Integration / end-to-end tests
- [ ] Manual UI testing (admin panel)
- [ ] Transport coverage (HTTP, WebSocket, SSE, stdio)
- [ ] Federation / multi-gateway testing
- [ ] Configuration / environment-specific behavior
- [ ] Other (explain below)
๐งฌ Scope & Affected Components
Select what this test covers or validates:
- [ ]
mcpgatewaycore (API logic, handlers) - [ ] Admin UI (HTMX / Alpine / Tailwind)
- [ ] Tool/Resource/Prompt logic
- [ ] Federation sync/discovery
- [ ] Server interactions or SSE
- [ ] Auth / JWT / security flows
- [ ] Observability (logging, metrics)
- [ ] Makefile, shell scripts or CLI
- [ ] Containerized setup (Docker/Podman)
- [x] Other: Plugin framework - secrets detection
๐ Acceptance Criteria
What should pass or be verified?
- [x] All relevant assertions are covered
- [ ] No side-effects or regressions observed
- [ ] Confirmed in multiple environments (if needed)
- [ ] Edge cases and error handling tested
- [ ] Logs and output are clean and expected
๐ Additional Context & Steps
Include commands, expected behaviors, or test strategy.
# Run unit tests
pytest tests/unit/plugins/test_secrets_detection.py -v
I'd like to work on this, I'll review the plugins/secrets_detection module and propose test coverage!
Thanks for filing this. The plugins/secrets_detection module has 8 detection patterns (AWS keys, Google API keys, Slack tokens, private keys, JWTs, hex secrets, base64) but existing tests (tests/unit/plugins/test_secrets_detection.py) only cover the AWS secret pattern.
Key areas to test:
- All 8 regex patterns with valid/invalid/boundary inputs
_scan_container()recursive scanning logic- Configuration options (
redact,block_on_detection,min_findings_to_block) - The three hook methods (
prompt_pre_fetch,tool_post_invoke,resource_post_fetch)
See tests/unit/plugins/test_unified_pdp_plugin.py for the mocking pattern and plugins/AGENTS.md for test guidelines.
Hi @crivetimihai, I've already submitted a PR covering all of these areas: #2877
- All 8 regex patterns with valid/invalid/boundary tests
- _scan_container() recursive scanning and redaction
- Configuration options (redact, block_on_detection, min_findings_to_block)
- All three hooks (prompt_pre_fetch, tool_post_invoke, resource_post_fetch)
- Edge cases (empty inputs, deep nesting, examples cap)
- Also found and fixed a bug: payload.name โ payload.prompt_id in the redaction path
97 tests total, all passing. Would appreciate a review when you get a chance! ;)
Triage: Validated. Unit tests for secrets detection. Good first issue. Needs an assignee.
this has been done in the new repository