Skip to content

feat(security): add GHSA detector-review pipeline and OpenGrep CI workflows - #69483

Merged
jesse-merhi merged 13 commits into
mainfrom
security/opengrep-ghsa-detector-pipeline
Apr 29, 2026
Merged

jesse-merhi merged 13 commits into
mainfrom
security/opengrep-ghsa-detector-pipeline

Conversation

@jesse-merhi

@jesse-merhi jesse-merhi commented Apr 20, 2026 •

Copy link
Copy Markdown
Member

Summary

This PR adds a GHSA-backed OpenGrep regression pipeline for OpenClaw. The goal is to turn historical security advisories into reusable static-analysis canaries so future PRs are checked for known vulnerable patterns before they merge.

The shipped CI shape is intentionally split into two workflows:

  • OpenGrep — PR Diff (.github/workflows/opengrep-precise.yml): runs on pull requests and scans only changed first-party paths via scripts/run-opengrep.sh --changed --sarif --error. This keeps findings relevant to the PR diff instead of surfacing unrelated repository-wide backlog.
  • OpenGrep — Full (.github/workflows/opengrep-precise-full.yml): manual workflow_dispatch only and scans the full first-party source set via scripts/run-opengrep.sh --sarif --error. This gives maintainers an explicit repository-wide audit path without making every PR inherit all historical findings.

What this achieves

  • Converts accepted OpenClaw GitHub Security Advisories into per-advisory OpenGrep detector candidates.
  • Compiles the low-noise precise rules into security/opengrep/precise.yml with stable ghsa-detector.<ghsa>.<rule> IDs.
  • Uploads OpenGrep SARIF to GitHub Code Scanning under stable categories for PR-diff and full scans.
  • Keeps the core scan focused on first-party source paths (src/, extensions/, apps/, packages/, scripts/) while centralizing test/fixture/QA exclusions in .semgrepignore.
  • Records provenance in security/opengrep/compile-manifest.json so every shipped rule can be traced back to the GHSA and detector-review run.

Main changes

  • scripts/run-ghsa-detector-review-batch.mjs

    • Runs a coding harness (claude, rovodev, codex, opencode, or custom command) against selected advisories.
    • Writes per-case artifacts under .artifacts/ghsa-detector-review-runs/<run>/cases/<ghsa>/....
    • Validates generated precise rules against the vulnerable and fixed commits when --validate-coverage is enabled.
    • Fails closed for incomplete coverage validation: missing reports, missing commits/rules, OpenGrep parse failures, OpenGrep non-zero exits, and unsafe extracted-file mappings no longer become successful cases.
    • Rejects unsafe Extracted-as paths so model-produced report text cannot write outside the temporary scan tree.
  • scripts/compile-opengrep-rules.mjs

    • Rewrites generated rule IDs and injects ghsa, advisory-url, detector-bucket, source-run, and source-rule-id metadata.
    • Stores portable source-run paths instead of local absolute paths.
    • Uses OpenGrep itself to validate generated super-configs, maps invalid rules by reported rule_id/span, drops mapped invalid rules, and fails closed on unmapped validator failures.
  • scripts/run-opengrep.sh

    • Provides the canonical local/CI wrapper.
    • Supports full scans and diff-scoped scans (--changed) with matching output modes (--sarif, --json, --error).
    • Rejects the retired broad mode so the repo only ships the precise rulepack.
  • security/opengrep/precise.yml

    • Current tracked precise rulepack: 147 valid rules.
    • Excludes one parser-invalid generated rule from the compiled output and excludes one performance-only/base64 rule that was not appropriate for PR blocking.
  • security/opengrep/compile-manifest.json

    • Tracks run provenance and skipped/invalid generated rules.
    • No longer commits local absolute run paths.
  • Docs/changelog/labeler

    • Documents the detector-review flow, recompilation steps, diff-scoped PR scan, and manual full scan.
    • Adds security/**, .semgrepignore, and OpenGrep workflows to the security labeler surface.
    • Adds an Unreleased changelog entry for the new security/OpenGrep pipeline.

Validation

Local scoped validation run from the prepared branch:

  • node --check scripts/compile-opengrep-rules.mjs ✅
  • node --check scripts/run-ghsa-detector-review-batch.mjs ✅
  • actionlint .github/workflows/opengrep-precise.yml .github/workflows/opengrep-precise-full.yml ✅
  • pnpm test test/scripts/ghsa-detector-review-batch.test.ts ✅
  • opengrep validate security/opengrep/precise.yml ✅
  • scripts/run-opengrep.sh --changed --error ✅
  • pnpm lint --threads=8 ✅

Blacksmith/GitHub validation on the current PR head:

Notes

  • The broad rulepack/workflow from an earlier version of this branch was removed. Only the precise rulepack is tracked.
  • The full repository scan is manual by design; PRs run only against the changed first-party paths.
  • The detector-review run artifacts under .artifacts/ are local/generated and are not committed.

@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts size: XL maintainer Maintainer-authored PR labels Apr 20, 2026
@jesse-merhi jesse-merhi changed the title feat(security): add GHSA detector-review pipeline and OpenGrep CI workflows [AI-assisted] feat(security): add GHSA detector-review pipeline and OpenGrep CI workflows Apr 20, 2026
@greptile-apps

greptile-apps Bot commented Apr 20, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR introduces an end-to-end pipeline that compiles GHSA advisories into OpenGrep scan rules (precise.yml / broad.yml) and wires them into two manual-dispatch GitHub Actions workflows that upload SARIF to GitHub Code Scanning. The scripts and rule compilation logic are well-structured, and the workflows are sensibly scoped to manual dispatch only.

  • P1 (security): Both CI workflows install opengrep by piping https://raw.githubusercontent.com/opengrep/opengrep/main/install.sh to bash — the script itself is unversioned (main branch). A compromised upstream or force-push would execute arbitrary code in the CI runner. Pin the script to a commit SHA or download a release asset directly.

Confidence Score: 4/5

Mostly safe to merge, but the unversioned curl | bash install pattern in both CI workflows introduces a supply-chain risk that should be addressed before these workflows are used in production.

One P1 security finding (unversioned install script piped to bash in CI) prevents a score of 5. The P2 SARIF upload failure mode is minor and doesn't affect production code. The rule compilation scripts and skill tooling are clean.

.github/workflows/opengrep-precise.yml and .github/workflows/opengrep-broad.yml — the install step should pin the script to a commit SHA or use a release asset URL.

Security Review

  • Supply-chain / RCE in CI (.github/workflows/opengrep-precise.yml line 40, .github/workflows/opengrep-broad.yml line 40): Both workflows fetch install.sh from the unversioned main branch of opengrep/opengrep and pipe it directly to bash. A compromised upstream repo or force-push to main would execute arbitrary code in the CI runner. The OPENGREP_VERSION pin only controls the binary download target inside the script, not the script itself.
Prompt To Fix All With AI
This is a comment left during a code review.
Path: .github/workflows/opengrep-precise.yml
Line: 39-42

Comment:
**Unpinned install script fetched via `curl | bash`**

The install script is fetched from `opengrep/opengrep`'s `main` branch without a commit-SHA pin. `OPENGREP_VERSION` only controls which opengrep binary the script downloads — it doesn't protect against a modified or compromised `install.sh`. If the upstream repo (or its `main` branch) is ever tampered with, arbitrary code would execute inside the CI runner with full write access to the workspace.

Consider downloading a specific release asset directly (e.g., from the GitHub Releases page for `v1.19.0`) or pinning the raw script URL to a specific commit SHA:

```
curl -fsSL https://raw.githubusercontent.com/opengrep/opengrep/<commit-sha>/install.sh \
  | bash -s -- -v "$OPENGREP_VERSION"
```

The same issue exists in `.github/workflows/opengrep-broad.yml` (line 40).

How can I resolve this? If you propose a fix, please make it concise.

---

This is a comment left during a code review.
Path: .github/workflows/opengrep-precise.yml
Line: 60-65

Comment:
**SARIF upload will hard-fail if scan crashes before writing the output file**

The `Run opengrep` step uses `continue-on-error: true`, so any crash (e.g., the binary fails to start, or exits before writing output) will still advance to the next step. However, `github/codeql-action/upload-sarif` doesn't accept an `if-no-files-found` option and will fail with a hard error if `.opengrep-out/precise.sarif` was never created. This makes the workflow fail on exactly the error path that `continue-on-error` was intended to handle gracefully.

Adding an explicit existence check before the upload would prevent this failure mode. The same issue exists in the broad workflow.

```suggestion
      - name: Upload SARIF to GitHub Code Scanning
        uses: github/codeql-action/upload-sarif@v3
        if: always() && hashFiles('.opengrep-out/precise.sarif') != ''
        with:
          sarif_file: .opengrep-out/precise.sarif
          category: opengrep-precise
```

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "feat(security): add GHSA detector-review..." | Re-trigger Greptile

Comment thread .github/workflows/opengrep-precise.yml Outdated
Comment on lines +39 to +42
run: |
curl -fsSL https://raw.githubusercontent.com/opengrep/opengrep/main/install.sh \
| bash -s -- -v "$OPENGREP_VERSION"
echo "$HOME/.local/bin" >> "$GITHUB_PATH"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 security Unpinned install script fetched via curl | bash

The install script is fetched from opengrep/opengrep's main branch without a commit-SHA pin. OPENGREP_VERSION only controls which opengrep binary the script downloads — it doesn't protect against a modified or compromised install.sh. If the upstream repo (or its main branch) is ever tampered with, arbitrary code would execute inside the CI runner with full write access to the workspace.

Consider downloading a specific release asset directly (e.g., from the GitHub Releases page for v1.19.0) or pinning the raw script URL to a specific commit SHA:

curl -fsSL https://raw.githubusercontent.com/opengrep/opengrep/<commit-sha>/install.sh \
  | bash -s -- -v "$OPENGREP_VERSION"

The same issue exists in .github/workflows/opengrep-broad.yml (line 40).

Prompt To Fix With AI
This is a comment left during a code review.
Path: .github/workflows/opengrep-precise.yml
Line: 39-42

Comment:
**Unpinned install script fetched via `curl | bash`**

The install script is fetched from `opengrep/opengrep`'s `main` branch without a commit-SHA pin. `OPENGREP_VERSION` only controls which opengrep binary the script downloads — it doesn't protect against a modified or compromised `install.sh`. If the upstream repo (or its `main` branch) is ever tampered with, arbitrary code would execute inside the CI runner with full write access to the workspace.

Consider downloading a specific release asset directly (e.g., from the GitHub Releases page for `v1.19.0`) or pinning the raw script URL to a specific commit SHA:

```
curl -fsSL https://raw.githubusercontent.com/opengrep/opengrep/<commit-sha>/install.sh \
  | bash -s -- -v "$OPENGREP_VERSION"
```

The same issue exists in `.github/workflows/opengrep-broad.yml` (line 40).

How can I resolve this? If you propose a fix, please make it concise.

Comment thread .github/workflows/opengrep-precise.yml Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cb659d72dc

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/opengrep-precise.yml Resolved
Comment thread scripts/compile-opengrep-rules.mjs Resolved
@jesse-merhi
jesse-merhi force-pushed the security/opengrep-ghsa-detector-pipeline branch 2 times, most recently from 4b119e7 to 6a2499c Compare April 20, 2026 23:19

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 6a2499ccde

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/opengrep-broad.yml Resolved
Comment thread .github/workflows/opengrep-precise.yml Resolved
@jesse-merhi
jesse-merhi force-pushed the security/opengrep-ghsa-detector-pipeline branch from 6a2499c to 05b62b5 Compare April 20, 2026 23:28

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 05b62b5a88

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +575 to +577
const shaPart = "([a-f0-9]{7,40}(?:[\\^~][\\^~0-9]*)?)";
const fixRegex = new RegExp(`Fix commit:[^\\n]*?\\b${shaPart}\\b`, "i");
const vulnRegex = new RegExp(`Vulnerable commit[^\\n]*?\\b${shaPart}\\b`, "i");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve full git revision in coverage commit parsing

Drop the \b...\b wrappers around shaPart here, because they truncate revision selectors like ^ and ~1 when parsing report text (e.g., abcdef1^ is captured as abcdef1). validateCoverage() then runs git show against the wrong tree state (often the fixed commit instead of the vulnerable parent), which can misclassify detector quality under --validate-coverage by failing or passing rules against the wrong code snapshot.

Useful? React with 👍 / 👎.

@jesse-merhi
jesse-merhi force-pushed the security/opengrep-ghsa-detector-pipeline branch from 05b62b5 to c9bbc8e Compare April 21, 2026 00:02

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c9bbc8ee4c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +701 to +703
const renamed = extractedAs.get(file) || file;
const target = path.join(tmpDir, renamed);
await fs.mkdir(path.dirname(target), { recursive: true });

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Constrain extracted-as paths to temp workspace

Coverage validation trusts the report’s Extracted-as mapping and directly uses it to build target under tmpDir; a renamed path like ../../... or an absolute path escapes the temp workspace and is later written via fs.writeFile, enabling arbitrary file overwrite during a run. Because report content comes from an external harness/LLM output, this is untrusted input and should be normalized and rejected unless it stays within tmpDir.

Useful? React with 👍 / 👎.

Comment on lines +719 to +721
try {
const parsed = JSON.parse(semResult.stdout || "{}");
findings = (parsed.results || []).length;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Fail coverage when opengrep exits non-zero

Coverage validation currently parses semResult.stdout || "{}" and returns ok: true without checking semResult.code, so missing/crashed opengrep runs are treated as successful validation with zero findings. Under --validate-coverage, this can incorrectly let a case finish as succeeded (for example when A=no or additive-fix), even though coverage was never actually executed.

Useful? React with 👍 / 👎.

@jesse-merhi
jesse-merhi force-pushed the security/opengrep-ghsa-detector-pipeline branch from c9bbc8e to a6019d4 Compare April 21, 2026 00:28

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a6019d4a18

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

"--no-git-ignore",
emptyDir,
],
{ timeoutMs: 120_000 },

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Use a real timeout for opengrep schema validation

findInvalidRuleSpans passes { timeoutMs: 120_000 } into spawn, but child_process.spawn only honors timeout (not timeoutMs), so this validation step has no effective timeout. If opengrep scan hangs (tool bug, stuck process, or I/O stall), compile can block indefinitely and never produce outputs. Wire this to a real timeout (timeout or an explicit kill timer) so schema-prune cannot deadlock the pipeline.

Useful? React with 👍 / 👎.

// repo at security/detector-review/. We resolve them relative to the script
// location so the runner works the same regardless of which coding harness
// (rovodev/claude/codex/opencode/...) is invoking it.
const scriptDir = path.dirname(new URL(import.meta.url).pathname);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Convert import.meta.url with fileURLToPath

Using new URL(import.meta.url).pathname here can yield URL-encoded or platform-mangled paths (for example %20 for spaces, or non-native Windows forms), so detectorReviewDir may resolve to a non-existent location and the runner fails to find detector-review-spec.md / init_case.py. This breaks execution on common local setups where repo paths contain spaces or non-ASCII characters; use fileURLToPath(import.meta.url) before path.dirname.

Useful? React with 👍 / 👎.

@jesse-merhi
jesse-merhi force-pushed the security/opengrep-ghsa-detector-pipeline branch from a6019d4 to 5d5757f Compare April 21, 2026 01:59

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5d5757f21c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +1105 to +1107
if (params.failFast) {
aborted = true;
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Honor fail-fast on failed case statuses

--fail-fast is documented to stop queueing after the first failure, but the flag is only applied in the exception path here. runSingleCase() reports normal failures via summary.status (failed, missing-report, no-coverage) without throwing, so those failures do not set aborted and the batch continues processing remaining advisories. In long runs this defeats the purpose of fail-fast and can waste hours of compute after the first failed case.

Useful? React with 👍 / 👎.

Comment on lines +53 to +54
const direct = process.argv[1];
return Boolean(direct && import.meta.url.endsWith(direct));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Compare direct-run path using decoded file path

isDirectRun() compares import.meta.url directly against process.argv[1], but import.meta.url is URL-encoded while argv[1] is a filesystem path. On paths containing spaces or non-ASCII characters, this comparison returns false and main() is never called, so invoking the script directly can become a silent no-op. Convert import.meta.url with fileURLToPath() before comparing.

Useful? React with 👍 / 👎.

@clawsweeper

clawsweeper Bot commented Apr 29, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes:

This PR adds GHSA detector-review scripts, an OpenGrep precise rulepack and metadata check, .semgrepignore, docs/changelog/labeler updates, tests, and PR/manual OpenGrep Code Scanning workflows.

Maintainer follow-up before merge:

Protected maintainer-labeled, MEMBER-authored, security-sensitive PR; the next action is secops/maintainer review and normal PR validation, not an automated repair lane.

Best possible solution:

If OpenGrep canaries belong in core CI, land them through explicit secops ownership: add CODEOWNERS coverage for the new security tree and workflows, fail closed on missing or ambiguous detector decisions, keep installer/action provenance auditable, and merge only after the rulepack and regeneration path have maintainer-approved validation evidence.

What I checked:

  • protected-pr-metadata: GitHub API shows this PR is open, unmerged, authored by a MEMBER, labeled maintainer, and currently dirty against its base; repository policy keeps these open for maintainer handling. (dad83d39dcee)
  • not-implemented-on-main: Current main has no opengrep, ghsa-detector, detector-review, security/opengrep, or run-opengrep matches in the relevant workflow, script, docs, package, or labeler surfaces. (204ef7f1c45b)
  • current-security-ci-scope: Current docs describe CodeQL as a narrow first-pass security scanner, not a GHSA-derived OpenGrep rulepack or PR-diff canary workflow. Public docs: docs/ci.md. (docs/ci.md:258, 204ef7f1c45b)
  • secops-ownership-baseline: Current CODEOWNERS says security-sensitive code, config, and docs require secops review and routes existing security/CodeQL/auth/secrets surfaces, but the PR file list does not include .github/CODEOWNERS for the new security/** tree or OpenGrep workflows. (.github/CODEOWNERS:7, 204ef7f1c45b)
  • security-sensitive-workflow-diff: The PR adds a pull_request workflow with security-events: write, full-history checkout for base...HEAD diffing, a pinned OpenGrep installer SHA, SARIF upload to Code Scanning, and artifact upload. (.github/workflows/opengrep-precise.yml:17, dad83d39dcee)
  • coverage-decision-risk: PR head fails closed for missing coverage results, but parseADecision() still returns an empty string when markdown parsing misses the A row, and summarizeCaseStatus() only returns no-coverage for zero findings when aDecision === "yes". This matches the Aisle workflow-integrity concern in the discussion. (scripts/run-ghsa-detector-review-batch.mjs:548, dad83d39dcee)

Likely related people:

  • @steipete: CODEOWNERS assigns ownership-rule protection to @steipete, and current blame/history attributes the secops CODEOWNERS block plus CodeQL/security CI documentation baseline to Peter Steinberger near this workflow/security surface. (role: security and CI ownership-route maintainer; confidence: high; commits: cf43b92fc901, abaa4326d81b, 9881a808f2fc; files: .github/CODEOWNERS, SECURITY.md, .github/workflows/codeql.yml)
  • @theonejvo: SECURITY.md names Jamieson O'Reilly as Security & Trust at OpenClaw, and this PR adds GHSA-derived detector tooling plus Code Scanning workflows that need secops judgment. (role: security review routing candidate; confidence: medium; commits: cf43b92fc901; files: SECURITY.md, .github/CODEOWNERS, .github/workflows/opengrep-precise.yml)
  • Mason Huang: Recent current-main history added CodeQL Critical Quality profile/package-contract work and updated the same CI security-analysis documentation area adjacent to the proposed OpenGrep scanning lane. (role: recent adjacent CodeQL workflow maintainer; confidence: medium; commits: 71084140090f, dda765c44584; files: .github/workflows/codeql-critical-quality.yml, docs/ci.md)
  • @vincentkoc: Current-main history shows recent CI workflow maintenance by Vincent Koc, and the PR timeline mentions Vincent for review context around this CI-facing change. (role: recent adjacent CI maintainer; confidence: medium; commits: ad2516b1c876; files: .github/workflows/ci.yml)

Remaining risk / open question:

  • The new PR-triggered workflow writes Code Scanning results with security-events: write and runs downloaded OpenGrep installer code, so secops should explicitly approve the CI trust boundary and pinning model before merge.
  • The PR does not add CODEOWNERS entries for security/**, .semgrepignore, or .github/workflows/opengrep-*.yml, so future security-tooling edits may not require secops review unless ownership routing is added.
  • The detector batch runner still appears to treat missing or unparseable A detector decisions as successful when coverage finds zero matches, leaving the Aisle workflow-integrity concern unresolved in the inspected head.
  • A generated 147-rule rulepack would become blocking PR-diff CI, so maintainers should review provenance, false-positive policy, and regeneration mechanics before accepting it.

Codex review notes: model gpt-5.5, reasoning high; reviewed against 204ef7f1c45b.

@jesse-merhi jesse-merhi self-assigned this Apr 29, 2026
@jesse-merhi
jesse-merhi force-pushed the security/opengrep-ghsa-detector-pipeline branch 4 times, most recently from dca4527 to 519e6d9 Compare April 29, 2026 13:55
@github-advanced-security

Copy link
Copy Markdown

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

@jesse-merhi
jesse-merhi force-pushed the security/opengrep-ghsa-detector-pipeline branch from 519e6d9 to 19afa2e Compare April 29, 2026 14:02
@clawsweeper

clawsweeper Bot commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes:

The PR branch adds OpenGrep PR/full Code Scanning workflows, a local OpenGrep wrapper, .semgrepignore, a generated GHSA-derived precise rulepack, rule compile/metadata scripts with tests, docs/changelog updates, labeler coverage, and a pnpm check metadata gate.

Maintainer follow-up before merge:

Protected maintainer-labeled, MEMBER-authored, security-sensitive PR; the next action is secops/maintainer review and normal PR validation, not an automated repair lane.

Review details

Best possible solution:

If OpenGrep canaries belong in core CI, land them through explicit secops ownership: add CODEOWNERS coverage for the new security tree and workflows, harden the PR workflow against scanner/rulepack tampering and path-option injection, keep installer/action provenance auditable, and merge only after the generated rulepack plus regeneration path have maintainer-approved validation.

Acceptance criteria:

  • actionlint .github/workflows/opengrep-precise.yml .github/workflows/opengrep-precise-full.yml
  • pnpm test test/scripts/check-opengrep-rule-metadata.test.ts
  • pnpm check:opengrep-rule-metadata
  • opengrep validate security/opengrep/precise.yml
  • scripts/run-opengrep.sh --changed --error

What I checked:

  • protected-pr-metadata: GitHub REST shows the PR is open, unmerged, dirty/mergeable=false, authored by a MEMBER, labeled maintainer, and currently at head 9a41339ec345f353e02f54a8e49fe4bc61f54699. (9a41339ec345)
  • not-implemented-on-main: Current main has no security/opengrep, OpenGrep workflows, .semgrepignore, or scripts/run-opengrep.sh, and there are no opengrep/ghsa-detector matches in the checked source surfaces. (a2cf05c4fb8c)
  • current-security-ci-scope: Current docs describe CodeQL as the existing narrow first-pass security scanner over selected high-risk surfaces, not a GHSA-derived OpenGrep regression rulepack. Public docs: docs/ci.md. (docs/ci.md:258, a2cf05c4fb8c)
  • secops-ownership-baseline: Current CODEOWNERS states security-sensitive code, config, and docs require secops review and routes existing security/CodeQL surfaces, while the PR file list does not add CODEOWNERS entries for security/**, .semgrepignore, or the new OpenGrep workflows. (.github/CODEOWNERS:4, a2cf05c4fb8c)
  • security-sensitive-workflow-diff: The PR adds a pull_request workflow with security-events: write, full-history checkout, a downloaded OpenGrep installer, and execution of scripts/run-opengrep.sh --changed --sarif --error from the PR checkout. (.github/workflows/opengrep-precise.yml:16, 9a41339ec345)
  • pr-controlled-scanner-assets: The PR workflow checks out the PR tree and then runs the scanner wrapper from that same checkout, so the scanner script and rulepack trust boundary needs explicit secops approval before merge. (.github/workflows/opengrep-precise.yml:56, 9a41339ec345)

Likely related people:

  • @vincentkoc: GitHub commit history shows recent work splitting and scheduling CodeQL security shards and introducing secops CODEOWNERS coverage for sensitive paths, directly adjacent to this PR's proposed security workflow surface. (role: recent security CI and CODEOWNERS maintainer; confidence: high; commits: 3ae69498e2f1, 77192572f621, b6a21cde34dd; files: .github/workflows/codeql.yml, .github/workflows/codeql-android-critical-security.yml, .github/workflows/codeql-macos-critical-security.yml)
  • @steipete: Current blame attributes the secops CODEOWNERS block, security CI docs, CodeQL workflow baseline, and fast CI security jobs in this checkout to Peter Steinberger; CODEOWNERS also routes ownership-rule changes to @steipete. (role: security ownership-route and CI maintainer; confidence: high; commits: abaa4326d81b, 9881a808f2fc, 72cf700fbf74; files: .github/CODEOWNERS, .github/workflows/codeql.yml, .github/workflows/ci.yml)
  • @theonejvo: SECURITY.md names Jamieson O'Reilly as Security & Trust at OpenClaw, and this PR adds GHSA-derived detector tooling plus Code Scanning workflows that require secops judgment. (role: security review routing candidate; confidence: medium; commits: abaa4326d81b; files: SECURITY.md, .github/CODEOWNERS, .github/workflows/opengrep-precise.yml)
  • @hxy91819: Recent current-main history added CodeQL quality profile and plugin SDK package-contract shards and touched the same CI/security-analysis documentation area adjacent to the proposed OpenGrep lane. (role: recent adjacent CodeQL workflow maintainer; confidence: medium; commits: 71084140090f, dda765c44584; files: .github/workflows/codeql-critical-quality.yml, docs/ci.md)
  • @jesse-merhi: Beyond authoring this PR, Jesse has recent merged SECURITY.md history and co-authored nearby security documentation changes, so they are a relevant maintainer-side follow-up owner for the branch content even though the OpenGrep feature is not on main. (role: proposed-branch owner with recent security docs history; confidence: medium; commits: 542821cd1e60, abaa4326d81b; files: SECURITY.md, security/README.md, security/opengrep/README.md)

Remaining risk / open question:

  • The new PR-triggered workflow writes Code Scanning data with security-events: write and executes scanner assets from the checked-out PR tree, so secops should explicitly approve the CI trust boundary before merge.
  • scripts/run-opengrep.sh still appears to pass changed filenames to opengrep scan without an option terminator, leaving the filename-as-option concern unresolved in the current head.
  • The PR does not add CODEOWNERS coverage for security/**, .semgrepignore, or .github/workflows/opengrep-*.yml, so future security-tooling edits may miss the secops review route currently used for CodeQL/security paths.
  • The rulepack is a large generated security surface; rule quality, advisory provenance, and regeneration procedure need maintainer-approved validation evidence before this becomes a blocking CI gate.

Codex review notes: model gpt-5.5, reasoning high; reviewed against a2cf05c4fb8c.

@aisle-research-bot

aisle-research-bot Bot commented Apr 29, 2026 •

Copy link
Copy Markdown

🔒 Aisle Security Analysis

We found 2 potential security issue(s) in this PR:

# Severity Title
1 🟡 Medium GitHub Actions executes remote install script via curl
2 🟡 Medium PR diff OpenGrep scan can be bypassed via non–NUL-safe parsing of changed file paths
1. 🟡 GitHub Actions executes remote install script via curl|bash without integrity verification (OpenGrep install)
Property Value
Severity Medium
CWE CWE-494
Location .github/workflows/opengrep-precise.yml:42-45

Description

The OpenGrep workflows download and execute a remote shell script directly via curl | bash.

While the script URL is pinned to a specific commit SHA, the executed script then typically downloads and runs additional content (e.g., release binaries) based only on a version/tag string and without an explicit checksum/signature verification step in this repository. This creates a CI supply-chain/RCE risk:

  • Input/source: Remote content from raw.githubusercontent.com and whatever subsequent URLs install.sh fetches
  • Execution sink: bash executes the downloaded script in the CI runner
  • If the upstream repo/account is compromised or a tagged release asset is replaced, the runner can be made to execute attacker-controlled code.

Vulnerable code:

curl -fsSL "https://raw.githubusercontent.com/opengrep/opengrep/${OPENGREP_INSTALL_SHA}/install.sh" \
  | bash -s -- -v "$OPENGREP_VERSION"

Recommendation

Avoid executing remote scripts directly, or add strong integrity verification for everything that will be executed.

Safer options:

  1. Vendor/pin the installer script into this repository and review changes via PRs.

  2. Prefer downloading a specific release artifact and verifying a pinned SHA-256 (or signature) before execution:

set -euo pipefail
VERSION="v1.19.0"
URL="https://github.com/opengrep/opengrep/releases/download/${VERSION}/opengrep_linux_x86_64"
EXPECTED_SHA256="<pin_expected_sha256_here>"

curl -fsSL -o opengrep "$URL"
echo "${EXPECTED_SHA256}  opengrep" | sha256sum -c -
chmod +x opengrep
sudo mv opengrep /usr/local/bin/opengrep
  1. If OpenGrep provides an official GitHub Action with version pinning and checksums/signatures, prefer that over curl|bash.

Apply the same fix to both workflows (opengrep-precise.yml and opengrep-precise-full.yml).

2. 🟡 PR diff OpenGrep scan can be bypassed via non–NUL-safe parsing of changed file paths
Property Value
Severity Medium
CWE CWE-20
Location scripts/run-opengrep.sh:115-121

Description

The PR-diff OpenGrep workflow relies on scripts/run-opengrep.sh --changed to derive SCAN_PATHS from git diff --name-only output.

  • git diff --name-only emits newline-delimited paths.
  • The script pipes this through text tools (awk, sort) and then uses mapfile -t (newline-delimited) to build an array.
  • Git permits filenames containing newlines and other unusual characters (except NUL). If such a filename is introduced/modified under a first-party prefix (e.g., src/), the newline will be interpreted as a record separator.
  • This can cause the actual changed path to be split/mangled and filtered out by the awk prefix filter, resulting in the changed file not being scanned in CI (.github/workflows/opengrep-precise.yml).

Vulnerable code:

mapfile -t SCAN_PATHS < <(
  {
    git diff --name-only ...
    git ls-files --others --exclude-standard
  } | awk '/^(src|extensions|apps|packages|scripts)\// { print }' | sort -u
)

Recommendation

Make path collection NUL-delimited end-to-end and avoid line-oriented tooling for file lists.

Suggested approach:

  • Use git ... -z to emit NUL-separated paths.
  • Filter paths in bash (or another NUL-safe tool) instead of awk/sort.
  • Read into arrays with mapfile -d ''.

Example (bash-only filtering):

collect_paths() {
  {
    git diff -z --name-only --diff-filter=ACMRTUXB "${OPENCLAW_OPENGREP_BASE_REF:-origin/main...HEAD}" 2>/dev/null || true
    git diff -z --name-only --diff-filter=ACMRTUXB -- 2>/dev/null || true
    git ls-files -z --others --exclude-standard
  }
}

mapfile -d '' -t ALL_PATHS < <(collect_paths)
SCAN_PATHS=()
for p in "${ALL_PATHS[@]}"; do
  case "$p" in
    src/*|extensions/*|apps/*|packages/*|scripts/*) SCAN_PATHS+=("$p");;
  esac
done

If you need uniqueness, dedupe in a NUL-safe way (e.g., associative array keyed by the exact string in bash).


Analyzed PR: #69483 at commit da98bd9

Last updated on: 2026-04-29T16:31:10Z

@clawsweeper

clawsweeper Bot commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes:

The PR branch adds OpenGrep PR/full Code Scanning workflows, a local OpenGrep wrapper, .semgrepignore, GHSA-derived rulepack tooling and metadata checks, docs/changelog/labeler updates, and tests.

Maintainer follow-up before merge:

Protected maintainer-labeled, MEMBER-authored, security-sensitive PR; the next action is explicit maintainer/secops review and normal PR validation, not an automated repair lane.

Review details

Best possible solution:

If OpenGrep canaries belong in core CI, land them through explicit secops ownership: add CODEOWNERS coverage for the new security surfaces, keep installer and action provenance auditable, harden or approve the PR-checkout trust model, and merge only after the rulepack plus regeneration flow have maintainer-reviewed validation evidence.

What I checked:

  • protected-pr-metadata: Provided GitHub context shows the PR is open and unmerged, authored by a MEMBER, labeled maintainer, and currently mergeable=false; repository policy says maintainer-authored or maintainer-labeled items stay open for explicit maintainer handling. (3d8c234f2f9a)
  • not-implemented-on-main: Current main has no opengrep, OpenGrep, ghsa-detector, detector-review, run-opengrep, or semgrep matches in the checked workflow, script, docs, package, gitignore, or labeler surfaces; there is also no security/ directory. (e49703def652)
  • current-security-ci-scope: Current docs describe CodeQL as a narrow first-pass security scanner over selected high-risk surfaces, not a GHSA-derived OpenGrep regression rulepack or PR-diff canary workflow. Public docs: docs/ci.md. (docs/ci.md:258, e49703def652)
  • secops-ownership-baseline: Current CODEOWNERS requires secops review for existing security-sensitive code, config, docs, and CodeQL workflows; the provided PR file list does not include .github/CODEOWNERS entries for the new security/**, .semgrepignore, or OpenGrep workflows. (.github/CODEOWNERS:4, e49703def652)
  • security-labeler-gap-on-main: Current labeler only maps the security label to existing security docs, while the PR proposes adding OpenGrep workflows, .semgrepignore, and security/** to that surface. (.github/labeler.yml:238, e49703def652)
  • security-sensitive-pr-diff: The provided PR diff adds a pull_request OpenGrep workflow with security-events: write, full-history checkout for diffing, a downloaded OpenGrep installer pinned by SHA, SARIF upload, and execution of the scanner wrapper from the checked-out tree. (.github/workflows/opengrep-precise.yml:16, 3d8c234f2f9a)

Likely related people:

  • @steipete: CODEOWNERS routes ownership-rule changes to @steipete, and current blame attributes the secops ownership block plus the CodeQL workflow/docs baseline adjacent to this PR's security CI surface to Peter Steinberger. (role: security ownership-route and CI maintainer; confidence: high; commits: f0adbd48e8bc; files: .github/CODEOWNERS, .github/workflows/codeql.yml, docs/ci.md)
  • @theonejvo: SECURITY.md names Jamieson O'Reilly as Security & Trust at OpenClaw, and this PR adds GHSA-derived detector tooling plus Code Scanning workflows that require secops judgment. (role: security review routing candidate; confidence: medium; commits: f0adbd48e8bc; files: SECURITY.md, .github/workflows/opengrep-precise.yml, security/opengrep/precise.yml)
  • @hxy91819: Current-main history shows Mason Huang recently added CodeQL quality profile/package-contract work and updated adjacent CI security-analysis documentation near the proposed OpenGrep scanning lane. (role: recent adjacent CodeQL workflow maintainer; confidence: medium; commits: 71084140090f, dda765c44584; files: .github/workflows/codeql-critical-quality.yml, docs/ci.md)

Remaining risk / open question:

  • The new PR-triggered workflow would run scanner assets from the checked-out tree and upload Code Scanning results with security-events: write; secops should explicitly approve that trust boundary before merge.
  • The PR file list does not add CODEOWNERS entries for the new security tree, .semgrepignore, or OpenGrep workflows, so future security-tooling edits may not automatically require secops review.
  • The generated rulepack and regeneration path are large enough that maintainer-approved validation, provenance, and update policy should be reviewed before core CI starts blocking on them.

Codex review notes: model gpt-5.5, reasoning high; reviewed against e49703def652.

@clawsweeper

clawsweeper Bot commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes:

The PR branch adds OpenGrep PR/full Code Scanning workflows, a local OpenGrep wrapper, .semgrepignore, a GHSA-derived precise rulepack with compile/metadata tooling and tests, docs/changelog/labeler updates, and a pnpm check metadata gate.

Maintainer follow-up before merge:

This is an open implementation PR with a protected maintainer label, MEMBER author, Code Scanning permissions, generated security rules, and CI trust-boundary decisions; it needs maintainer/secops review rather than an automated repair lane.

Review details

Best possible solution:

If OpenGrep canaries belong in core CI, land them through explicit secops ownership: cover the new security surfaces in CODEOWNERS, approve the PR-checkout and scanner-install trust model, keep rule provenance auditable, and merge only after the rulepack plus regeneration flow have maintainer-reviewed validation evidence.

Acceptance criteria:

  • actionlint .github/workflows/opengrep-precise.yml .github/workflows/opengrep-precise-full.yml
  • pnpm test test/scripts/check-opengrep-rule-metadata.test.ts
  • pnpm check:opengrep-rule-metadata
  • opengrep validate security/opengrep/precise.yml
  • scripts/run-opengrep.sh --changed --error

What I checked:

  • protected-pr-metadata: Provided GitHub context shows this PR is open and unmerged, authored by a MEMBER, labeled maintainer, and currently at head 810b403940dcd3de3b4751760531221c54268b1b; repository cleanup policy keeps protected maintainer/member items open for explicit handling. (810b403940dc)
  • not-implemented-on-main: Current main has no opengrep, OpenGrep, ghsa-detector, detector-review, run-opengrep, or semgrep matches in the checked workflow, script, docs, package, gitignore, and labeler surfaces, and there is no top-level security/ tree. (616f24fd49cd)
  • current-security-ci-scope: Current docs describe CodeQL as the existing narrow first-pass security scanner over selected high-risk surfaces, not a GHSA-derived OpenGrep regression rulepack or PR-diff canary workflow. Public docs: docs/ci.md. (docs/ci.md:258, 616f24fd49cd)
  • secops-ownership-baseline: Current CODEOWNERS requires secops review for existing security-sensitive code, config, docs, and CodeQL workflows, but current main has no ownership entries for security/**, .semgrepignore, or .github/workflows/opengrep-*.yml. (.github/CODEOWNERS:7, 616f24fd49cd)
  • security-labeler-gap-on-main: Current labeler maps the security label only to existing security docs; the PR adds OpenGrep workflows, .semgrepignore, and security/** to that surface. (.github/labeler.yml:238, 616f24fd49cd)
  • security-sensitive-pr-diff: The PR head adds a pull_request workflow with security-events: write, full-history checkout for diffing, a pinned OpenGrep installer script SHA, SARIF upload to Code Scanning, and execution of scripts/run-opengrep.sh --changed --sarif --error. (.github/workflows/opengrep-precise.yml:17, 810b403940dc)

Likely related people:

  • @steipete: CODEOWNERS routes ownership-rule changes to @steipete, and current blame/history attributes the secops ownership block plus the adjacent CodeQL workflow/docs/security baseline to Peter Steinberger. (role: security ownership-route and CI maintainer; confidence: high; commits: 03e17d19e9dd; files: .github/CODEOWNERS, .github/workflows/codeql.yml, docs/ci.md)
  • @theonejvo: SECURITY.md names Jamieson O'Reilly as Security & Trust at OpenClaw, and this PR adds GHSA-derived detector tooling plus Code Scanning workflows that need secops judgment. (role: security review routing candidate; confidence: medium; commits: 03e17d19e9dd; files: SECURITY.md, .github/CODEOWNERS, .github/workflows/opengrep-precise.yml)
  • @hxy91819: Current-main history shows Mason Huang recently changed the CodeQL critical-quality workflow and adjacent CI documentation near the proposed OpenGrep security-analysis lane. (role: recent adjacent CodeQL workflow maintainer; confidence: medium; commits: 71084140090f; files: .github/workflows/codeql-critical-quality.yml, docs/ci.md)

Remaining risk / open question:

  • The new PR-triggered workflow would upload Code Scanning results with security-events: write after running downloaded OpenGrep installer code and scanner assets from the checked-out tree; secops should explicitly approve that CI trust boundary.
  • The PR does not add CODEOWNERS entries for the new security/** tree, .semgrepignore, or OpenGrep workflows, so future security-tooling edits may not automatically request secops review unless ownership routing is added.
  • Aisle raised a path/argument-hardening concern, and current PR head still builds changed scan paths line-by-line and passes them directly to opengrep; maintainers should decide whether -- termination and NUL-safe path handling are required before making this a security gate.
  • The generated rulepack is large and security-sensitive; merge should depend on maintainer-approved provenance, validation, and update policy rather than this read-only cleanup review.

Codex review notes: model gpt-5.5, reasoning high; reviewed against 616f24fd49cd.

@jesse-merhi
jesse-merhi force-pushed the security/opengrep-ghsa-detector-pipeline branch from d0b21be to da98bd9 Compare April 29, 2026 16:22
@clawsweeper

clawsweeper Bot commented Apr 29, 2026

Copy link
Copy Markdown
Contributor

Codex review: found issues before merge.

What this changes:

The branch adds OpenGrep PR/full Code Scanning workflows, a local scan wrapper, .semgrepignore, GHSA-derived rulepack tooling and metadata checks, docs/changelog/labeler updates, and tests.

Maintainer follow-up before merge:

Protected maintainer-labeled, MEMBER-authored, security-sensitive PR with Code Scanning permissions and generated security rules; the next action is maintainer/secops review and normal PR validation, not an automated repair lane.

Review findings:

  • [P2] Add secops ownership for OpenGrep security surfaces — .github/labeler.yml:241-245
  • [P2] Require verified OpenGrep installation — .github/workflows/opengrep-precise.yml:43-44
Review details

Best possible solution:

If OpenGrep canaries belong in core CI, land them through explicit secops ownership: add CODEOWNERS coverage for the new security surfaces, require auditable scanner installation with signature or checksum verification, approve the PR-checkout trust model, and merge only after the rulepack plus regeneration path have maintainer-reviewed validation evidence.

Full review comments:

  • [P2] Add secops ownership for OpenGrep security surfaces — .github/labeler.yml:241-245
    The PR labels .github/workflows/opengrep-*.yml, .semgrepignore, and security/** as security-relevant, but it does not add matching CODEOWNERS entries. After merge, follow-up edits to the rulepack or Code Scanning workflows would not automatically request secops review despite the repo's security-ownership policy. Please add CODEOWNERS coverage for these new surfaces.
    Confidence: 0.88
  • [P2] Require verified OpenGrep installation — .github/workflows/opengrep-precise.yml:43-44
    The workflow downloads and executes OpenGrep's installer, and the pinned installer then downloads the release binary without requiring signature verification; when cosign is absent it warns and continues. For a security CI job with security-events: write, install cosign and pass --verify-signatures, or download a pinned artifact and verify its checksum before execution. The same pattern is present in the full-scan workflow.
    Confidence: 0.8

Overall correctness: patch is incorrect
Overall confidence: 0.82

What I checked:

  • protected-pr-metadata: GitHub PR API shows the PR is open, unmerged, authored by a MEMBER, labeled maintainer, and currently at head da98bd9f7eb03f272de7025c9be49d346a15dd90 with 16 changed files and 6488 additions. (da98bd9f7eb0)
  • not-implemented-on-main: Current main has no OpenGrep workflows, .semgrepignore, security/opengrep tree, or scripts/run-opengrep.sh; the only ghsa path match is unrelated scripts/ghsa-patch.mjs. (2dadc82cf453)
  • current-security-ci-scope: Current docs describe CodeQL as the existing narrow first-pass security scanner over selected high-risk surfaces, not a GHSA-derived OpenGrep rulepack or PR-diff canary workflow. Public docs: docs/ci.md. (docs/ci.md:258, 2dadc82cf453)
  • secops-ownership-baseline: Current CODEOWNERS states security-sensitive code, config, and docs require secops review and routes existing CodeQL/security surfaces, but current main has no entries for security/**, .semgrepignore, or .github/workflows/opengrep-*.yml. (.github/CODEOWNERS:7, 2dadc82cf453)
  • pr-labels-new-security-surface: The PR marks .github/workflows/opengrep-*.yml, .semgrepignore, and security/** as security-label surfaces without adding matching CODEOWNERS coverage. (.github/labeler.yml:241, da98bd9f7eb0)
  • pr-security-workflow: The PR adds a pull_request workflow with security-events: write, full-history checkout, downloaded OpenGrep installer execution, SARIF upload, and execution of scripts/run-opengrep.sh --changed --sarif --error. (.github/workflows/opengrep-precise.yml:17, da98bd9f7eb0)

Likely related people:

  • @steipete: CODEOWNERS routes ownership-rule changes to @steipete, and current blame/history attributes the secops ownership block plus adjacent CodeQL workflow, security policy, and CI docs baseline to Peter Steinberger. (role: security ownership-route and CI maintainer; confidence: high; commits: b7db63751b99; files: .github/CODEOWNERS, .github/workflows/codeql.yml, docs/ci.md)
  • @theonejvo: SECURITY.md names Jamieson O'Reilly as Security & Trust at OpenClaw, and this PR adds GHSA-derived detector tooling and Code Scanning workflows that need secops judgment. (role: security review routing candidate; confidence: medium; commits: b7db63751b99; files: SECURITY.md, .github/workflows/opengrep-precise.yml, security/opengrep/precise.yml)
  • @hxy91819: Current-main history shows Mason Huang recently changed the CodeQL critical-quality workflow and adjacent CI documentation near this proposed security-analysis lane. (role: recent adjacent CodeQL workflow maintainer; confidence: medium; commits: 71084140090f; files: .github/workflows/codeql-critical-quality.yml, docs/ci.md)

Remaining risk / open question:

  • The generated security/opengrep/precise.yml rulepack is large enough that rule quality, false-positive tolerance, and provenance need maintainer/secops validation beyond this read-only sweep.
  • The PR body lists green validation runs, but I did not rerun branch checks locally because this review was constrained to read-only inspection.

Codex review notes: model gpt-5.5, reasoning high; reviewed against 2dadc82cf453.

@jesse-merhi
jesse-merhi merged commit 6de9d71 into main Apr 29, 2026
70 of 71 checks passed
@jesse-merhi
jesse-merhi deleted the security/opengrep-ghsa-detector-pipeline branch April 29, 2026 16:42
lxe pushed a commit to lxe/openclaw that referenced this pull request May 6, 2026
…kflows (openclaw#69483)

* feat(security): add GHSA detector-review pipeline and OpenGrep CI workflows [AI-assisted]

Stand up an end-to-end pipeline that turns every published openclaw GitHub
Security Advisory into a reusable OpenGrep rule, and wire the compiled rules
into manual-dispatch GitHub Actions workflows that publish SARIF to GitHub
Code Scanning.

The pipeline is harness-agnostic: any coding-agent CLI (Rovo Dev, Claude
Code, Codex, OpenCode, or anything you can shell out to) can drive it via
the runner script's --harness flag. Built-in adapters cover the four common
harnesses; --harness-cmd '<template>' supports anything else with shell-style
{prompt}/{model}/{output_file} substitution.

Pipeline pieces:

- scripts/run-ghsa-detector-review-batch.mjs runs your chosen coding harness
  in parallel against every advisory using the agent-agnostic detector-review
  spec at security/detector-review/detector-review-spec.md. Each case
  produces an opengrep general-rule.yml (precise) and broad-rule.yml
  (review-aid), plus a coverage-validated report against the vulnerable
  commit's changed files.
- scripts/compile-opengrep-rules.mjs walks a run directory, rewrites each
  rule's id to ghsa-detector.<ghsa>.<orig-id>, injects ghsa/advisory-url/
  detector-bucket/source-rule-id metadata, and uses opengrep itself to drop
  rules with InvalidRuleSchemaError so the published super-configs load
  cleanly.

Compiled outputs:

- security/opengrep/precise.yml     (336 rules)
- security/opengrep/broad.yml       (459 rules)
- security/opengrep/compile-manifest.json    (per-rule provenance map)

CI workflows (manual workflow_dispatch only):

- .github/workflows/opengrep-precise.yml
- .github/workflows/opengrep-broad.yml

Both install a pinned opengrep, run opengrep scan against src/, upload SARIF
to Code Scanning under categories opengrep-precise / opengrep-broad, and use
continue-on-error: true so findings never block the workflow.

Detector-review spec and assets:

- security/detector-review/detector-review-spec.md   the agent-agnostic spec
  the runner injects into each per-case prompt
- security/detector-review/references/{detector-rubric,report-template}.md
- security/detector-review/scripts/init_case.py
- security/prompt-suffix-coverage-first.md   mandatory prompt addendum that
  enforces coverage-first validation (rule must catch the OG vuln, not just
  pass synthetic fixtures)

Docs:

- security/README.md          end-to-end flow, supported harnesses, regen recipe
- security/opengrep/README.md compiled-config details + recompile recipe

* security: tighten GHSA OpenGrep detector workflow

* chore: refine precise opengrep workflow

* chore: remove stale opengrep metadata

* fix: harden GHSA OpenGrep workflow

* ci: split OpenGrep diff and full scans

* chore: remove performance-only opengrep rule

* ci: use OpenGrep installer path

* chore: enforce opengrep rule metadata provenance

* chore: generalize opengrep rule compilation

* docs: align opengrep rulepack guidance

* chore: support generic opengrep rule sources

* fix: validate opengrep rulepack-only changes

---------

Co-authored-by: Jesse Merhi <[email protected]>
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 24, 2026
…kflows (openclaw#69483)

* feat(security): add GHSA detector-review pipeline and OpenGrep CI workflows [AI-assisted]

Stand up an end-to-end pipeline that turns every published openclaw GitHub
Security Advisory into a reusable OpenGrep rule, and wire the compiled rules
into manual-dispatch GitHub Actions workflows that publish SARIF to GitHub
Code Scanning.

The pipeline is harness-agnostic: any coding-agent CLI (Rovo Dev, Claude
Code, Codex, OpenCode, or anything you can shell out to) can drive it via
the runner script's --harness flag. Built-in adapters cover the four common
harnesses; --harness-cmd '<template>' supports anything else with shell-style
{prompt}/{model}/{output_file} substitution.

Pipeline pieces:

- scripts/run-ghsa-detector-review-batch.mjs runs your chosen coding harness
  in parallel against every advisory using the agent-agnostic detector-review
  spec at security/detector-review/detector-review-spec.md. Each case
  produces an opengrep general-rule.yml (precise) and broad-rule.yml
  (review-aid), plus a coverage-validated report against the vulnerable
  commit's changed files.
- scripts/compile-opengrep-rules.mjs walks a run directory, rewrites each
  rule's id to ghsa-detector.<ghsa>.<orig-id>, injects ghsa/advisory-url/
  detector-bucket/source-rule-id metadata, and uses opengrep itself to drop
  rules with InvalidRuleSchemaError so the published super-configs load
  cleanly.

Compiled outputs:

- security/opengrep/precise.yml     (336 rules)
- security/opengrep/broad.yml       (459 rules)
- security/opengrep/compile-manifest.json    (per-rule provenance map)

CI workflows (manual workflow_dispatch only):

- .github/workflows/opengrep-precise.yml
- .github/workflows/opengrep-broad.yml

Both install a pinned opengrep, run opengrep scan against src/, upload SARIF
to Code Scanning under categories opengrep-precise / opengrep-broad, and use
continue-on-error: true so findings never block the workflow.

Detector-review spec and assets:

- security/detector-review/detector-review-spec.md   the agent-agnostic spec
  the runner injects into each per-case prompt
- security/detector-review/references/{detector-rubric,report-template}.md
- security/detector-review/scripts/init_case.py
- security/prompt-suffix-coverage-first.md   mandatory prompt addendum that
  enforces coverage-first validation (rule must catch the OG vuln, not just
  pass synthetic fixtures)

Docs:

- security/README.md          end-to-end flow, supported harnesses, regen recipe
- security/opengrep/README.md compiled-config details + recompile recipe

* security: tighten GHSA OpenGrep detector workflow

* chore: refine precise opengrep workflow

* chore: remove stale opengrep metadata

* fix: harden GHSA OpenGrep workflow

* ci: split OpenGrep diff and full scans

* chore: remove performance-only opengrep rule

* ci: use OpenGrep installer path

* chore: enforce opengrep rule metadata provenance

* chore: generalize opengrep rule compilation

* docs: align opengrep rulepack guidance

* chore: support generic opengrep rule sources

* fix: validate opengrep rulepack-only changes

---------

Co-authored-by: Jesse Merhi <[email protected]>
jameslcowan pushed a commit to jameslcowan/openclaw that referenced this pull request Jun 2, 2026
…kflows (openclaw#69483)

* feat(security): add GHSA detector-review pipeline and OpenGrep CI workflows [AI-assisted]

Stand up an end-to-end pipeline that turns every published openclaw GitHub
Security Advisory into a reusable OpenGrep rule, and wire the compiled rules
into manual-dispatch GitHub Actions workflows that publish SARIF to GitHub
Code Scanning.

The pipeline is harness-agnostic: any coding-agent CLI (Rovo Dev, Claude
Code, Codex, OpenCode, or anything you can shell out to) can drive it via
the runner script's --harness flag. Built-in adapters cover the four common
harnesses; --harness-cmd '<template>' supports anything else with shell-style
{prompt}/{model}/{output_file} substitution.

Pipeline pieces:

- scripts/run-ghsa-detector-review-batch.mjs runs your chosen coding harness
  in parallel against every advisory using the agent-agnostic detector-review
  spec at security/detector-review/detector-review-spec.md. Each case
  produces an opengrep general-rule.yml (precise) and broad-rule.yml
  (review-aid), plus a coverage-validated report against the vulnerable
  commit's changed files.
- scripts/compile-opengrep-rules.mjs walks a run directory, rewrites each
  rule's id to ghsa-detector.<ghsa>.<orig-id>, injects ghsa/advisory-url/
  detector-bucket/source-rule-id metadata, and uses opengrep itself to drop
  rules with InvalidRuleSchemaError so the published super-configs load
  cleanly.

Compiled outputs:

- security/opengrep/precise.yml     (336 rules)
- security/opengrep/broad.yml       (459 rules)
- security/opengrep/compile-manifest.json    (per-rule provenance map)

CI workflows (manual workflow_dispatch only):

- .github/workflows/opengrep-precise.yml
- .github/workflows/opengrep-broad.yml

Both install a pinned opengrep, run opengrep scan against src/, upload SARIF
to Code Scanning under categories opengrep-precise / opengrep-broad, and use
continue-on-error: true so findings never block the workflow.

Detector-review spec and assets:

- security/detector-review/detector-review-spec.md   the agent-agnostic spec
  the runner injects into each per-case prompt
- security/detector-review/references/{detector-rubric,report-template}.md
- security/detector-review/scripts/init_case.py
- security/prompt-suffix-coverage-first.md   mandatory prompt addendum that
  enforces coverage-first validation (rule must catch the OG vuln, not just
  pass synthetic fixtures)

Docs:

- security/README.md          end-to-end flow, supported harnesses, regen recipe
- security/opengrep/README.md compiled-config details + recompile recipe

* security: tighten GHSA OpenGrep detector workflow

* chore: refine precise opengrep workflow

* chore: remove stale opengrep metadata

* fix: harden GHSA OpenGrep workflow

* ci: split OpenGrep diff and full scans

* chore: remove performance-only opengrep rule

* ci: use OpenGrep installer path

* chore: enforce opengrep rule metadata provenance

* chore: generalize opengrep rule compilation

* docs: align opengrep rulepack guidance

* chore: support generic opengrep rule sources

* fix: validate opengrep rulepack-only changes

---------

Co-authored-by: Jesse Merhi <[email protected]>
sablehead pushed a commit to sablehead/openclaw that referenced this pull request Jun 10, 2026
…kflows (openclaw#69483)

* feat(security): add GHSA detector-review pipeline and OpenGrep CI workflows [AI-assisted]

Stand up an end-to-end pipeline that turns every published openclaw GitHub
Security Advisory into a reusable OpenGrep rule, and wire the compiled rules
into manual-dispatch GitHub Actions workflows that publish SARIF to GitHub
Code Scanning.

The pipeline is harness-agnostic: any coding-agent CLI (Rovo Dev, Claude
Code, Codex, OpenCode, or anything you can shell out to) can drive it via
the runner script's --harness flag. Built-in adapters cover the four common
harnesses; --harness-cmd '<template>' supports anything else with shell-style
{prompt}/{model}/{output_file} substitution.

Pipeline pieces:

- scripts/run-ghsa-detector-review-batch.mjs runs your chosen coding harness
  in parallel against every advisory using the agent-agnostic detector-review
  spec at security/detector-review/detector-review-spec.md. Each case
  produces an opengrep general-rule.yml (precise) and broad-rule.yml
  (review-aid), plus a coverage-validated report against the vulnerable
  commit's changed files.
- scripts/compile-opengrep-rules.mjs walks a run directory, rewrites each
  rule's id to ghsa-detector.<ghsa>.<orig-id>, injects ghsa/advisory-url/
  detector-bucket/source-rule-id metadata, and uses opengrep itself to drop
  rules with InvalidRuleSchemaError so the published super-configs load
  cleanly.

Compiled outputs:

- security/opengrep/precise.yml     (336 rules)
- security/opengrep/broad.yml       (459 rules)
- security/opengrep/compile-manifest.json    (per-rule provenance map)

CI workflows (manual workflow_dispatch only):

- .github/workflows/opengrep-precise.yml
- .github/workflows/opengrep-broad.yml

Both install a pinned opengrep, run opengrep scan against src/, upload SARIF
to Code Scanning under categories opengrep-precise / opengrep-broad, and use
continue-on-error: true so findings never block the workflow.

Detector-review spec and assets:

- security/detector-review/detector-review-spec.md   the agent-agnostic spec
  the runner injects into each per-case prompt
- security/detector-review/references/{detector-rubric,report-template}.md
- security/detector-review/scripts/init_case.py
- security/prompt-suffix-coverage-first.md   mandatory prompt addendum that
  enforces coverage-first validation (rule must catch the OG vuln, not just
  pass synthetic fixtures)

Docs:

- security/README.md          end-to-end flow, supported harnesses, regen recipe
- security/opengrep/README.md compiled-config details + recompile recipe

* security: tighten GHSA OpenGrep detector workflow

* chore: refine precise opengrep workflow

* chore: remove stale opengrep metadata

* fix: harden GHSA OpenGrep workflow

* ci: split OpenGrep diff and full scans

* chore: remove performance-only opengrep rule

* ci: use OpenGrep installer path

* chore: enforce opengrep rule metadata provenance

* chore: generalize opengrep rule compilation

* docs: align opengrep rulepack guidance

* chore: support generic opengrep rule sources

* fix: validate opengrep rulepack-only changes

---------

Co-authored-by: Jesse Merhi <[email protected]>
vixco pushed a commit to vixco/openclaw that referenced this pull request Aug 16, 2026
…kflows (openclaw#69483)

* feat(security): add GHSA detector-review pipeline and OpenGrep CI workflows [AI-assisted]

Stand up an end-to-end pipeline that turns every published openclaw GitHub
Security Advisory into a reusable OpenGrep rule, and wire the compiled rules
into manual-dispatch GitHub Actions workflows that publish SARIF to GitHub
Code Scanning.

The pipeline is harness-agnostic: any coding-agent CLI (Rovo Dev, Claude
Code, Codex, OpenCode, or anything you can shell out to) can drive it via
the runner script's --harness flag. Built-in adapters cover the four common
harnesses; --harness-cmd '<template>' supports anything else with shell-style
{prompt}/{model}/{output_file} substitution.

Pipeline pieces:

- scripts/run-ghsa-detector-review-batch.mjs runs your chosen coding harness
  in parallel against every advisory using the agent-agnostic detector-review
  spec at security/detector-review/detector-review-spec.md. Each case
  produces an opengrep general-rule.yml (precise) and broad-rule.yml
  (review-aid), plus a coverage-validated report against the vulnerable
  commit's changed files.
- scripts/compile-opengrep-rules.mjs walks a run directory, rewrites each
  rule's id to ghsa-detector.<ghsa>.<orig-id>, injects ghsa/advisory-url/
  detector-bucket/source-rule-id metadata, and uses opengrep itself to drop
  rules with InvalidRuleSchemaError so the published super-configs load
  cleanly.

Compiled outputs:

- security/opengrep/precise.yml     (336 rules)
- security/opengrep/broad.yml       (459 rules)
- security/opengrep/compile-manifest.json    (per-rule provenance map)

CI workflows (manual workflow_dispatch only):

- .github/workflows/opengrep-precise.yml
- .github/workflows/opengrep-broad.yml

Both install a pinned opengrep, run opengrep scan against src/, upload SARIF
to Code Scanning under categories opengrep-precise / opengrep-broad, and use
continue-on-error: true so findings never block the workflow.

Detector-review spec and assets:

- security/detector-review/detector-review-spec.md   the agent-agnostic spec
  the runner injects into each per-case prompt
- security/detector-review/references/{detector-rubric,report-template}.md
- security/detector-review/scripts/init_case.py
- security/prompt-suffix-coverage-first.md   mandatory prompt addendum that
  enforces coverage-first validation (rule must catch the OG vuln, not just
  pass synthetic fixtures)

Docs:

- security/README.md          end-to-end flow, supported harnesses, regen recipe
- security/opengrep/README.md compiled-config details + recompile recipe

* security: tighten GHSA OpenGrep detector workflow

* chore: refine precise opengrep workflow

* chore: remove stale opengrep metadata

* fix: harden GHSA OpenGrep workflow

* ci: split OpenGrep diff and full scans

* chore: remove performance-only opengrep rule

* ci: use OpenGrep installer path

* chore: enforce opengrep rule metadata provenance

* chore: generalize opengrep rule compilation

* docs: align opengrep rulepack guidance

* chore: support generic opengrep rule sources

* fix: validate opengrep rulepack-only changes

---------

Co-authored-by: Jesse Merhi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

maintainer Maintainer-authored PR scripts Repository scripts size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants