From b8fab5cce09fb0b81604fdd5e09284c30ebebd80 Mon Sep 17 00:00:00 2001 From: Sergio Demian Lerner Date: Wed, 18 Nov 2026 04:48:06 +0000 Subject: [PATCH] Say how to screen an outside pull request without running it The repository already said to screen foreign code before reading it for correctness. It did not say how, and the how is the part that matters: cargo build and cargo test execute a contributor's code as the developer, with their SSH keys, their gh token and write access to /var/lib/rustock, before a line has been read. The node in production runs hardened under systemd; the development machine does not. Merging was never the dangerous step. Adds three questions answerable from the diff alone -- new [[package]] entries in Cargo.lock, build-time surfaces (build.rs, .cargo/config.toml, rust-toolchain.toml, proc macros), and non-Rust executables. All three clean means reading the diff is the whole review. Any one dirty means the build belongs in a throwaway container, whoever the author appears to be. Singles out .cargo/config.toml because it is the quietest: a runner, linker or alias there is arbitrary command execution that reads as configuration rather than code. This repository has none, so one appearing in a pull request is a flag by itself. Also notes that rust-analyzer runs build.rs and expands proc macros when a project is opened, so an editor is an execution vector too. Written while reviewing #365 and #366, which the checklist was then applied to: #365 came out clean on all three, #366 dirty on the third, and the four Docker and shell files were read line by line as a result. The .gitignore entries are unrelated housekeeping: the SPV wallet lives outside this tree, and these are a second line of defence. Root-anchored so a crate directory named client or server is unaffected, and the /dist/ and /bin/ entries from #366 are preserved. Co-Authored-By: Claude Opus 5 --- .gitignore | 8 ++++++++ CLAUDE.md | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+) diff --git a/.gitignore b/.gitignore index 96ce020..54098f6 100644 --- a/.gitignore +++ b/.gitignore @@ -40,3 +40,11 @@ pegout-alerts.toml # Built and installed node binaries (scripts/build-binary.sh) /dist/ /bin/ + +# The SPV wallet lives at /home/paseo/wallet, not here. An ignored directory +# inside this tree is one `git clean -xdf` from deletion, with no history to +# recover it -- being ignored is precisely what keeps it out of history. +# Root-anchored, so a crate directory named client or server is unaffected. +/wallet/ +/client/ +/server/ diff --git a/CLAUDE.md b/CLAUDE.md index 797d57c..5b78c52 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -26,6 +26,43 @@ read it for correctness: `unsafe`, `transmute`, network calls, process spawns, environment reads, file writes, key handling, and any change to `Cargo.toml` or `Cargo.lock`. Then read it for what it claims to do. +Screen by **reading the diff through the API** — `gh pr diff`, `gh pr view +--json files`, `gh api .../contents/?ref=refs/pull/N/head`. Never by +checking the branch out. `cargo build` and `cargo test` execute the +contributor's code as you, with your SSH keys, your `gh` token and write +access to `/var/lib/rustock`, before you have read a line. The node in +production runs hardened under systemd; this machine does not. Merging was +never the dangerous step. + +### The three questions that decide whether reading is enough + +Answer these from the diff alone, before anything else: + +1. **Does `Cargo.lock` gain any `[[package]]` entry?** A new dependency + brings its own `build.rs` and proc macros, which you will not review. + Feature-only changes to an existing locked package add no new code. +2. **Does it add or change `build.rs`, `.cargo/config.toml`, + `rust-toolchain.toml`, or a proc-macro dependency?** Each runs code at + build time. `.cargo/config.toml` is the quietest: a `runner`, `linker` or + `[alias]` there is arbitrary command execution, and it reads as + configuration rather than code. This repository has no `.cargo/config.toml` + at all, so one appearing in a pull request is a flag by itself. +3. **Does it add any non-Rust executable** — shell script, `Dockerfile`, + `Makefile`, `justfile`, CI workflow, `package.json` with lifecycle + scripts? These do not run on `cargo build`, but they run when someone + follows the README. + +All three clean means reading the diff is the whole review, and no +sandbox is needed. Any one of them dirty means the build belongs in a +throwaway VM or container with no credentials, no SSH agent and no access to +`/var/lib/rustock` — regardless of who the author appears to be. + +Remember that an editor is also an execution vector: rust-analyzer runs +`build.rs` and expands proc macros when a project is opened. + +Report what a change does and what could not be ruled out. Never imply that +an outside contribution has been cleared as safe. + ## Consensus changes are checked against the chain, not reasoned about A consensus rule that is stricter than the chain it must accept is a fork.