feat(mcp-proxy): add OWASP mitigates field to policy rules and audit#840
Conversation
- Add mitigates?: string[] to PolicyRule interface for OWASP risk IDs - Add mitigatedRisks?: string[] to PolicyDecision for downstream consumers - Thread mitigatedRisks through proxy.ts policy evaluation to audit.ts - Add mitigates field to AuditEvent and CloudEvent data payload - Annotate standard.yaml, strict.yaml, enterprise.yaml with ASI risk IDs - Add policy evaluation tests for mitigates propagation Relates to Discussion microsoft#814 (Agentic Standards Landscape - MCP governance) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
🤖 AI Agent: security-scanner — Security Review: Pull Request AnalysisSecurity Review: Pull Request AnalysisThis pull request introduces a new feature to the Findings1. Prompt Injection Defense Bypass
2. Policy Engine Circumvention
3. Trust Chain Weaknesses
4. Credential Exposure
5. Sandbox Escape
6. Deserialization Attacks
7. Race Conditions
8. Supply Chain
Summary of Findings
Recommendations
Final AssessmentThe changes in this PR introduce a valuable feature for OWASP risk traceability but also introduce potential risks related to data validation and logging. Addressing the identified issues will ensure the robustness and security of the MCP proxy's policy engine and audit logging functionality. |
There was a problem hiding this comment.
🤖 AI Agent: code-reviewer
Review of Pull Request: feat(mcp-proxy): add OWASP mitigates field to policy rules and audit
Summary
This pull request introduces a new feature that allows policy rules in the MCP proxy to declare which OWASP ASI risks they mitigate. This information is propagated through policy evaluations and included in CloudEvents audit logs. The changes are well-structured, and tests have been added to ensure functionality.
Feedback
🔴 CRITICAL Issues
- Policy Rule Validation: Ensure that the
mitigatesfield is validated against a predefined set of OWASP ASI risks. If an invalid risk is provided, it could lead to incorrect policy enforcement. Consider implementing a validation mechanism to check that all entries in themitigatesarray are valid OWASP ASI identifiers.
🟡 WARNING Issues
-
Backward Compatibility: The addition of the
mitigatesfield to thePolicyRuleandPolicyDecisioninterfaces introduces a change in the public API. While this is a non-breaking change in terms of functionality, existing consumers of the API that do not expect this field may not handle it correctly. Ensure that this change is documented and consider versioning the API if necessary. -
Potential for Misconfiguration: The introduction of the
mitigatesfield could lead to misconfigurations if users mistakenly annotate rules with incorrect or irrelevant OWASP ASI identifiers. Provide clear documentation and examples to guide users on how to use this feature correctly.
💡 SUGGESTION Improvements
-
Documentation: Update the documentation to include details about the new
mitigatesfield, including its purpose, how to use it, and examples of valid OWASP ASI identifiers. This will help users understand the feature and its implications better. -
Type Safety: Consider using a more structured approach for the
mitigatesfield, such as defining a TypeScript enum for OWASP ASI identifiers. This would enhance type safety and reduce the risk of invalid entries. -
Testing: While tests have been added for the new feature, consider adding edge cases, such as:
- What happens if an empty array is provided for
mitigates? - How does the system behave if a policy rule has multiple mitigates, including duplicates?
- Test for invalid OWASP ASI identifiers to ensure they are handled gracefully.
- What happens if an empty array is provided for
-
Audit Log Clarity: In the audit logs, consider including more context around the
mitigatesfield, such as a description of each risk being mitigated. This could enhance the clarity of the logs and make it easier for users to understand the implications of policy decisions. -
Performance Considerations: If the
mitigatesfield is expected to grow in complexity or size, consider evaluating the performance impact on policy evaluation and audit logging. Ensure that the added complexity does not introduce significant overhead.
Conclusion
Overall, this pull request is a valuable enhancement to the MCP proxy's policy enforcement capabilities, aligning with OWASP standards. Addressing the critical issue regarding validation and considering the warnings and suggestions will help ensure the robustness and usability of the new feature.
|
Thanks @jackbatzner — the MCP governance initiative across all SDKs is a significant contribution. We've merged #774, #837, #840, #841, #842, #796 so far. For the remaining PRs (#839, #843, #844), just fix the CI issues noted in reviews and they're ready. For the stacked feature PRs (#775, #791, #832 + standalone packages), please rebase on latest main to resolve conflicts. |
Description
Adds OWASP risk traceability to MCP proxy policy decisions. Each policy rule can now declare which OWASP ASI risks it mitigates, and that information flows through policy evaluation into CloudEvents audit logs.
Changes
mitigates?: string[]toPolicyRuleinterface andmitigatedRisks?: string[]toPolicyDecisionmitigatedRisksfrom matched policy rules into audit callsmitigatestoAuditEventinterface and CloudEventdatapayloadmitigates: [ASI01]etc. referencing the 2026 OWASP Agentic Top 10Why
Discussion #814 identifies "contribute back implementation patterns as reference architectures" for OWASP. This makes AGT's MCP proxy one of the first implementations to carry explicit OWASP risk mapping in policy enforcement and audit trails.
Type of Change
Package(s) Affected
Checklist
Related Issues
Relates to Discussion #814 (Agentic Standards Landscape - MCP governance depth)