Repository navigation
feat(security): add GHSA detector-review pipeline and OpenGrep CI workflows - #69483
Conversation
Greptile SummaryThis PR introduces an end-to-end pipeline that compiles GHSA advisories into OpenGrep scan rules (
Confidence Score: 4/5Mostly 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.
|
| run: | | ||
| curl -fsSL https://raw.githubusercontent.com/opengrep/opengrep/main/install.sh \ | ||
| | bash -s -- -v "$OPENGREP_VERSION" | ||
| echo "$HOME/.local/bin" >> "$GITHUB_PATH" |
There was a problem hiding this 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).
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.There was a problem hiding this comment.
💡 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".
4b119e7 to
6a2499c
Compare
There was a problem hiding this comment.
💡 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".
6a2499c to
05b62b5
Compare
There was a problem hiding this comment.
💡 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".
| 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"); |
There was a problem hiding this comment.
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 👍 / 👎.
05b62b5 to
c9bbc8e
Compare
There was a problem hiding this comment.
💡 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".
| const renamed = extractedAs.get(file) || file; | ||
| const target = path.join(tmpDir, renamed); | ||
| await fs.mkdir(path.dirname(target), { recursive: true }); |
There was a problem hiding this comment.
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 👍 / 👎.
| try { | ||
| const parsed = JSON.parse(semResult.stdout || "{}"); | ||
| findings = (parsed.results || []).length; |
There was a problem hiding this comment.
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 👍 / 👎.
c9bbc8e to
a6019d4
Compare
There was a problem hiding this comment.
💡 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 }, |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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 👍 / 👎.
a6019d4 to
5d5757f
Compare
There was a problem hiding this comment.
💡 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".
| if (params.failFast) { | ||
| aborted = true; | ||
| } |
There was a problem hiding this comment.
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 👍 / 👎.
| const direct = process.argv[1]; | ||
| return Boolean(direct && import.meta.url.endsWith(direct)); |
There was a problem hiding this comment.
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 👍 / 👎.
|
Codex review: needs maintainer review before merge. What this changes: This PR adds GHSA detector-review scripts, an OpenGrep precise rulepack and metadata check, 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:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 204ef7f1c45b. |
dca4527 to
519e6d9
Compare
|
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:
For more information about GitHub Code Scanning, check out the documentation. |
519e6d9 to
19afa2e
Compare
|
Codex review: needs maintainer review before merge. What this changes: The PR branch adds OpenGrep PR/full Code Scanning workflows, a local OpenGrep wrapper, 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 detailsBest 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:
What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against a2cf05c4fb8c. |
🔒 Aisle Security AnalysisWe found 2 potential security issue(s) in this PR:
1. 🟡 GitHub Actions executes remote install script via curl|bash without integrity verification (OpenGrep install)
DescriptionThe OpenGrep workflows download and execute a remote shell script directly via 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:
Vulnerable code: curl -fsSL "https://raw.githubusercontent.com/opengrep/opengrep/${OPENGREP_INSTALL_SHA}/install.sh" \
| bash -s -- -v "$OPENGREP_VERSION"RecommendationAvoid executing remote scripts directly, or add strong integrity verification for everything that will be executed. Safer options:
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
Apply the same fix to both workflows ( 2. 🟡 PR diff OpenGrep scan can be bypassed via non–NUL-safe parsing of changed file paths
DescriptionThe PR-diff OpenGrep workflow relies on
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
)RecommendationMake path collection NUL-delimited end-to-end and avoid line-oriented tooling for file lists. Suggested approach:
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
doneIf 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 Last updated on: 2026-04-29T16:31:10Z |
|
Codex review: needs maintainer review before merge. What this changes: The PR branch adds OpenGrep PR/full Code Scanning workflows, a local OpenGrep wrapper, 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 detailsBest 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:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against e49703def652. |
|
Codex review: needs maintainer review before merge. What this changes: The PR branch adds OpenGrep PR/full Code Scanning workflows, a local OpenGrep wrapper, 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 detailsBest 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:
What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 616f24fd49cd. |
d0b21be to
da98bd9
Compare
|
Codex review: found issues before merge. What this changes: The branch adds OpenGrep PR/full Code Scanning workflows, a local scan wrapper, 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:
Review detailsBest 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:
Overall correctness: patch is incorrect What I checked:
Likely related people:
Remaining risk / open question:
Codex review notes: model gpt-5.5, reasoning high; reviewed against 2dadc82cf453. |
…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]>
…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]>
…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]>
…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]>
…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]>
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:
.github/workflows/opengrep-precise.yml): runs on pull requests and scans only changed first-party paths viascripts/run-opengrep.sh --changed --sarif --error. This keeps findings relevant to the PR diff instead of surfacing unrelated repository-wide backlog..github/workflows/opengrep-precise-full.yml): manualworkflow_dispatchonly and scans the full first-party source set viascripts/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
security/opengrep/precise.ymlwith stableghsa-detector.<ghsa>.<rule>IDs.src/,extensions/,apps/,packages/,scripts/) while centralizing test/fixture/QA exclusions in.semgrepignore.security/opengrep/compile-manifest.jsonso every shipped rule can be traced back to the GHSA and detector-review run.Main changes
scripts/run-ghsa-detector-review-batch.mjsclaude,rovodev,codex,opencode, or custom command) against selected advisories..artifacts/ghsa-detector-review-runs/<run>/cases/<ghsa>/....--validate-coverageis enabled.Extracted-aspaths so model-produced report text cannot write outside the temporary scan tree.scripts/compile-opengrep-rules.mjsghsa,advisory-url,detector-bucket,source-run, andsource-rule-idmetadata.rule_id/span, drops mapped invalid rules, and fails closed on unmapped validator failures.scripts/run-opengrep.sh--changed) with matching output modes (--sarif,--json,--error).broadmode so the repo only ships the precise rulepack.security/opengrep/precise.ymlsecurity/opengrep/compile-manifest.jsonDocs/changelog/labeler
security/**,.semgrepignore, and OpenGrep workflows to the security labeler surface.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
.artifacts/are local/generated and are not committed.