Skip to content

fix(skills): allow ordinary command examples in authored skills - #163239

Open
jesse-merhi wants to merge 4 commits into
mainfrom
investigate/skill-scanner-removal
Open

jesse-merhi wants to merge 4 commits into
mainfrom
investigate/skill-scanner-removal

Conversation

@jesse-merhi

@jesse-merhi jesse-merhi commented Oct 2, 2026 •

Copy link
Copy Markdown
Member

What this changes

Ordinary command examples and environment-token API code currently fail the authoring security check. Workshop refuses the write, and the personal Skill Library refuses publication. This PR limits those admission checks to recognized literal credentials. Explicit security audits and plugin scans retain the full source/prose diagnostics.

Current main replaced Workshop proposals with direct, versioned writes. This branch preserves that cutover and applies the policy through the existing shared bundle scanner. It does not restore retired proposal APIs, tests, or docs. Operator install policy, live authority checks, path validation, immutable Library revisions, and Workshop version/restore behavior retain their existing owners.

Change breakdown

Part Files +LOC -LOC
Implementation 3 8 12
Tests and fixtures 3 77 6
Documentation 2 7 5
Total 8 92 23

Production shrinks by four lines. Test proof adds 71 net lines: two Library cases, an extension of an existing Workshop journey, and the database-worker registration. The prior plain-credential permutation, dedicated unchanged operator-policy case, and replacement manual-quarantine hook case were retired without replacement. Main separately retired the entire proposal lifecycle. No additional Workshop case is added.

Before and after

The existing Workshop create/write/archive/restore journey now contains these inert authored examples in both SKILL.md and scripts/deploy.js:

import { execFile } from "node:child_process";
execFile("git", ["--version"]);
const token = process.env.API_TOKEN;
fetch("https://example.test/api", {
  headers: { Authorization: `Bearer ${token}` },
});

Before: temporarily restoring main's shared scanner made the actual createWorkshopSkill entry point refuse the Markdown:

Refused: deploy/SKILL.md line 8 matches security rule "dangerous-exec"
(Shell command execution detected (child_process)). Remove or rewrite that line, then retry.

After: the same journey creates the skill, writes the support file, archives it, restores it, and reads back the exact instruction and support bytes. The persisted file list is SKILL.md plus scripts/deploy.js. The accepted scripts are authored bytes; they are never executed by this proof.

Real service flow Result
Workshop create → write support → archive → restore → view Exact command/API instruction and support bytes preserved
Library save → read Published revision; exact instructions and support bytes preserved
Library save with a credential in base64 support transport Rejected after decoding; no Library entry and no artifact

The Library encoded-file denial remains because scanning transport base64 instead of decoded bytes could leak a credential into a durable artifact. The two publication journeys exercise separate real owners and stores. Dedicated plaintext and policy guard coverage was deliberately retired; this is not a claim that another test duplicates every assertion.

Matched current Gateway proof

The same authored fixtures were sent to two real, separately built Gateways, using the shipped CLI and documented token-authenticated HTTP tool endpoint. The integrated main baseline is c4887fb7de365414df4afe27dcb61947bfab9cae; the feature is the pushed cddad34c227da1fd564aaf18831c9d7710e82e46. Each has isolated config, SQLite state, workspace, and loopback port. Both use the existing Node 24.18.1 / pnpm 12.7.0 runtime and unchanged frozen dependencies. Channels, providers, discovery, schedulers, and background learning are disabled; foreground tool policy explicitly allows skill_workshop.

OPENCLAW_STATE_DIR=<isolated-state> OPENCLAW_CONFIG_PATH=<isolated-config> \
  pnpm openclaw gateway run --port <isolated-port> --bind loopback

Requests use POST /tools/invoke, Authorization: Bearer <isolated-operator-token>, and:

{
  "tool": "skill_workshop",
  "agentId": "proof",
  "sessionKey": "agent:proof:manual",
  "args": { "action": "create", "name": "git-versions", "content": "<complete SKILL.md containing the exact command fixture above>" }
}
Request / observable result Main baseline Pushed feature
Create Git-command example HTTP 400 dangerous-exec; no skill or artifact HTTP 200; created
Create environment-token API example HTTP 400 env-harvesting; no skill or artifact HTTP 200; created
Write support → archive → restore → view Create refusal prevents the journey Every call HTTP 200; exact instructions and support bytes; SKILL.md + scripts/deploy.js
Create synthetic recognized literal credential HTTP 400 literal-secret; absent from live list and filesystem Same refusal and absence

The main Gateway's live list is empty. The feature Gateway lists both api-token and git-versions. HTTP readback and direct artifact comparison match the authored bytes. The shipped pnpm openclaw skills workshop --agent proof show git-versions --json also returns those instructions and both file names. This proves actual Gateway authentication, policy, tool construction, publication, versioning, restoration, and readback without mocking a first-party owner. Authored scripts were never executed.

This is shared-operator token authentication on an isolated Gateway. It does not claim a signed-in personal Library CLI flow or a live-provider turn. Library publication and decoded-file refusal retain the real worker/SQLite/filesystem proof above. No new permanent test, source change, or public API is added for this proof.

Validation

  • Merged main at c4887fb7de365414df4afe27dcb61947bfab9cae to resolve actual conflicts. Main's new shared scanner and direct Workshop owner are preserved. A read-only merge check with current main bf58e95ee3f583c338f48225ad9c5b3479e7d8d7 is conflict-free; it was not merged merely for advancing.

  • One scoped simplification and fresh independent standards and correctness assessments cover the final eight-path diff. No actionable findings. Reviews inspected source; execution belongs to the checks below.

  • node scripts/run-vitest.mjs src/skills/library/service-admission.test.ts src/skills/library/service.test.ts src/skills/workshop/library.test.ts src/skills/security/scanner.test.ts --bail=1: 85 passed across four files in 76.59s on Node 24.18.1, pnpm 12.7.0, macOS ARM64. Library admission 2, Library service 26, Workshop 10, scanner 47.

  • The first merged-head batch stopped at ZIP extraction (native file copy failed). Diagnosis found fs-safe 0.25 resolving the stale 0.21 native helper because the expected 0.25 helper was missing. A frozen-lockfile reinstall repaired this prerequisite. The complete same selection then passed, including ZIP extraction. No source/test assertion or dependency manifest was changed to conceal the failure.

  • The changed-check plan passed formatting, production types, all 27 core test type graphs, dead exports, core/scripts lint, and selected repository guards. Results were completed across the original command and resumed remaining commands; passing steps were reused. The dead-export prerequisite needed access to pnpm's normal cache. An initial standalone lint command omitted the changed-check owner's environment and reported 11 unchanged max-lines violations; the actual scoped configuration passed without source or rule changes.

  • pnpm test src/skills/library/service-admission.test.ts --maxWorkers=1: 2 passed, command wall 26.27s, Vitest 5.85s. pnpm test src/skills/workshop/library.test.ts --maxWorkers=1: 10 passed, command wall 40.04s, Vitest 19.40s. These macOS measurements ran during other validation work and are not a comparable before/after performance baseline. In current PR CI, Library admission passed 2 cases in 6.05s from shard begin to end (5.64s runner; 3.59s Vitest), and Workshop passed 12 cases in 30.54s (30.19s runner; 28.40s Vitest). These Linux x64 measurements cover the provider’s PR merge checkout; they are per-file costs, not the total job including installation/build. Both browser jobs also passed. The complete native CI workflow and all automatic checks passed: 65 passed, none failed or pending at final verification before the proof update.

  • The selected mocked-Gateway Control UI browser lane passed 78 tests across 23 files in 201.48s on native macOS ARM64. This is shared-harness coverage, not visual proof of this backend feature.

  • Current mapped native runtime checks stopped at the unchanged macOS-only APFS cold/warm/sparse provisioning journey: 15 sibling cases and the Bun SQLite-admission partition passed, while that journey exceeded its existing 120-second deadline (153.65s observed). Its test and provisioning owners are byte-identical to the integrated main baseline. The selected Linux CI job skips this Darwin-only case; its Linux filesystem case remains platform-only proof. No timeout or assertion was changed, and this result is not reported as a passing row. The exact failure cause is unresolved.

  • The final aggressive-selection/hybrid-runner map contains 10 runtime rows covering 58 distinct files. Nine rows passed locally with the pinned native OpenClaw Bun fork and Node 24.18.1; the remaining row has the macOS-only failure described above. Shared UI and browser-extension prerequisites also passed. The browser-extension Chromium flow paired its native host, attached tabs, revoked a paused tab, and cleaned up its relay/MCP/HTTP servers: 1 passed, Vitest 79.59s. Its first attempt stopped before testing on an abandoned build lease left by an interrupted validation worker; the verified task-owned lease was recovered, then the canonical command completed.

  • Additional production/test type graphs, all selected extension lint stripes, SDK package-boundary compile (Codex, Slack, Telegram), Zoom canary, additional boundaries, prompt snapshots, source contracts, guards, architecture/Kysely, formatting, and plugin inventory passed. Protocol registry/generation, Swift/Kotlin determinism, since metadata, and mobile event coverage also passed. Documentation content passed too (0 broken links); its first attempt could not enter pnpm’s normal dlx cache, and the same command completed with native cache access. The exact-base private-key scanner also passed.

Admission policy

Credential-only admission is the existing maintainer-authorized scope. Non-credential heuristics, including execution, pipe-to-shell, mining references, and environment/network combinations, do not veto authored content. This accepts that content-policy tradeoff while keeping literal-credential refusal, operator policy, runtime permissions, and current authority checks. Publishing instructions does not execute support scripts. No schema, public record shape, dependencies, or configuration options are added by this feature.

How to verify

Run the focused command above with isolated test fixtures. Ordinary command/API examples must publish and survive readback/restoration with matching bytes. An encoded support file containing a recognized synthetic credential must leave no published entry or artifact. Full scanner tests must continue to report their source/prose diagnostics for explicit audit callers.

Apply-time quarantine of a historical credential-bearing proposal was not proved before its owner was retired by main. The current direct Workshop credential/path denials and version restoration are exercised by the existing Workshop suite.

Historical evidence and limits

Historical proposal CLI traces belong to an owner retired by main; they are superseded here by the matched current Gateway proof above.

Earlier local emulated Linux UI/Gateway failures remain unresolved: the Canvas dashboard moved vertically after focus, provider-browser login hit its 120-second deadline, and the second Gateway lane hit custody/file-lifecycle and readiness deadlines. Diagnostic replays did not establish a repair or baseline cause. No timeouts or assertions were weakened. Later native CI passes are not proof of those failures' cause or repair. This feature does not change those owners, and the current planner selects shared Control UI and browser-extension checks, and no real-Gateway or native-app lane. There is no live-provider, live operator Gateway, or signed-in Library CLI proof in this update.

@clawsweeper

clawsweeper Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation agents Agent runtime and tooling size: M labels Oct 2, 2026
@jesse-merhi
jesse-merhi marked this pull request as ready for review October 2, 2026 04:11
Copilot AI balanced review requested due to automatic review settings October 2, 2026 04:11

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@github-actions

github-actions Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components.

No secops approval is required. This comment is informational because the PR author has Maintain or Admin access.

  • Current SHA: cddad34c227da1fd564aaf18831c9d7710e82e46
  • Maintainer: @jesse-merhi
  • Repository role: maintain

These security sensitive changes were made:

  • src/skills/security/scanner.ts: Controls product security checks or trust decisions. Check whether the change weakens detection, protection, or remediation.
  • src/skills/security/skill-bundle-scan.ts: Controls product security checks or trust decisions. Check whether the change weakens detection, protection, or remediation.

Carefully review these changes before merging.

@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. 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. labels Oct 2, 2026
@clawsweeper

clawsweeper Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR allows command and environment-token examples in authored skills while continuing to reject recognized literal credentials.

Example: Create git-versions with an example importing child_process and calling execFile("git", ["--version"]).

  • Before: Workshop refuses creation with dangerous-exec.
  • After: Creation succeeds, and archive/restore preserves the exact authored bytes.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) Focused implementation with shipped-entry-point proof, meaningful regression coverage, an explicitly accepted policy tradeoff, and no actionable findings.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): Supplied matched baseline/head results exercise the shipped Gateway tool endpoint and CLI readback for command/API admission, credential refusal, and exact-byte archive/restore; Library worker/SQLite/filesystem journeys additionally cover publication and decoded-file denial.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Users cannot save reusable skills containing ordinary command examples or API examples that read tokens from the environment.
Reason: The maintainer-authored PR explicitly approves the admission policy, and the narrow implementation repairs both affected authoring workflows.

Merge readiness

✅ Ready for maintainer review

This PR fixes a current authoring failure with a focused shared-scanner change; no actionable introduced defects were found.

Priority: P2
Reviewed head: cddad34c227da1fd564aaf18831c9d7710e82e46

Before merge

None.

Findings

None.

Agent review details

How this fits together

Workshop and personal Library authoring validate skill instructions and support files before versioned publication; explicit security audits independently run the full diagnostic scanners.

flowchart TD
A[Authored skill bundle] --> B[Workshop or Library]
B --> C[Literal credential scan]
C --> D[Existing policy and authority]
D --> E[Versioned skill storage]
E --> F[Readback and restore]
A --> G[Explicit full security audit]
Loading

Technical review

Best possible solution:

Use credential-only authoring admission through the shared scanner while retaining explicit full audits and existing publication safeguards.

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

Current-main source deterministically rejects the supplied child_process and environment-token examples, corroborated by the author's matched Gateway baseline results; no target code was run during this review.

Is this the best way to solve the issue?

The focused shared-owner change covers both authoring paths, preserves credential detection and explicit audits, and implements the maintainer-approved policy without adding configuration or another admission owner.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against cd32ddcdbd87.

Provenance checked

  • Library critical-scan publication rejection changes intended behavior with a stated reason (75bcd26: Personal libraries publish validated immutable bundles on shared Gateways; the original service rejected critical scanner findings.)
  • Shared Workshop and Library bundle scanning changes intended behavior with a stated reason (cfee851: The direct, versioned Workshop refactor centralized bundle scanning while retaining critical-finding admission checks.)
  • Workshop versioning journey and authoring documentation keeps the original intent (cfee851: Direct writes retain prior versions for undo and restore; the PR extends that journey and updates the admission description without restoring retired proposal paths.)
  • Personal Library documentation changes intended behavior with a stated reason (87ade59: The documentation split preserved the personal-authoring contract; this PR updates its scanning description to match the approved policy.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Introduced change: The pinned introduction changes authoring admission through the existing shared scanner and removes Library's redundant critical-finding rejection; full source and prose scanners remain intact. (src/skills/security/skill-bundle-scan.ts:9, cddad34c227d)
  • Current main still needs the change: Fetched main's shared authoring scanner still combines scanSkillContent and scanSource, retaining the false-positive refusal path. (src/skills/security/skill-bundle-scan.ts:10, cd32ddcdbd87)
  • Explicitly accepted content-policy tradeoff: The fully retrieved maintainer-authored Admission policy section expressly accepts execution, pipe-to-shell, mining, and environment/network examples without admission vetoes, while retaining credential checks, operator policy, runtime permissions, and current authority. (cddad34c227d)
  • Changed behavior through the shipped Gateway: The PR supplies matched baseline/head Gateway results through POST /tools/invoke: command and environment-token examples change from HTTP 400 to 200, credential creation remains refused without artifacts, and support-file publication plus archive/restore preserves exact bytes. (cddad34c227d)
  • Independent audit diagnostics retained: Explicit deep audits still call both scanSkillContent and scanSource; Library publication still evaluates operator install policy after the credential check. (src/security/audit.deep.runtime.ts:124, cddad34c227d)
  • Feature history and adjacent work: The Library originated in feat(skills): add personal libraries for shared Gateways #134068 and the direct versioned Workshop owner in refactor(skills): make Skill Workshop a direct, versioned self-learning loop #161057; the PR preserves both owners. Merged worker refactors explicitly left scan policy unchanged and do not supersede this work. Some historical blobs and Workshop blame were unavailable locally; supplied provenance, readable commit history, Library blame, and GitHub reads support the assessment. (src/skills/library/service.ts:106, cd32ddcdbd87)

PR surface

Source -4, Tests +71, Docs +2. Total +69 across 8 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 3 8 12 -4
Tests 3 77 6 +71
Docs 2 7 5 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 8 92 23 +69

Review metrics

Metric Value Why it matters
Production versus test changes Production +8/−12; tests and fixtures +77/−6. Production shrinks; test growth protects separate Workshop and Library stores, exact-byte restoration, and decoded credential rejection before publication.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: Ordinary authored procedures are refused in two skill-writing workflows, with limited blast radius outside authoring.
  • merge-risk: 🚨 security-boundary: Admission deliberately stops vetoing non-credential security heuristics; the maintainer explicitly accepts this tradeoff, and credential refusal plus runtime authorization remain intact.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (9 earlier review cycles; latest 8 shown)
  • reviewed 2026-10-02T04:36:20.995Z sha f10a348 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-02T04:43:38.730Z sha f10a348 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-08T03:05:24.578Z sha f8b6591 :: blocked before merge. :: none
  • reviewed 2026-10-08T03:16:44.584Z sha f8b6591 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-08T04:30:29.339Z sha f8b6591 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-08T04:38:25.331Z sha f8b6591 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-13T04:48:40.266Z sha cddad34 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-13T05:08:03.138Z sha cddad34 :: needs maintainer review before merge. :: none

Reviewed October 13, 2026, 1:15 AM ET / 05:15 UTC (Revision 10).

@jesse-merhi

Copy link
Copy Markdown
Member Author

/clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added the merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. label Oct 2, 2026
@jesse-merhi

Copy link
Copy Markdown
Member Author

/clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Oct 8, 2026
@jesse-merhi

Copy link
Copy Markdown
Member Author

/clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@jesse-merhi

Copy link
Copy Markdown
Member Author

/clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot removed the rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. label Oct 8, 2026
@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. labels Oct 8, 2026
@jesse-merhi

Copy link
Copy Markdown
Member Author

/clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@openclaw-barnacle openclaw-barnacle Bot added size: S and removed agents Agent runtime and tooling size: M labels Oct 13, 2026
@jesse-merhi

Copy link
Copy Markdown
Member Author

/clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@jesse-merhi

Copy link
Copy Markdown
Member Author

/clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@jesse-merhi

Copy link
Copy Markdown
Member Author

/clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 13, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

This branch has not been deployed

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

Labels

docs Improvements or additions to documentation merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. security-sensitive-changed size: S status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants