Skip to content

feat(skills): approve a third-party skill by registry id against a pinned hash (#878) - #985

Merged
ajianaz merged 12 commits into
developfrom
feat/skill-registry-fetch
Nov 19, 2026
Merged

ajianaz merged 12 commits into
developfrom
feat/skill-registry-fetch

Conversation

@ajianaz

@ajianaz ajianaz commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

What

tole skills fetch <registry-id> --pinned-sha <sha256> [--source-url U] [--workspace DIR] (#878, step 3 of #973). It approves a third-party skill the owner already placed in a skills directory, after tying it to a uteke registry id. Base is develop (#975 has merged).

Why

#878 asked for a fetch from the uteke registry at a pinned SHA. Verified against uteke 0.24.1 and its source: no CLI or remote surface returns a skill body. skill show answers a manifest, the package hash and a ledger, the remote drops source_path, and the "registry" is a library of directories already on a machine. So tole does not fetch code: no new network path, nothing unpacked, nothing executed, so no transport to bound. The owner brings the bytes by a channel they chose (git clone at the commit, a copy) and this command verifies them.

Changes

  • skill/fetch.rs (shell-tools builds): resolves the id with UtekeSkillIndex::show (name and recorded hash only), reads the local package with the feat(skills): load only owner-approved skill content hashes #591 limits (no symlink, size and file caps), and requires its hash to equal BOTH --pinned-sha and uteke's recorded hash. Either mismatch, a missing or malformed record, or a 40-digit git commit pin (cannot be checked against bytes) refuses before anything is written.
  • Same ledger line and approval as a manual approve, with --source-url, the registry id and the pin as stated data. approve and fetch share approve_and_record; the approval re-reads the package and records the hash it verified from that same snapshot, so a file edited during the prompt is refused and nothing is written.
  • Owner only: refused under TOLE_UNDER_SESSION or a child agent (security(trust): owner-only trust records can be written by the agent (tole CLI from run_command, file tools when the workspace holds the data dir) #684), and without a terminal on stdin, with no --hash bypass (stricter than approve), so serve, acp, cron and scripts cannot reach it. CLI subcommand only: no model tool, nothing from project config. Like every owner command the gate is advisory (feat(plugins): sandbox wrapper for third-party stdio servers, lazy start, tool retrieval by meaning #601): a model with a shell can allocate a pty. Errors are redacted with the process secrets and made terminal-safe.
  • Prompt hardening found by the review: file names and the directory shown in the approval prompt are now sanitized (safe_text, package_listing) in both fetch and the existing approve, because a name containing ESC, CR or a newline could hide or forge the listing the owner reads before typing y.
  • Docs: threat-model "Registry approval" paragraph, docs/skills-registry-design.md decision, open questions and caveats, README, CHANGELOG. The caveat is stated everywhere: uteke records its hash from the same directory, so equality with the pin adds little unless the pin comes from a source the owner trusts independently of that directory.

Testing

  • Unit tests in skill::fetch (fake uteke whose show also returns injection text in body and content): match then ledger line equals the manual line and holds no body text; pin mismatch; uteke mismatch; missing or malformed record; edited local file; stale expect hash refuses and writes no approval or ledger file; commit-sized or malformed pin refused before uteke is called; only skill show and skill --help are ever called; symlinked package refused; "n" or EOF at the prompt writes nothing and "y" writes exactly one ledger line; a file name with ESC, CR and a forged hash line cannot forge the listing.
  • owner_only_e2e (real binary): skills fetch refused under a session, under a child agent and without a terminal, writing nothing and never calling uteke. The positive real-tty path is covered only through the injected run seam (a unit test), not through a pty.
  • Independent read-only security review by a fresh reviewer session: verdict SAFE TO MERGE. It verified the owner-only gating (strictly stricter than approve, no model tool or config path), hash binding (same snapshot hashed and recorded, same feat(skills): load only owner-approved skill content hashes #591 limits, ledger before approvals as before), uteke-as-attacker handling (id validated by name_ok, output capped, only approved_hash or current.hash read), ledger line shape and control-character rejection, and the refusal of 40-digit commit pins. It found the unsanitized file names in the prompt (fixed here, also in approve), test gaps (stale-hash and cli() ordering, now covered) and a doc-honesty point about the pin (now stated everywhere).
  • cargo fmt, clippy -D warnings (default, --no-default-features, --no-default-features --features shell-tools) clean. skill:: lib tests, owner_only_e2e and face_parity pass. Two tests/agents.rs tests (parent_spawns_child_polls_until_settled, a_run_never_touches_the_machine_home) failed in the author's sandbox (real HOME has .codecora and a cora binary on PATH); CI is the arbiter.
  • scripts/review-local.sh not run (no LLM key in the author session); the CI Cora job is the gate.

@github-actions

github-actions Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

🔍 Cora AI Code Review

✅ No issues found. Code looks good!


Review powered by cora-code · BYOK · MIT

ajianaz commented Nov 19, 2026

Copy link
Copy Markdown
Contributor Author

Cora's finding on approve.rs:435 does not apply at the current head (80a6491): show_package is not removed. It is still defined at approve.rs:443 and still called at approve.rs:701 (show_package(&shown)); the diff only changes its body to print through the new package_listing / safe_text sanitizers, so the old signature line shows as removed in the hunk. The crate compiles and clippy -D warnings is clean in all three feature configurations, which it would not be with a dangling caller.


Generated by Claude Code

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant