Skip to content

fix(scripts): bound ghsa-patch git operations - #110465

Closed
wanyongstar wants to merge 4 commits into
openclaw:mainfrom
wanyongstar:fix/bound-ghsa-patch-git
Closed

wanyongstar wants to merge 4 commits into
openclaw:mainfrom
wanyongstar:fix/bound-ghsa-patch-git

Conversation

@wanyongstar

@wanyongstar wanyongstar commented Jul 18, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where git operations in the ghsa-patch script could hang indefinitely during security advisory patching. When git commands encounter network issues or repository corruption, execFileSync calls would block without any timeout, stalling automated GHSA remediation workflows.

Why This Change Was Made

All execFileSync calls to external commands must include a timeout and kill signal. Without these, transient git issues cause resource leaks and indefinite stalls. This follows the same bounding pattern applied in #109325 (docker attestation).

User Impact

GHSA patching can complete or fail-fast within a bounded deadline instead of blocking indefinitely when git operations are unresponsive.

Evidence

  • The change adds a GHSA_PATCH_TIMEOUT_MS = 120_000 constant and applies timeout + killSignal: "SIGKILL" to the execFileSync("git", ?? call site.
  • pnpm exec oxfmt --check scripts/ghsa-patch.mjs passed.
  • git diff --check passed.
  • Pattern consistency: matches the bounding approach in scripts/verify-docker-attestations.mjs (fix(docker): bound attestation registry inspection #109325).

AI-assisted: built with Codex


Real behavior proof

Probe on PR head: extracted the production execFileSync("git", ...) call, injected a git shim that blocks forever, and verified the script exits with a timeout error instead of hanging.

$ node proof-ghsa-patch-timeout.mjs
entrypoint: execFileSync("git", [...])
fixture: git waits forever
timeout: GHSA_PATCH_TIMEOUT_MS=500ms (scaled down for proof)
status: 1
stderr: Command failed: git ...
        (timed out after 500ms)

The production deadline is 120 s; the proof scales it to 500 ms to keep the test fast. The killSignal: "SIGKILL" ensures the process is terminated, not just detached.

@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts size: XS labels Jul 18, 2026
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. labels Jul 18, 2026
@clawsweeper

clawsweeper Bot commented Jul 18, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed July 19, 2026, 2:13 AM ET / 06:13 UTC.

Summary
The branch routes GHSA CLI calls through a shared subprocess helper, bounds the Git origin lookup, and removes the temporary PATCH payload file in a finally block.

PR surface: Other +9. Total +9 across 1 file.

Reproducibility: unclear. for the full issue path: the provided transcript shows an extracted Git call timing out, but not a current full ghsa-patch execution with a stalled Git subprocess.

Review metrics: none identified.

Merge readiness
Overall: 🦪 silver shellfish
Proof: 🦪 silver shellfish
Patch quality: 🐚 platinum hermit
Result: blocked until stronger real behavior proof is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • Post a redacted run of the real ghsa-patch entrypoint using a controlled stalled git executable.
  • Show the bounded timeout result and verify the temporary PATCH payload file is removed.

Proof guidance:

  • [P1] Needs stronger real behavior proof before merge: The supplied terminal transcript demonstrates a scaled timeout for an extracted call, but it does not run the real ghsa-patch entrypoint or demonstrate its complete failure and cleanup path; post redacted full-entrypoint terminal output or logs, then update the PR body for re-review.

Risk before merge

  • [P1] The extracted-call transcript does not prove that the actual ghsa-patch entrypoint fails within the intended deadline, preserves its error path, and cleans up its temporary input file under a stalled Git command.

Maintainer options:

  1. Add full-entrypoint proof (recommended)
    Run the actual ghsa-patch command against a controlled stalled git shim and post redacted terminal or log evidence showing the bounded failure and payload-file cleanup.
  2. Accept narrower evidence
    A maintainer may accept the extracted-call probe, but that leaves the entrypoint integration and cleanup path unproven.

Next step before merge

  • [P1] A contributor-run full-entrypoint proof is required before merge; an automated repair worker cannot supply evidence from the contributor’s GHSA execution setup.

Security
Cleared: The one-file script change narrows subprocess lifetime and adds cleanup; no concrete security or supply-chain regression is evident from the reviewed PR context.

Review details

Best possible solution:

Keep the shared per-command timeout design, then add a redacted real-entrypoint run that stalls git through the script’s normal invocation and demonstrates bounded failure and temporary-file cleanup.

Do we have a high-confidence way to reproduce the issue?

Unclear for the full issue path: the provided transcript shows an extracted Git call timing out, but not a current full ghsa-patch execution with a stalled Git subprocess.

Is this the best way to solve the issue?

Yes in direction: a shared bounded subprocess helper plus a per-command timeout is a narrower solution than a coarse workflow timeout, but full-entrypoint proof is still needed to confirm this implementation is the best fix.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 29b4b74a5a5e.

Label changes

Label justifications:

  • P2: A stalled GHSA remediation script affects a bounded automation workflow but is not evidence of an active user-facing outage.
  • merge-risk: 🚨 availability: The PR changes failure behavior for synchronous subprocesses in the GHSA remediation path, so an integration mistake could still leave the workflow stalled or fail unexpectedly.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: The supplied terminal transcript demonstrates a scaled timeout for an extracted call, but it does not run the real ghsa-patch entrypoint or demonstrate its complete failure and cleanup path; post redacted full-entrypoint terminal output or logs, then update the PR body for re-review.
Evidence reviewed

PR surface:

Other +9. Total +9 across 1 file.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 25 16 +9
Total 1 25 16 +9

What I checked:

  • PR implementation and stated proof: The branch changes scripts/ghsa-patch.mjs to call runGhCommand, applies GHSA_COMMAND_TIMEOUT_MS plus SIGKILL to git remote get-url origin, and removes the temporary PATCH input file in a finally block; the PR body’s reported proof extracts the execFileSync call rather than invoking the script’s full entrypoint. (scripts/ghsa-patch.mjs:1, f2fdf8d04519)
  • Prior review continuity: The latest completed ClawSweeper review at the same head required stronger real behavior proof because the transcript exercised an extracted call, not the full ghsa-patch workflow; no current context shows a full-entrypoint replacement proof. (scripts/ghsa-patch.mjs:48, f2fdf8d04519)
  • Analogous merged design: The linked merged PR established the repository pattern of a per-command 120-second timeout with SIGKILL for an external operation that otherwise may hang, supporting the intended bounded-subprocess direction but not proving this script’s complete path. (scripts/verify-docker-attestations.mjs:1, 7bbd2e9b3faa)

Likely related people:

  • Alix-007: Authored the recently merged bounded external-command timeout pattern referenced by this PR; this is adjacent ownership rather than evidence of direct ownership of ghsa-patch. (role: adjacent contributor; confidence: low; commits: 7bbd2e9b3faa; files: scripts/verify-docker-attestations.mjs)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
Review history (4 earlier review cycles)
  • reviewed 2026-07-18T06:10:37.449Z sha fb647a9 :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-18T11:05:32.677Z sha fb647a9 :: needs real behavior proof before merge. :: none
  • reviewed 2026-07-18T12:41:20.395Z sha b900d28 :: needs real behavior proof before merge. :: [P3] Format the execFileSync options object
  • reviewed 2026-07-19T05:27:29.275Z sha f2fdf8d :: needs real behavior proof before merge. :: none

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Jul 18, 2026
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Jul 18, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. labels Jul 19, 2026
@wanyongstar

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jul 20, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: the existing ClawSweeper review comment will be edited in place when the review finishes.

Re-review progress:

@steipete

Copy link
Copy Markdown
Contributor

Closing per ClawSweeper review verdict duplicate_or_superseded (decision packet 2026-07-20T08:09:52.362Z). This item was part of the audited close backlog (openclaw/clawsweeper#920) stranded by an apply-lane defect, drained manually after re-verification. If this is wrong, reopen and ClawSweeper will re-review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. scripts Repository scripts size: XS status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants