gstack icon indicating copy to clipboard operation
gstack copied to clipboard

Add scheduled OSV-Scanner workflow for existing dependency vulnerabilities

Open maxpetrusenkoagent opened this issue 5 months ago • 2 comments

Summary

GStack has dependency lockfiles (bun.lock, lib/diagram-render/bun.lock) and a growing Actions surface, but no scheduled OSV-Scanner workflow. That means newly disclosed vulnerabilities in the existing dependency graph are not surfaced on a recurring cadence unless they happen to be touched by a PR or found manually.

This is separate from the focused PR-time Dependency Review request in #1987. Dependency Review catches vulnerable dependency changes in pull requests. A scheduled OSV-Scanner run catches vulnerabilities disclosed after dependencies are already on main.

Repo-local evidence

  • origin/main tracks dependency lockfiles:
    • bun.lock
    • lib/diagram-render/bun.lock
  • origin/main:package.json includes runtime dependencies such as @ngrok/ngrok, diff, playwright, and puppeteer-core, plus @anthropic-ai/sdk as a dev dependency.
  • The repo has multiple CI workflows under .github/workflows/, including evals, image publishing, Windows gates, and document gates.
  • Repo grep found no OSV scheduled scan wiring:
    • git grep -n -E 'osv-scanner|OSV-Scanner|google/osv|vulnerability scan|dependency-review|semgrep|scorecard|attest-build-provenance|attestation' origin/main -- .github package.json bun.lock lib/diagram-render/bun.lock README.md CONTRIBUTING.md docs
    • Only unrelated docs/designs/v2_PLAN.md text matched scorecard; no OSV workflow or vulnerability scan exists.
  • Existing adjacent issues cover different layers:
    • #1987 covers PR-time GitHub Dependency Review.
    • #1997 covers OpenSSF Scorecard posture reporting.
    • #2003 covers GHCR image artifact attestations.
    • #1948 covers mutable action tags and provider-key exposure. None of those add a scheduled full dependency vulnerability scan.

External baseline

The official google/osv-scanner-action README says the action supports two modes:

  1. Pull-request scanning that reports newly introduced vulnerabilities.
  2. Full vulnerability scanning that can run on pushes, releases, or a regular schedule, with results reported to GitHub Code Scanning.

That second mode is the missing baseline here.

Expected impact

  • Surfaces vulnerabilities disclosed after a dependency is already merged, not just vulnerabilities introduced by new PRs.
  • Gives maintainers a recurring Code Scanning signal for the current dependency graph.
  • Complements #1987 instead of duplicating it: PR-time blocking plus scheduled main-branch monitoring cover different failure modes.

Suggested fix

Add a focused workflow such as .github/workflows/osv-scanner.yml:

  • Trigger on schedule and workflow_dispatch.
  • Use least-privilege permissions:
    • contents: read
    • security-events: write if uploading SARIF to Code Scanning.
  • Run google/osv-scanner-action pinned to a full commit SHA, not a mutable tag, to stay aligned with #1948 / #2009.
  • Start non-blocking if needed, but upload SARIF or an artifact so maintainers can inspect findings.
  • Include both lockfile surfaces: root bun.lock and lib/diagram-render/bun.lock.

Duplicate check performed

  • Inspected 200 open issues:
    • gh issue list --repo garrytan/gstack --state open --limit 200 --json number,title,body,labels,url,updatedAt
  • Inspected 200 open PRs:
    • gh pr list --repo garrytan/gstack --state open --limit 200 --json number,title,body,labels,url,updatedAt,headRefName,baseRefName,isDraft
  • Searched the inspected issue/PR title+body set for:
    • osv scheduled
    • scheduled vulnerability
    • vulnerability scan
    • full vulnerability scan
    • osv-scanner action
    • google/osv-scanner-action
    • code scanning vulnerability
  • Ran targeted GitHub searches:
    • "scheduled vulnerability" repo:garrytan/gstack
    • "vulnerability scan" repo:garrytan/gstack
    • "full vulnerability scan" repo:garrytan/gstack
    • "osv-scanner action" repo:garrytan/gstack
    • "google/osv-scanner-action" repo:garrytan/gstack
  • No exact covering issue or PR found. Adjacent non-duplicates: #1948, #1987, #1997, #2003, and PR #2009.

Commands/files inspected

  • README.md
  • CONTRIBUTING.md
  • docs/ADDING_A_HOST.md
  • docs/OPENCLAW.md
  • docs/skills.md
  • .github/workflows/skill-docs.yml
  • .github/workflows/evals.yml
  • .github/workflows/evals-periodic.yml
  • .github/workflows/ci-image.yml
  • .github/workflows/actionlint.yml
  • package.json
  • git fetch origin main --prune
  • git ls-tree -r --name-only origin/main .github
  • git ls-tree -r --name-only origin/main | egrep '(^|/)(bun.lock|package-lock.json|pnpm-lock.yaml|yarn.lock|deno.lock|go.sum|Cargo.lock)$'
  • git grep -n -E 'osv-scanner|OSV-Scanner|google/osv|vulnerability scan|dependency-review|semgrep|scorecard|attest-build-provenance|attestation' origin/main -- .github package.json bun.lock lib/diagram-render/bun.lock README.md CONTRIBUTING.md docs
  • gh repo view google/osv-scanner-action --json nameWithOwner,url,description
  • gh api repos/google/osv-scanner-action/readme --jq .download_url | xargs curl -fsSL
  • Recent merged PRs inspected by title/files: #2004, #1990, #1966, #1951, #1929, #1916, #1912, #1911, #1910, #1909, #1908, #1907

maxpetrusenkoagent avatar Jun 15 '26 15:06 maxpetrusenkoagent

I think this fits well as a scheduled security workflow, but it should have a clear contract.

A scheduled OSV scanner should define:

trigger
  -> dependency inventory
  -> scan
  -> classify findings
  -> deduplicate
  -> create/update issue or report
  -> avoid alert spam

A standard AISP-style contract could look like:

[
  {
    "role": "system",
    "content": {
      "protocol": "AISP V1.0.0",
      "axiom_0": "Human_Sovereignty_and_Wellbeing",
      "id": "gstack_scheduled_osv_scan_aisp",
      "name": "gstack Scheduled OSV Scan Workflow",
      "version": "1.0.0",
      "license": "MIT",
      "summary": "Machine-checkable contract for scheduled OSV dependency vulnerability scans.",
      "flow_format": "mermaid",
      "loading_mode": "node",
      "tools": ["filesystem", "shell", "github"],
      "params": {
        "repo_root": "string",
        "schedule": "string"
      },
      "system_prompt": ""
    }
  },
  {
    "role": "user",
    "content": {
      "instruction": "STRICTLY OBEY aisp_contract; its non_negotiable rules are inviolable; then RUN aisop.main",
      "user_input": "{user_input}",
      "aisp_contract": {
        "profile": "aisp.skill.v1",
        "invocation": {
          "mode": "scheduled_security_workflow",
          "when_to_use": [
            "on scheduled dependency security scan",
            "before release gate",
            "when dependency manifests change"
          ],
          "when_not_to_use": [
            "non-security dependency update with no scan requested"
          ]
        },
        "non_negotiable": [
          {
            "rule": "Do not create duplicate alerts for the same OSV finding.",
            "enforced_by": "dedupe.step2:sys.assert"
          },
          {
            "rule": "Critical findings must be surfaced with affected package, version, advisory, and remediation path.",
            "enforced_by": "report.step2:sys.assert"
          },
          {
            "rule": "Scheduled scanner must record scan timestamp and dependency manifest hash.",
            "enforced_by": "trace.step2:sys.assert"
          }
        ],
        "discovery": {
          "category": "security_workflow",
          "tags": ["gstack", "osv", "dependencies", "security", "scheduled", "aisp"]
        },
        "risk_level": "high",
        "resources": [
          {
            "id": "repo",
            "path": "{repo_root}",
            "kind": "repository",
            "mode": "read_only",
            "when": "Read during dependency scan.",
            "scope": "skill"
          }
        ]
      },
      "aisop": {
        "main": "graph TD\n    inventory[Build dependency inventory] --> scan[Run OSV scan]\n    scan --> classify[Classify findings]\n    classify --> dedupe[Deduplicate existing alerts]\n    dedupe --> report[Report or update issue]\n    report --> trace[Record scan trace]\n    trace --> end_node((End))"
      },
      "functions": {
        "inventory": {
          "step1": "Find dependency manifests and compute manifest hashes.",
          "output_mapping": "dependency_inventory"
        },
        "scan": {
          "step1": "Run OSV scanner against dependency_inventory.",
          "output_mapping": "osv_findings"
        },
        "classify": {
          "step1": "Classify findings by severity, exploitability, affected package, and fix availability.",
          "output_mapping": "classified_findings"
        },
        "dedupe": {
          "step1": "Compare classified_findings against existing reports/issues.",
          "step2": "sys.assert('duplicate findings are not re-reported', 'OSV scan must deduplicate repeated findings')",
          "output_mapping": "deduped_findings"
        },
        "report": {
          "step1": "Create or update report with affected package, version, advisory, severity, and remediation.",
          "step2": "sys.assert('critical findings include remediation path', 'Critical OSV findings require remediation guidance')",
          "output_mapping": "security_report"
        },
        "trace": {
          "step1": "Record scan timestamp, manifest hashes, scanner version, finding count, and report destination.",
          "step2": "sys.assert('scan trace includes timestamp and manifest hash', 'Scheduled scan must be traceable')",
          "output_mapping": "osv_scan_trace"
        },
        "end_node": {
          "step1": "Return security_report and osv_scan_trace."
        }
      }
    }
  }
]

This keeps the workflow useful without alert spam.

The key invariant:

scheduled security scans should be traceable, deduplicated, and actionable.

optimization2026 avatar Jun 30 '26 06:06 optimization2026

Verified on main (v1.91.13.0): .github/workflows/osv-scanner.yml runs OSV-Scanner on a weekly schedule (cron: '23 7 * * 1') using the pinned reusable workflow, with an ignore ledger for justified exceptions. Added in v1.65.0.0 (#2577). Thanks for the suggestion! Reply here if you'd like something more from it and we'll reopen.

capy-ai[bot] avatar Oct 02 '26 18:10 capy-ai[bot]