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 and introduces the canonical detection-engineering-coverage-evaluation skill for Antigravity and Gemini CLI agents.

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. New Detection Engineering MCP Tools (server/secops/secops_mcp/tools/detection_agent.py)

Adds 5 new tools to the SecOps FastMCP toolset:

  • 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.
  • 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. Supports optional composite coverage exclusion.
  • get_operation: Polls standard Google Long-Running Operations (LRO) until completion, surfacing progress metadata and final evaluation responses.
  • generate_rules: Synthesizes production-ready candidate YARA-L 2.0 detection rules specifically tailored to close uncovered TDOs and coverage gaps.

All tools are registered in FastMCP and exported via server/secops/secops_mcp/tools/__init__.py.

2. 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.

3. Persona & 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.

4. 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

  • Added server/secops/tests/test_secops_detection_agent_unit.py containing 12 async unit tests.
  • Tests cover endpoint routing, request body structure, parameter aliases (tdo_events, threat_detection_opportunities, opportunity_events), JSON serialization, and error handling for all 5 tools.
  • All 12 unit tests pass:
    uv run --with pytest --with pytest-asyncio pytest server/secops/tests/test_secops_detection_agent_unit.py
    # 12 passed in 0.65s
  • Linting and code formatting verified clean:
    uv run --with ruff ruff check server/secops/secops_mcp/tools/detection_agent.py server/secops/tests/test_secops_detection_agent_unit.py
    # All checks passed!
    uv run --with ruff ruff format --check server/secops/secops_mcp/tools/detection_agent.py server/secops/tests/test_secops_detection_agent_unit.py
    # 2 files already formatted

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