Skip to content

fix(clawhub): reject mutable GitHub skill refs - #97157

Merged
steipete merged 2 commits into
openclaw:mainfrom
yetval:fix/clawhub-github-commit-immutable
Jul 11, 2026
Merged

steipete merged 2 commits into
openclaw:mainfrom
yetval:fix/clawhub-github-commit-immutable

Conversation

@yetval

@yetval yetval commented Jun 27, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

ClawHub marks GitHub-backed skill resolutions as immutable but OpenClaw trusted the resolver's github.commit string without enforcing a full commit SHA. A branch or tag such as main could therefore be downloaded, installed, and persisted as mutable: false, allowing the installed code to move behind an allegedly pinned identity.

This behavior is present in current main, stable v2026.6.11, and beta v2026.7.1-beta.5.

Why This Change Was Made

  • Validate the successful GitHub resolution once in assertInstallResolutionAllowed, before any download or filesystem side effect.
  • Normalize the accepted commit to one trimmed, lowercase, 40-hex SHA in the returned resolution.
  • Let version selection, GitHub codeload, install policy, origin metadata, lock metadata, and telemetry consume that same canonical object.
  • Keep archive resolutions and direct git: installs unchanged; direct Git installs intentionally support mutable refs and record them as mutable.

The submitted later-stage validation was moved to the resolver acceptance boundary so downstream callers cannot accidentally reuse the raw ref.

User Impact

Normal ClawHub GitHub-backed installs continue unchanged. A custom or malformed resolver response containing a branch, tag, short SHA, or other non-pinned ref now fails with clear guidance before download. This enforces ClawHub's documented 40-character commit contract; it adds no config, migration, or fallback surface.

Evidence

  • Existing pinned-install test now proves padded uppercase input is normalized and the canonical SHA reaches download, policy, origin, and installed version.
  • New negative test proves main fails before archive download, extraction, policy evaluation, or installation.
  • oxfmt and git diff --check pass.
  • Autoreview: clean, 0.96 confidence.
  • Official ClawHub protocol specifies a 40-character commit SHA; a live resolver sample returned a full SHA, while GitHub codeload accepts both a branch and SHA, proving client-side enforcement is necessary.
  • Exact-head sanitized AWS focused tests passed 142 tests with two platform skips; check:changed passed.
  • An actual CLI fixture returning mutable ref main failed before archive download or filesystem metadata.
  • A live public ClawHub install carried resolver SHA f6075a5060ed3c86536055700d95eb68655162ee unchanged through codeload, origin, and lock metadata.
  • Exact-head hosted CI passed 45 jobs with 11 routine skips and zero failures; CodeQL passed.

Root CHANGELOG.md is release-owned, so the release-note context and @yetval credit are carried here and in the replacement commit.

@clawsweeper

clawsweeper Bot commented Jun 27, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge. Reviewed July 11, 2026, 9:41 AM ET / 13:41 UTC.

Summary
The PR validates ClawHub GitHub install resolutions as full commit SHAs, normalizes accepted commits, and adds tests for pinned installs and pre-download mutable-ref rejection.

PR surface: Source +9, Tests +27. Total +36 across 2 files.

Reproducibility: yes. Current main accepts resolver commit strings without full-SHA enforcement, and the submitted real CLI fixture demonstrates mutable-ref installation before the fix; the remaining source URL mismatch follows directly through the metadata writers.

Review metrics: none identified.

Merge readiness
Overall: 🦐 gold shrimp
Proof: 🦞 diamond lobster
Patch quality: 🦐 gold shrimp
Result: needs maintainer review before merge.

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

Rank-up moves:

  • [P2] Canonicalize the source URL and add origin/lock coverage for a full SHA paired with a mutable URL.
  • Refresh the CLI fixture or metadata transcript for that mismatched-source case.

Risk before merge

  • [P1] A valid commit paired with a mutable or unrelated source URL installs pinned bytes but records moving or incorrect trusted provenance in both metadata stores.
  • [P1] The intentional full-SHA requirement makes custom ClawHub-compatible registries that previously returned branches, tags, or short SHAs fail installation.

Maintainer options:

  1. Canonicalize provenance before merge (recommended)
    Derive the accepted source URL from normalized repo, path, and commit and add regression coverage for mismatched resolver metadata.
  2. Accept inconsistent source links
    Merge the download pinning while explicitly accepting that persisted source links can still identify moving or unrelated code.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Derive the accepted GitHub source URL from normalized repo, path, and lowercase 40-character commit, and add focused origin/lock assertions for a resolver response that pairs a full SHA with a mutable URL.

Next step before merge

  • [P2] The blocker is a narrow mechanical repair using existing canonical URL code and focused lifecycle tests.

Security
Needs attention: The patch pins executed archive bytes but still permits resolver-controlled mutable provenance to be stored as the trusted source link.

Review findings

  • [P2] Canonicalize the persisted source URL too — src/skills/lifecycle/clawhub.ts:1267
Review details

Best possible solution:

Canonicalize the complete resolver-approved GitHub identity before side effects so download, policy, origin, lock, telemetry, and source links all identify the same immutable commit.

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

Yes. Current main accepts resolver commit strings without full-SHA enforcement, and the submitted real CLI fixture demonstrates mutable-ref installation before the fix; the remaining source URL mismatch follows directly through the metadata writers.

Is this the best way to solve the issue?

No, not yet. The resolver acceptance boundary is the narrowest maintainable fix, but the returned resolution remains partly mutable because its persisted source URL is still resolver-controlled.

Full review comments:

  • [P2] Canonicalize the persisted source URL too — src/skills/lifecycle/clawhub.ts:1267
    Late finding: this line was unchanged on an earlier reviewed head, but the mismatch was missed then. A valid github.commit can still arrive with github.sourceUrl pointing at /tree/main/; because only commit is replaced, that mutable URL is later written to both origin and lock metadata. Rebuild it with the existing GitHub tree URL helper or reject mismatches so the trusted source link matches the pinned bytes.
    Confidence: 0.99
    Late finding: first raised on code an earlier review cycle already covered.

Overall correctness: patch is incorrect
Overall confidence: 0.98

AGENTS.md: found and applied where relevant.

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

Label changes

Label changes:

  • add merge-risk: 🚨 compatibility: Merging intentionally rejects branch, tag, and short-SHA responses that custom ClawHub-compatible registries could previously use.
  • add proof: sufficient: Contributor real behavior proof is sufficient. Real CLI fixture evidence shows mutable-ref installation before the fix, pre-download rejection after it, and successful full-SHA installation; a live public install also demonstrates the central pinned path.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🦐 gold shrimp.

Label justifications:

  • P2: This is a bounded ClawHub installer integrity bug with one concrete, focused patch defect.
  • merge-risk: 🚨 compatibility: Merging intentionally rejects branch, tag, and short-SHA responses that custom ClawHub-compatible registries could previously use.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🦐 gold shrimp.
  • proof: sufficient: Contributor real behavior proof is sufficient. Real CLI fixture evidence shows mutable-ref installation before the fix, pre-download rejection after it, and successful full-SHA installation; a live public install also demonstrates the central pinned path.
Evidence reviewed

PR surface:

Source +9, Tests +27. Total +36 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 14 5 +9
Tests 1 28 1 +27
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 42 6 +36

Security concerns:

  • [low] Mutable provenance survives validation — src/skills/lifecycle/clawhub.ts:1267
    A full commit can be paired with a branch-based or unrelated source URL that is persisted in both origin and lock records, misrepresenting the installed source.
    Confidence: 0.99

Acceptance criteria:

  • [P1] pnpm test src/skills/lifecycle/clawhub.test.ts.
  • [P1] pnpm check:changed -- src/skills/lifecycle/clawhub.ts src/skills/lifecycle/clawhub.test.ts.
  • [P1] git diff --check.

What I checked:

Likely related people:

  • Patrick-Erichsen: Introduced GitHub-backed ClawHub skill installs and recently updated install telemetry in the same lifecycle surface. (role: feature introducer and recent area contributor; confidence: high; commits: 8f85f949465a, 1252a3da59a8; files: src/skills/lifecycle/clawhub.ts, src/infra/clawhub.ts)
  • momothemage: Added persisted ClawHub install provenance and exposed verified source data adjacent to the affected origin and source URL behavior. (role: provenance feature contributor; confidence: high; commits: dd7f2ef002e8, db4bcd7d09de; files: src/skills/lifecycle/clawhub.ts)
  • vincentkoc: Added trusted verified source provenance and refactored the lifecycle internals containing the canonical URL helper. (role: provenance and lifecycle contributor; confidence: high; commits: 15166e81caa1, cb1e4356aafc; files: src/skills/lifecycle/clawhub.ts)
  • steipete: Authored the current replacement commits and is the live assignee for resolving the final-head review blocker. (role: recent area contributor and assignee; confidence: high; commits: baf327b4da14, 75619a893ffb; files: src/skills/lifecycle/clawhub.ts, src/skills/lifecycle/clawhub.test.ts)
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 (5 earlier review cycles)
  • reviewed 2026-07-03T23:31:18.105Z sha bc60b889f259ec1267e2e58bb0474e887dae2c09 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-05T12:31:59.435Z sha bc60b889f259ec1267e2e58bb0474e887dae2c09 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-11T12:46:25.699Z sha 7c9631c7879c1a5eb2b96c2d3bf98a8d8665b27d :: needs maintainer review before merge. :: none
  • reviewed 2026-07-11T13:02:33.753Z sha bd5b3961e5ddc0fa8ee81c6d0b01305234cf58c6 :: needs maintainer review before merge. :: none
  • reviewed 2026-07-11T13:23:23.376Z sha bd5b3961e5ddc0fa8ee81c6d0b01305234cf58c6 :: needs maintainer review before merge. :: none

@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: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Jun 27, 2026
@yetval

yetval commented Jun 27, 2026

Copy link
Copy Markdown
Contributor Author

Pushed 090a9c5 and refreshed the proof against that head.

This commit extends the fix past the download path: performClawHubSkillInstall validated the resolver commit for the codeload fetch but still passed the raw latestResolution.github.commit into installGitHubResolution, which builds the persisted install provenance (origin.commit) and the install-policy requestedSpecifier. A padded-but-valid sha would download the normalized commit while recording the un-normalized value. It now passes the validated version through, so the downloaded commit and the recorded provenance/policy agree, plus a focused padded-sha regression.

The refreshed Real behavior proof in the body drives the real installSkillFromClawHub -> performClawHubSkillInstall -> installGitHubResolution -> installExtractedSkillRoot path end to end on pristine main vs head 090a9c5, stubbing only the external I/O seams (resolver HTTP, codeload bytes, extraction, final copy). It shows, on identical inputs: the "main" ref reaches the codeload fetch on base but is rejected before any fetch on head; and for a padded sha the real install-policy boundary receives the un-normalized value on base versus the single normalized commit on head.

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Jun 27, 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.

@yetval

yetval commented Jun 27, 2026

Copy link
Copy Markdown
Contributor Author

Addressed both rank-up moves; head is unchanged at 090a9c5 (proof-only refresh, no code change).

[P1] Real CLI / fixture-registry proof (replaces the stubbed-driver evidence). Drove the real openclaw skills install aiq-deploy --global CLI (src/entry.ts) end to end against a local fixture ClawHub registry and fixture GitHub codeload server (OPENCLAW_CLAWHUB_URL + OPENCLAW_CLAWHUB_GITHUB_CODELOAD_BASE_URL), on pristine main vs head. Only the resolver/codeload HTTP is fixtured; the whole CLI, install resolver, validation, download, extraction, and on-disk install ran for real. Copied output is in the refreshed PR body. On identical inputs, resolver commit: "main":

  • BEFORE (main): exit 0, Downloading aiq-deploy@main from GitHub..., Installed aiq-deploy@main, fixture log shows GET /NVIDIA/skills/zip/main -> a mutable branch was fetched and installed.
  • AFTER (090a9c5): exit 1, resolved to a non-immutable GitHub source ref "main"; expected a commit sha., zero codeload requests, nothing on disk.
  • AFTER, full 40-hex sha: exit 0, GET /NVIDIA/skills/zip/<sha>, skill installed -> success path unchanged.

Compatibility decision. The install-resolution type already documents this field as a "Commit-pinned source approved by ClawHub's install resolver policy" (src/infra/clawhub.ts:324), and the sibling provenance-display path (readVerifiedClawHubSkillSourceUrl) already rejects branch-like refs. So this enforces the already-documented commit-pinned contract on the download/metadata path rather than inventing a new restriction. Whether to keep leniency for custom ClawHub-compatible registries that returned branch/tag/short-sha is called out in User Impact as a maintainer decision.

@clawsweeper re-review

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed 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. labels Jun 27, 2026
@yetval
yetval force-pushed the fix/clawhub-github-commit-immutable branch 2 times, most recently from ce97339 to 5ceedac Compare June 29, 2026 14:18
@clawsweeper clawsweeper Bot removed proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Jul 3, 2026
@yetval

yetval commented Jul 3, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-run

@clawsweeper

clawsweeper Bot commented Jul 3, 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.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Jul 3, 2026
@clawsweeper clawsweeper Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Jul 3, 2026
@clawsweeper clawsweeper Bot added the merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. label Jul 5, 2026
@steipete steipete self-assigned this Jul 11, 2026
@steipete
steipete force-pushed the fix/clawhub-github-commit-immutable branch from bc60b88 to 7c9631c Compare July 11, 2026 12:40
@steipete steipete changed the title fix(clawhub): validate GitHub skill commit is an immutable sha before download fix(clawhub): reject mutable GitHub skill refs Jul 11, 2026
@steipete
steipete force-pushed the fix/clawhub-github-commit-immutable branch from 7c9631c to bd5b396 Compare July 11, 2026 12:51
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Jul 11, 2026
@steipete
steipete marked this pull request as draft July 11, 2026 13:18
@steipete
steipete marked this pull request as ready for review July 11, 2026 13:18

@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: bd5b3961e5

ℹ️ 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".

);
}
throw new Error(resolution.message || `Skill "${resolution.slug}" is not installable.`);
return { ...resolution, github: { ...resolution.github, commit } };

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 Rebuild the source URL from the pinned commit

When the resolver returns a valid full SHA in github.commit but leaves github.sourceUrl pointing at a mutable ref such as .../tree/main/..., this accepts the resolution and only canonicalizes commit. The later readInstallResolutionSourceUrl(latestResolution) path then persists that mutable URL into .clawhub/origin.json and the lockfile, so status/source metadata can still point users at moving code even though the installed version was pinned. Validate that sourceUrl matches the normalized commit, or build it from repo/path/commit here before returning the canonical resolution.

Useful? React with 👍 / 👎.

@steipete
steipete force-pushed the fix/clawhub-github-commit-immutable branch from bd5b396 to 75619a8 Compare July 11, 2026 13:27
@clawsweeper clawsweeper Bot removed proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Jul 11, 2026
@steipete

Copy link
Copy Markdown
Contributor

Land-ready work completed for exact head 75619a893ffbc6d4446c5f6a9143a3d2d5ef86cd.

What changed:

  • Moved GitHub commit validation to the ClawHub resolver acceptance boundary in src/skills/lifecycle/clawhub.ts:1246.
  • Accepted values are trimmed, checked as exactly 40 hexadecimal characters, and lowercased once. Download, version, install policy, origin, lock, and telemetry then consume the same canonical resolution.
  • Archive resolutions and direct git: installs remain unchanged.
  • Consolidated proof in src/skills/lifecycle/clawhub.test.ts:1364 and added the fail-before-side-effects regression at src/skills/lifecycle/clawhub.test.ts:1421.
  • Preserved contributor credit for @yetval. Root CHANGELOG.md is release-owned; release-note context is in this PR body and the replacement commit.

Review:

  • Native review artifacts validated with recommendation READY FOR /prepare-pr, zero findings.
  • Fresh autoreview: clean, 0.96 confidence.
  • Direct dependency contract checked in openclaw/clawhub: GitHub-backed resolutions specify a full 40-character commit SHA and persist it as the install identity.

Exact-head evidence:

Safety boundary for contributor code: fresh single-SHA AWS lease; public network; Tailscale disabled; empty instance profile; trusted-main bootstrap; IMDSv2 IAM endpoint denied; isolated HOME; only CI forwarded; no hydration. Lease released after proof.

Known proof gaps: none.

@steipete
steipete merged commit 97d57a2 into openclaw:main Jul 11, 2026
110 of 116 checks passed
@steipete

Copy link
Copy Markdown
Contributor

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 12, 2026
* fix(clawhub): reject mutable GitHub skill refs

Co-authored-by: yetval <[email protected]>

* chore: keep release notes in PR metadata

---------

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

Labels

P2 Normal backlog priority with limited blast radius. size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants