feat(examples/atr-community-rules): upgrade 15→287 rules (ATR v2.0.12), add weekly sync workflow, fix #908 owed items#1277
Conversation
…), add weekly sync workflow, fix microsoft#908 owed items - Upgrade atr_security_policy.yaml from 15 curated rules to 287 production-ready rules from ATR v2.0.12 (314 total; 27 excluded by maturity filter: 21 status:draft + 6 maturity:test) - Add sync_atr_rules.py maturity filter: skips status:draft and maturity:test rules - Add atr_community_policy_full.yaml: full auto-generated policy baseline - Add .github/workflows/sync-atr-community-rules.yml: weekly Monday sync, never commits to main, opens PR for human review, SHA-pinned actions - Add examples/atr-community-rules/__init__.py: promised in microsoft#908 - Update test_atr_policy.py: add TestCVECoverageDenied + TestCVECoverageAllowed classes covering CVE-2025-59528 (Flowise), CVE-2026-33032 (MCPwn), CVE-2026-27825/27826 (mcp-atlassian) Builds on microsoft#908.
There was a problem hiding this comment.
🤖 AI Agent: code-reviewer
Pull Request Review for feat(examples/atr-community-rules): upgrade 15→287 rules (ATR v2.0.12), add weekly sync workflow, fix #908 owed items
🔴 CRITICAL: Security Concerns
-
Validation of ATR Rules:
- The
sync_atr_rules.pyscript skips rules with invalid Python regex patterns without raising an error (WARNING: skipping). This behavior could lead to silent omissions of critical security rules, potentially creating gaps in the policy engine. Consider implementing a stricter validation mechanism that fails the sync process if critical rules are skipped. Alternatively, provide a detailed report of skipped rules in the PR description for manual review.
- The
-
Dependency Integrity:
- The workflow installs the
agent-threat-rulesnpm package usingnpm install --no-save --no-package-lock. While this avoids polluting the repository with lock files, it introduces a supply chain risk because the package version is not pinned. If the upstream package is compromised, malicious rules could be introduced into the policy. 🔴 Recommendation: Pin theagent-threat-rulesversion in the workflow and update it manually after verification.
- The workflow installs the
-
Regex Injection:
- The
sync_atr_rules.pyscript processes regex patterns from an external source (ATR rules). This could lead to regex injection vulnerabilities if malicious actors introduce crafted patterns that exploit Python'sremodule (e.g., catastrophic backtracking). 🔴 Recommendation: Implement strict validation for regex patterns before processing them. Consider using a library likeregexwith timeout settings to mitigate potential DoS attacks.
- The
-
Sandbox Escape:
- The rules in
atr_community_policy_full.yamlinclude patterns that could potentially be exploited for sandbox escapes (e.g.,os.system,subprocess,exec). While these rules aim to detect malicious inputs, their correctness must be rigorously validated to avoid false negatives. 🔴 Recommendation: Conduct a thorough review of the rules to ensure they cover all known sandbox escape vectors and cannot be bypassed.
- The rules in
🟡 WARNING: Potential Breaking Changes
- Backward Compatibility:
- The addition of the
--strict-regexflag insync_atr_rules.pychanges the behavior of the script. If this flag is used in production workflows, it could lead to unexpected failures due to stricter validation. 🟡 Recommendation: Clearly document the behavior of this flag and ensure that existing workflows are updated accordingly.
- The addition of the
💡 Suggestions for Improvement
-
Testing Coverage:
- The new
TestCVECoverageclass intest_atr_policy.pyadds 5 assertions for CVE rules. While this is a good start, consider expanding the test suite to include edge cases for regex patterns, especially for rules targeting sandbox escapes, privilege escalation, and insecure inter-agent communication.
- The new
-
Rule Metadata:
- The
atr_community_policy_full.yamlfile includes rules with priority levels but lacks detailed metadata about the rules' origin, authorship, and rationale. 💡 Suggestion: Include additional metadata fields (e.g.,source,author,last_updated) to improve traceability and accountability.
- The
-
Workflow Dispatch:
- The workflow supports manual triggering via
workflow_dispatch. Consider adding a parameter to allow maintainers to specify whether to run the sync in--strict-regexmode during manual execution.
- The workflow supports manual triggering via
-
Documentation:
- The updated
README.mdmentions the sync workflow but does not provide detailed instructions for maintainers on how to review and validate the generated rules. 💡 Suggestion: Expand the documentation to include a step-by-step guide for reviewing sync PRs, including how to handle skipped rules and verify the integrity of the ATR package.
- The updated
-
Performance Optimization:
- The
sync_atr_rules.pyscript usesyaml.safe_loadto parse the YAML file and counts the rules using Python. This approach may become a bottleneck as the ruleset grows. 💡 Suggestion: Consider optimizing this step by using a more efficient YAML parsing library or implementing a streaming parser.
- The
-
Concurrency Settings:
- The workflow sets
cancel-in-progress: falsefor concurrency. While this prevents interruptions, it could lead to overlapping runs if the sync process takes longer than expected. 💡 Suggestion: Evaluate whethercancel-in-progress: trueis more appropriate to avoid potential conflicts.
- The workflow sets
Summary of Recommendations
- 🔴 Critical: Implement stricter validation for skipped rules, pin the
agent-threat-rulesversion, and mitigate regex injection risks. - 🟡 Warning: Document the behavior of the new
--strict-regexflag to avoid breaking changes in workflows. - 💡 Suggestions: Expand test coverage, improve rule metadata, enhance documentation, optimize performance, and review concurrency settings.
This PR introduces significant improvements to the ATR ruleset and governance automation but requires careful attention to security and backward compatibility to ensure robustness and safety.
🤖 AI Agent: security-scanner — Security Analysis of the Pull RequestSecurity Analysis of the Pull Request1. 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
Final RecommendationThis PR introduces significant improvements to the |
|
Thanks for the thorough bot review. Addressing each point:
|
There was a problem hiding this comment.
🤖 AI Agent: code-reviewer
Review Summary
This pull request introduces significant changes to the repository, including the addition of a comprehensive ruleset for agent threat detection, a weekly sync workflow for updating the ruleset, and fixes for issues raised in #908. While the changes are generally well-structured and provide valuable functionality, there are several areas that require attention to ensure security, maintainability, and backward compatibility.
🔴 CRITICAL: Security Concerns
-
ATR Rules Validation:
- The
sync_atr_rules.pyscript skips rules with invalid Python regex patterns without strict validation (--strict-regexis disabled by default). This could allow potentially malicious or unintended rules to bypass scrutiny and be included in theatr_community_policy_full.yaml. - Action: Implement a stricter validation mechanism for regex patterns, even in non-strict mode. Log skipped rules in a separate file for manual review during PRs.
- The
-
Dependency Management:
- The workflow installs the
agent-threat-rulesnpm package without verifying its integrity (e.g., using a checksum or signature). This poses a supply chain attack risk. - Action: Add integrity checks for the downloaded package, such as verifying a checksum or using a trusted source for the package.
- The workflow installs the
-
Regex Injection Risk:
- The rules in
atr_community_policy_full.yamlcontain user-input-based regex matching. If not properly sandboxed, this could lead to denial-of-service attacks or arbitrary code execution via crafted regex patterns. - Action: Ensure that the regex engine used for matching is sandboxed and has appropriate safeguards against catastrophic backtracking and other regex-related vulnerabilities.
- The rules in
-
Privilege Escalation Rules:
- The rules for detecting privilege escalation (e.g.,
atr-2026-00074) rely on regex patterns that could be bypassed with minor variations in input. For example, using different spacing or encoding could evade detection. - Action: Enhance the robustness of these rules by incorporating normalization steps (e.g., whitespace normalization, encoding normalization) before applying regex matching.
- The rules for detecting privilege escalation (e.g.,
🟡 WARNING: Potential Breaking Changes
- Backward Compatibility:
- The addition of 287 rules to the
atr_security_policy.yamlmay introduce false positives for existing users relying on the previous 15-rule policy. This could disrupt workflows or cause unintended denials. - Action: Clearly document the changes in the release notes and provide a migration guide for users to adapt their configurations. Consider versioning the ruleset to allow users to opt into the new ruleset incrementally.
- The addition of 287 rules to the
💡 Suggestions for Improvement
-
Workflow Enhancements:
- The weekly sync workflow currently runs in "lenient mode" by default. Consider adding an option for maintainers to toggle between strict and lenient modes via environment variables or workflow inputs.
- Add more detailed logging for skipped rules, including the exact reason for skipping (e.g., invalid regex pattern, draft status).
-
Testing:
- The new
TestCVECoverageclass intest_atr_policy.pyis a good start, but the test coverage could be expanded to include edge cases for regex patterns, especially for rules with high priority (e.g., privilege escalation, prompt injection). - Consider adding tests for the
sync_atr_rules.pyscript itself, especially for the_validate_regex()function and the new--strict-regexflag.
- The new
-
Documentation:
- Update the repository's main README to include details about the new ruleset and the weekly sync workflow.
- Provide examples of how users can utilize the
atr_community_policy_full.yamlfile in their own projects.
-
Performance Optimization:
- The
sync_atr_rules.pyscript processes a large number of rules. Consider profiling the script to identify bottlenecks and optimize performance, especially for regex validation and YAML parsing.
- The
-
Rule Prioritization:
- The rules in
atr_community_policy_full.yamlhave varying priorities. Consider adding a mechanism to allow users to customize the priority levels or disable specific rules without modifying the YAML file directly.
- The rules in
Conclusion
This PR introduces valuable features and fixes, but it also raises critical security concerns and potential backward compatibility issues. Addressing the flagged issues and implementing the suggested improvements will enhance the robustness, security, and usability of the changes.
imran-siddique
left a comment
There was a problem hiding this comment.
Thanks for the ATR rules upgrade — the policy files and sync script under \�xamples/\ look good.
However, the PR adds a GitHub Actions workflow (.github/workflows/sync-atr-community-rules.yml) that runs weekly and has write permissions. Per our GOVERNANCE.md, changes to .github/\ require maintainer-level security review.
To proceed, please split this into two PRs:
- PR A (merge now): The \�xamples/atr-community-rules/\ files only (policies, sync script, tests, _init_.py)
- PR B (separate review): The .github/workflows/sync-atr-community-rules.yml\ workflow
This lets us ship the rules immediately while the workflow gets the security review it needs. Happy to merge PR A as soon as it's split.
imran-siddique
left a comment
There was a problem hiding this comment.
LGTM — nice upgrade from 15 to 287 rules. Approve.
|
Thanks for the work here @eeee2345 — the rule expansion from 15 to 287 is substantial. Before we can merge, a couple of supply-chain concerns need addressing in the sync workflow: 1.
|
imran-siddique
left a comment
There was a problem hiding this comment.
Reviewed. Workflow security is solid (version-pinned npm, PR-only workflow, no auto-merge to main). Regex validation handles the strict/lenient tradeoff correctly. CVE test coverage is good. LGTM.
|
@imran-siddique — quick FYI since the weekly auto-sync started running. ATR was integrated into MISP at two layers on 2026-05-10, both merged by adulau (MISP project lead):
For AGT enterprise users: PolicyEvaluator output carrying ATR rule IDs now resolves natively in MISP-compatible threat-intel infrastructure with full cluster-level context — not just tags. The weekly auto-sync covers rule additions on its own; the MISP integration is a parallel layer that gives AGT scan output a standard threat-intel shape downstream without any custom enrichment. No action needed. |
…), add weekly sync workflow, fix microsoft#908 owed items (microsoft#1277) * feat(examples/atr-community-rules): upgrade 15→287 rules (ATR v2.0.12), add weekly sync workflow, fix microsoft#908 owed items - Upgrade atr_security_policy.yaml from 15 curated rules to 287 production-ready rules from ATR v2.0.12 (314 total; 27 excluded by maturity filter: 21 status:draft + 6 maturity:test) - Add sync_atr_rules.py maturity filter: skips status:draft and maturity:test rules - Add atr_community_policy_full.yaml: full auto-generated policy baseline - Add .github/workflows/sync-atr-community-rules.yml: weekly Monday sync, never commits to main, opens PR for human review, SHA-pinned actions - Add examples/atr-community-rules/__init__.py: promised in microsoft#908 - Update test_atr_policy.py: add TestCVECoverageDenied + TestCVECoverageAllowed classes covering CVE-2025-59528 (Flowise), CVE-2026-33032 (MCPwn), CVE-2026-27825/27826 (mcp-atlassian) Builds on microsoft#908. * fix(sync-workflow): pin agent-threat-rules to @2.0.12 instead of @latest Addresses supply chain concern from code-reviewer bot: pinned version prevents a compromised npm publish from auto-injecting malicious rules on next sync. Update the pin manually after verifying each ATR release. --------- Co-authored-by: Panguard AI <[email protected]>
Summary
Three things:
Full ATR ruleset shipped now — upgrades
atr_security_policy.yamlfrom 15 curatedrules to 287 production-ready rules from ATR v2.0.12 (314 total; 27 excluded by the
sync script's maturity filter: 21
status: draft+ 6maturity: test). Coverage growswith the ATR community — the sync workflow (item 2) keeps you tracking it automatically.
Weekly sync workflow —
.github/workflows/sync-atr-community-rules.ymlruns everyMonday, pulls the latest ATR upstream, diffs the output, and opens a PR for human
review. Never commits directly to
main. You retain full veto on every update.(Your
policy-validation.ymlalready validates all*policy*.yamlfiles, so everysync PR is automatically validated before you see it.)
Two items owed from feat(examples): add ATR community security rules for PolicyEvaluator #908 —
__init__.pyis confirmed absent fromexamples/atr-community-rules/on main today; adding it here. Thesys.exit(1)→FileNotFoundErrorfix insync_atr_rules.pyis also included per@aymenhmaidiwastaken's review comment.
Nothing under
packages/is modified.What changed
examples/atr-community-rules/atr_security_policy.yamlsync_atr_rules.py, maturity-filtered from 314 ATR v2.0.12)examples/atr-community-rules/atr_community_policy_full.yamlexamples/atr-community-rules/__init__.pyexamples/atr-community-rules/sync_atr_rules.pysys.exit(1)→FileNotFoundError; add_validate_regex(); add--strict-regexflagexamples/atr-community-rules/test_atr_policy.pyTestCVECoverageclass (5 assertions for the April 2026 CVE rules)examples/atr-community-rules/README.md.github/workflows/sync-atr-community-rules.ymlworkflow_dispatch; SHA-pinned actionsATR v2.0.12 coverage in this PR
27 rules with
status: draftormaturity: testare excluded by the sync script and will not appear in the output policy.Benchmarks: 97.1% recall on NVIDIA garak 666 in-the-wild jailbreaks · 100% recall
on 498 labeled SKILL.md samples · 99.6% precision on 850 PINT adversarial samples ·
OWASP Agentic Top 10 10/10 · MITRE ATLAS 100/113 mapped
Why the sync workflow is governance-safe
Per @imran-siddique's concern from #908 (dependency-confusion risk on the npm side):
main— every refresh opens a PR on a bot-owned branch.You close the PR to reject an update.
policy-validation.ymlruns automatically on the PR — every sync is validatedbefore it reaches a reviewer.
--no-save --no-package-lock— no lock-file pollution.sequences valid in PCRE but not Python
reare skipped with aWARNINGline inthe PR description. Use
--strict-regexlocally to audit them.If you want
workflow_dispatch-only (noschedule:trigger), one-line change.Tests