Skip to content

feat(secops): add Detection Engineering Agent MCP tools and coverage evaluation skill - #305

Open
dandye wants to merge 9 commits into
mainfrom
add_de_agent_apis
Open

feat(secops): add Detection Engineering Agent MCP tools and coverage evaluation skill#305
dandye wants to merge 9 commits into
mainfrom
add_de_agent_apis

Conversation

@dandye

@dandye dandye commented Sep 3, 2026

Copy link
Copy Markdown
Collaborator

Summary

Implements support for the newly launched Google SecOps Agentic Detection Engineering (ADE) APIs in secops-mcp, introduces the canonical detection-engineering-coverage-evaluation skill for Antigravity and Gemini CLI agents, and adds a comprehensive end-to-end documentation guide and tool reference.

This enables security teams and autonomous agents to automate the end-to-end detection engineering lifecycle: ingesting threat intelligence, generating Threat Detection Opportunities (TDOs), simulating attacker behavior with synthetic UDM events, running isolated rule coverage evaluations via Chronicle Long-Running Operations (LRO), synthesizing candidate YARA-L 2.0 rules for identified coverage gaps, and deploying verified detections with explicit human-in-the-loop authorization.

Reference documentation: Agentic Detection Engineering in Google SecOps


Changes

1. Detection Engineering MCP Tools (server/secops/secops_mcp/tools/detection_agent.py & security_rules.py)

Adds 5 new tools to the SecOps FastMCP toolset, plus tool aliases for Remote OneMCP parity:

  • generate_threat_detection_opportunity: Generates structured Threat Detection Opportunities (TDOs) from natural-language threat intel descriptions and target log types.
  • generate_synthetic_events: Simulates attacker activity by synthesizing realistic raw logs, UDM event records, and JSON-encoded UDM strings for specific TDOs. Automatically synthesizes the threat_detection_opportunity_events wrapper in both single- and multi-TDO flows to ensure seamless chaining into rule coverage evaluation without KeyError exceptions. Supports multi-TDO batching.
  • evaluate_rule_coverage_long_running: Initiates a Chronicle LRO (:evaluateRuleCoverageLongRunning) to evaluate synthetic events against active rulesets in a safe sandbox simulation without writing mock data to production storage. Defaults exclude_composite_coverage=True to avoid false coverage signals from multi-event composite/correlation rules.
  • get_operation: Polls standard Google Long-Running Operations (LRO) until completion, surfacing progress metadata and final evaluation responses. Automatically normalizes operation name prefixes.
  • generate_rules: Synthesizes production-ready candidate YARA-L 2.0 detection rules specifically tailored to close uncovered TDOs and coverage gaps. Supports multi-TDO batching.
  • get_rule (security_rules.py): Added as a FastMCP tool alias alongside get_security_rule to ensure 1:1 compatibility with Remote OneMCP servers.
  • Robust Parameter Aliasing & Input Flexibility: Added comprehensive alias support across all ADE tools (threat_description/threatDescription, log_types/logTypes with automatic comma-separated string to list coercion, tdo/threat_detection_opportunities/tdo_events/opportunity_events, operation_name/operationName, background_context/backgroundContext). Unwraps nested wrapper dictionaries automatically.

2. Comprehensive Agentic Detection Engineering Documentation (Merged PR #306)

  • docs/agentic_detection_engineering.md: New end-to-end guide detailing the ADE architecture, Mermaid lifecycle diagram, SecOps Web UI synthetic test data visibility configuration, step-by-step python script walkthroughs, and troubleshooting tips.
  • docs/img/synthetic_data_visibility.png: UI screenshot illustrating the SecOps "Show synthetic data in search and rules" setting.
  • docs/servers/secops_mcp.md: Expanded reference table for all 5 ADE tools with parameter descriptions, exclude_composite_coverage=True default explanation, and complete end-to-end Example 9 walkthrough.
  • docs/index.md & docs/toc.md: Added global quick links and Table of Contents entries.
  • docs/google_secops_extension.md: Documented Skill 6 (detection-engineering-coverage-evaluation).

3. Detection Engineering Coverage Evaluation Skill (extensions/google-secops/skills/detection-coverage/)

Adds the detection-engineering-coverage-evaluation skill (available via .agent/skills/detection-coverage/SKILL.md):

  • Lifecycle Runbook: Structured 8-stage detection pipeline (Intel Ingestion $\rightarrow$ TDO Generation $\rightarrow$ Synthetic Simulation $\rightarrow$ Rule Coverage Evaluation $\rightarrow$ Gap Analysis $\rightarrow$ YARA-L 2.0 Rule Generation $\rightarrow$ Verification $\rightarrow$ Deployment).
  • Prompt Injection Defense: Enforces strict demarcation when parsing untrusted external threat reports, blog posts, and markdown feeds.
  • Safety Gate: Requires explicit user confirmation with full rule preview before creating or enabling rules in production.

4. Persona & Extension Tool Mapping Documentation

  • docs/personas/detection_engineer.md: Updated Detection Engineer persona documentation to detail ADE tools, workflows, and sample execution flows.
  • extensions/google-secops/TOOL_MAPPING.md: Added the Detection Engineering tool category mapping.
  • extensions/google-secops/GEMINI.md: Added Skill 6 (detection-engineering-coverage-evaluation) to the extensions registry.

5. Git Hygiene & Secret Isolation

  • Added .envrc and .gcloud/ to .gitignore to prevent credential and local configuration leakage when using direnv and local Application Default Credentials (ADC).

Verification & Testing

Unit Tests

  • Expanded server/secops/tests/test_secops_detection_agent_unit.py to 19 async unit tests.
  • Tests cover endpoint routing, request body structure, parameter aliases, string log-type coercion, single and multi-TDO synthesis/batching, nested response unwrapping, operation prefix normalization, and get_rule alias.
  • All 19 detection agent unit tests pass:
    uv run --directory server/secops --with pytest --with pytest-asyncio pytest tests/test_secops_detection_agent_unit.py
    # 19 passed in 0.81s
  • Linting verified clean:
    uv run --directory server/secops --with ruff ruff check secops_mcp/tools/detection_agent.py tests/test_secops_detection_agent_unit.py
    # All checks passed!
  • Documentation build verified clean:
    uv run --with-requirements docs/requirements.txt make -C docs html
    # build succeeded, copying images... [100%] img/synthetic_data_visibility.png

Live Tenant Verification

Verified end-to-end execution against a live Google SecOps tenant using ADC:

  1. generate_threat_detection_opportunity: Successfully extracted TDOs (t01, t02) for PowerShell-based C2 communication.
  2. generate_synthetic_events: Successfully generated 8 synthetic UDM events simulating suspicious PowerShell process launches and outbound network connections.
  3. evaluate_rule_coverage_long_running: Initiated LRO (operations/dea-bkFXS0...) with synthetic events.
  4. get_operation: Polled operation status to retrieve coverage results.
  5. generate_rules: Successfully synthesized candidate YARA-L 2.0 rule (ttp_suspicious_powershell_network_connection) closing the identified gap.

TAG=agy
CONV=b434fecb-6fd3-4841-b909-49d23ef70fa3

…evaluation skill

Implement the official Google SecOps Agentic Detection Engineering (ADE) toolset and end-to-end coverage evaluation workflow:

- MCP Tools (`server/secops/secops_mcp/tools/detection_agent.py`):
  * `generate_threat_detection_opportunity`: Generates structured Threat Detection Opportunities (TDOs) from threat descriptions and log types.
  * `generate_synthetic_events`: Simulates attacker behavior by synthesizing raw logs and UDM events for given TDOs.
  * `evaluate_rule_coverage_long_running`: Initiates Chronicle LRO (`:evaluateRuleCoverageLongRunning`) to test synthetic events against active rulesets without committing mock logs to storage.
  * `get_operation`: Polls long-running operation status for asynchronous evaluation results.
  * `generate_rules`: Synthesizes candidate YARA-L 2.0 detection rules to close identified coverage gaps.
  * Exported in `server/secops/secops_mcp/tools/__init__.py`.

- Skill & Documentation:
  * Packaged `detection-engineering-coverage-evaluation` skill in `extensions/google-secops/skills/detection-coverage/SKILL.md` with prompt-injection defense, 8-step lifecycle, and explicit user-confirmation safeguards before deploying rules.
  * Documented tool mapping in `extensions/google-secops/TOOL_MAPPING.md` and `GEMINI.md`.
  * Updated Detection Engineer persona documentation in `docs/personas/detection_engineer.md`.

- Testing & Safeguards:
  * Added unit test suite covering API calling conventions, payload serialization, error handling, and parameter aliases in `server/secops/tests/test_secops_detection_agent_unit.py`.
  * Verified against live Google SecOps tenant with Application Default Credentials (ADC).
  * Added `.envrc` and `.gcloud/` to `.gitignore` to prevent credential leakage.

TAG=agy
CONV=b434fecb-6fd3-4841-b909-49d23ef70fa3
@dandye
dandye requested a review from a team September 3, 2026 21:31
…ntation

Document Google SecOps Agentic Detection Engineering (ADE) APIs and workflows:
- Created `docs/agentic_detection_engineering.md` detailing the 8-stage lifecycle (TDO generation, synthetic telemetry simulation, sandboxed LRO rule coverage evaluation, gap analysis, and candidate YARA-L 2.0 rule synthesis).
- Embedded SecOps UI configuration for Synthetic Data Visibility (`docs/img/synthetic_data_visibility.png`).
- Updated `docs/servers/secops_mcp.md` with all 5 ADE MCP tools (`generate_threat_detection_opportunity`, `generate_synthetic_events`, `evaluate_rule_coverage_long_running`, `get_operation`, `generate_rules`) and Example 9 walkthrough.
- Updated `docs/google_secops_extension.md` to register Skill 6 (`detection-engineering-coverage-evaluation`).
- Updated `docs/toc.md` and `docs/index.md` navigation and quick links.

TAG=agy
CONV=b434fecb-6fd3-4841-b909-49d23ef70fa3
…et_rule tool

- Add threat_description, threatDescription, log_types, logTypes parameter aliases in generate_threat_detection_opportunity.
- Add plural parameter aliases (threat_detection_opportunities, tdo), raw dictionary unwrapping, and multi-TDO batching in generate_synthetic_events.
- Add tdo_events, tdoEvents, opportunity_events, opportunityEvents aliases and raw wrapper dictionary handling in evaluate_rule_coverage_long_running.
- Add operation_name, operationName aliases and endpoint normalization with auto-prefixed operations/ in get_operation.
- Add threat_detection_opportunities, tdo, background_context, backgroundContext aliases, raw wrapper dictionary unwrapping, and multi-TDO batching in generate_rules.
- Register get_rule tool alias in security_rules.py for full parity with Remote OneMCP server tool definitions.
- Expand unit test suite in test_secops_detection_agent_unit.py with 7 new comprehensive test scenarios covering aliases, batching, and get_rule.

TAG=agy
CONV=b434fecb-6fd3-4841-b909-49d23ef70fa3
- Update evaluate_rule_coverage_long_running docs to show exclude_composite_coverage defaults to True.
- Fix TOOL_MAPPING link in docs/google_secops_extension.md to point to GitHub file location.

TAG=agy
CONV=b434fecb-6fd3-4841-b909-49d23ef70fa3
…xpand wrapper dict unwrapping

- Synthesize threat_detection_opportunity_events in single-TDO and multi-TDO paths of generate_synthetic_events to prevent KeyError in downstream tools.
- Coerce string log_types to single-element list in generate_threat_detection_opportunity and _clean_tdo.
- Unwrap tdo_events, tdoEvents, opportunity_events, opportunityEvents wrapper dictionaries in evaluate_rule_coverage_long_running.
- Add warning logs when invalid TDOs are skipped during multi-TDO batching.
- Update unit test suite to verify single-TDO tdo_events synthesis, string log_types coercion, and tdo_events wrapper key unwrapping.

TAG=agy
CONV=b434fecb-6fd3-4841-b909-49d23ef70fa3
- Fix create_security_rule typo to match create_rule tool name.
- Clarify activation step instructions.

TAG=agy
CONV=b434fecb-6fd3-4841-b909-49d23ef70fa3
docs(secops): add Agentic Detection Engineering guide and tool documentation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant