Skip to content

feat(security): add automated security scanning, scan search filters, and pull support - #1757

Merged
paralta merged 8 commits into
mainfrom
feat/scan-db-reconciler
Jul 6, 2026
Merged

paralta merged 8 commits into
mainfrom
feat/scan-db-reconciler

Conversation

@paralta

@paralta paralta commented Jul 6, 2026

Copy link
Copy Markdown
Member

This PR introduces end-to-end security scanning for records in the directory. A new reconciler task periodically runs mcp-scanner and skill-scanner against unscanned records, persisting each scanner's result both as an OCI referrer (full report with findings) and as a denormalized scan_reports DB row (for efficient search queries). The server also upserts the DB row immediately when a ScanReport referrer is pushed directly via the API, so the search index reflects external scan results without waiting for the next reconciler cycle.

Two new search filters are exposed on dirctl search: --safe (all scanners reported is_safe=true, analogous to --trusted for signatures) and --scan-severity <threshold> (max severity ≥ the given level). There is intentionally no bare "has been scanned" filter — absence of a scan result is not semantically meaningful in the same way as a clean or dirty result. dirctl pull --scan-report fetches the full scan reports for a record.

  • The scan_reports table uses a composite primary key (record_cid, scanner_type) so each runner's result is tracked independently — a record can be safe per MCP and unsafe per skill simultaneously.
  • The indexer task is fixed to silently skip referrer blobs (whose CIDs appear as OCI tags) rather than logging them as indexing errors.
  • Scanner CLIs (mcp-scanner, skill-scanner) are installed via uv and added to Taskfile.deps.yml as shared tasks; the daemon config enables the scan task by default.

paralta added 6 commits July 3, 2026 15:30
Signed-off-by: Catarina Paralta <[email protected]>
Signed-off-by: Catarina Paralta <[email protected]>
Signed-off-by: Catarina Paralta <[email protected]>
Signed-off-by: Catarina Paralta <[email protected]>
@paralta
paralta requested a review from a team as a code owner July 6, 2026 10:54
@github-actions github-actions Bot added the size/M Denotes a PR that changes 200-999 lines label Jul 6, 2026
@github-actions

github-actions Bot commented Jul 6, 2026 •

Copy link
Copy Markdown
Contributor

The latest Buf updates on your PR. Results from workflow Buf CI / verify-proto (pull_request).

BuildFormatLintBreakingUpdated (UTC)
✅ passed⏩ skipped⏩ skipped✅ passedJul 6, 2026, 12:45 PM

@paralta

paralta commented Jul 6, 2026 •

Copy link
Copy Markdown
Member Author

Scan report result examples

Skill report

Skills imported from https://github.com/anthropics/skills/tree/main/skills/claude-api
Scan report pulled:

"scanReports": [
    {
      "analyzers": [
        "behavioral",
        "bytecode",
        "pipeline",
        "static",
        "trigger"
      ],
      "annotations": null,
      "findings": [
        {
          "category": "",
          "location": "",
          "message": "[SOCIAL_ENG_ANTHROPIC_IMPERSONATION] social_engineering: Skill name or description contains 'Anthropic', suggesting official affiliation",
          "remediation": "",
          "rule_id": "",
          "severity": "SEVERITY_MEDIUM"
        },
        {
          "category": "",
          "location": "",
          "message": "[MANIFEST_DESCRIPTION_TOO_LONG] policy_violation: Skill description is 1068 characters; Agent skills limit the `description` field to 1024 characters.",
          "remediation": "",
          "rule_id": "",
          "severity": "SEVERITY_INFO"
        },
        {
          "category": "",
          "location": "",
          "message": "[MDBLOCK_PYTHON_SUBPROCESS] command_injection: Code block in shared/token-counting.md at line 50 contains potentially dangerous Python code.",
          "remediation": "",
          "rule_id": "",
          "severity": "SEVERITY_MEDIUM"
        }
      ],
      "is_safe": true,
      "max_severity": "SEVERITY_MEDIUM",
      "scanned_at": "2026-07-06T11:20:16Z",
      "scanner_type": "SCANNER_TYPE_SKILL",
      "scanner_version": "2.0.12"
    }
  ]

MCP report

Record with name io.github.googleapis/mcp-toolbox and version 1.6.0available in prod.
Scan report pulled:

  "scanReports": [
    {
      "analyzers": [
        "behavioral"
      ],
      "annotations": null,
      "findings": [],
      "is_safe": true,
      "max_severity": "SEVERITY_NONE",
      "scanned_at": "2026-07-06T11:20:33Z",
      "scanner_type": "SCANNER_TYPE_MCP",
      "scanner_version": ""
    }
  ]

@paralta
paralta force-pushed the feat/scan-db-reconciler branch from 890716b to 08ad7ff Compare July 6, 2026 12:45
@paralta
paralta merged commit 94137f7 into main Jul 6, 2026
80 of 83 checks passed
@paralta
paralta deleted the feat/scan-db-reconciler branch July 6, 2026 13:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/M Denotes a PR that changes 200-999 lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Pull command to surface scan referrers [Feature]: Database table and search filter for scan status [Feature]: Reconciler scan task

2 participants