feat(plugins): add guard extension point for third-party security scanners#1106
Closed
PaoloC68 wants to merge 5 commits intoagent0ai:developmentfrom
Closed
feat(plugins): add guard extension point for third-party security scanners#1106PaoloC68 wants to merge 5 commits intoagent0ai:developmentfrom
PaoloC68 wants to merge 5 commits intoagent0ai:developmentfrom
Conversation
508e894 to
04539e4
Compare
Author
|
Closing this PR. The guard system has been rewritten as a standalone plugin following the new plugin architecture announced in the Feb 18 update. New plugin repo: https://github.com/PaoloC68/a0-guard-system The core framework changes (mutable event dict, entry_point guard discovery) are no longer needed — the plugin uses Will submit to the Plugin Index once the guard system is tested in production. |
Author
|
Superseded by #1165 — rebased onto latest |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a guard extension point that lets third-party security scanners (e.g. Cisco AI Skill Scanner) block dangerous tools and prompts before they execute. This builds on top of the existing extension system and the newly merged plugin architecture (#998) — zero new abstractions, just the plumbing that lets plugins say "stop".
Problem
Agent Zero can install and run arbitrary skills, but there is currently no hook where a security tool can inspect and block:
Related issues: #1074, #1071, #943, #851
What Changed
1. Mutable
eventdict incall_extensions()(python/helpers/extension.py)eventdict with metadata (extension_point,agent, plus all kwargs)importlib.metadataentry points (group:agent_zero.guards)2. Blocking logic in
agent.py(two sites only)tool_execute_before: if any handler setsevent["blocked"] = True, the tool is skipped and aResponseis returned withevent["block_reason"]message_loop_prompts_after: if any handler setsevent["blocked"] = True, the LLM call is skipped and a warning is injected into the message history3.
skill_installextension point (python/helpers/skills_import.py)skill_nameandskill_path4. Guard utilities (
python/helpers/guard_utils.py)save_scan_status(skill_name, status)/get_scan_status(skill_name)— JSON file per skill inusr/skill_scans/SAFE,NEEDS_REVIEW,BLOCKED5. Example guard extensions (drop-in, no config needed)
python/extensions/tool_execute_before/_05_scan_status_guard.py— blocks tools linked to skills withBLOCKEDscan statuspython/extensions/message_loop_prompts_after/_05_prompt_length_guard.py— detects prompt injection patterns and oversized prompts6. Test suite (
tests/test_guard_system.py)Design Decisions
event["blocked"].tool_execute_beforeandmessage_loop_prompts_after. Minimal surface, maximum impact.agent-zero-cisco-guard) registers via[project.entry-points."agent_zero.guards"]— discovered automatically, no manual config._05_prefix runs before default_10_extensions, following existing convention.How to Test
Example: Writing a Guard Plugin