Repository navigation
Limit answering a remote tool's confirmation to the team-signed app by audit token and code signature (#4327) - #4368
Conversation
|
APPROVE (static review of d880fe5; nothing built or run) No blocking finding. Follow-ups below, M1 and L1 I would file before the signed-build checks. Checked, holds:
Findings:
Could not verify: the positive case (a real team-signed app and CLI passing; tracked in #4365/#4367), exec bumping the pidversion on this macOS, security-framework 3.7's |
…y the peer's audit token and code signature The daemon reads the peer's audit token (LOCAL_PEERTOKEN) when it accepts a connection, carries it with the connection, and checks the connecting program with SecCode against a Developer ID requirement for the NodeSpace team. An answer needs the signed app; approving a tool needs the signed app or the signed nodespace command. A development build refuses unsigned peers unless NODESPACE_DEV_ALLOW_UNSIGNED_PEER=1; a release build has no switch. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
d880fe5 to
e71a7c3
Compare
|
Follow-up: the two cases this PR couldn't run without a Developer ID identity (the signed app can still answer a confirmation, was #4365; a non-team program, an ad hoc copy and an orphaned descendant are refused on a signed install, was #4366) are now tracked in NodeSpace and assigned for checking on a signed v0.3.14 install. #4367 (the signed |
Refs #4327. Security-sensitive. The owner signed off agent-lane work for this batch and decided 2026-11-25 to build this with what exists here; what needs a signed build is split into new issues.
What changed
The per-call confirmation answer (
AnswerConfirmation) was gated only by the recorded-process peer gate, which admits orphaned descendants of recorded programs and agents the user started outside the app. Now, on macOS:peer_auth.rs: the daemon reads the peer's audit token (LOCAL_PEERTOKEN,getsockoptat levelSOL_LOCAL) at accept time, before anything is read from the peer, and carries it with the connection (PeerStream, tonicConnectedwith aPeerInfocarrying credentials and the token).peer_pidreads the same info.peer_signature.rs: asks the Security framework for the running code the token names (SecCodeCopyGuestWithAttributeswith the audit attribute, so a reused pid cannot match) and checks it against a designated requirement: Apple Developer ID chain, leaf OU = the NodeSpace team, identifier fixed per scope. Team id and identifier are validated before they enter a requirement string.AnswerConfirmationneeds the team-signed app (com.nodespace.desktop).ApproveToolneeds the team-signed app or the team-signednodespacecommand (identifiernodespace); the person at the screen still confirms. This check is in addition to the existing process gate.NODESPACE_DEV_ALLOW_UNSIGNED_PEER=1on the daemon to keep only the process gate (logged on each use). Release builds have no such switch (it is compiled underdebug_assertionsonly).Tests and mutation results
Real code paths, no signing needed: an Apple-signed peer (
/usr/bin/nc -U) is checked againstanchor apple(accepted) and the team requirement (refused), so the SecCode path is exercised end to end both ways; the unsigned test binary is refused; unknown token, no token and a bad requirement are refusals; socket tests drive the real accept stream, a gate that admits the peer and the realTeamSignedcheck (refused), and a recording check for scope and token.Mutation checks, each applied alone and reverted:
ApproveToolsignature check:a_peer_that_is_not_the_signed_app_cannot_approve_and_nobody_is_askedfailsa_peer_the_process_gate_admits_but_that_is_not_the_signed_app_cannot_answerandthe_answer_is_judged_with_the_connections_token_and_its_own_scopefailthe_answer_is_judged_with_the_connections_token_and_its_own_scopefailscheck_requirementignores a failed validity check: the Apple-peer and the unsigned-peer tests failtext_that_could_change_the_requirement_is_not_put_into_onefailsCommands run:
cargo test -p nodespace-daemon --lib(peer filters),cargo clippy -p nodespace-daemon --all-targets -- -D warnings,cargo fmt,bun run test:changed(passed).Not verified here
No Developer ID identity exists on the dev Mac, so the positive case for the team's own signature is not run. One issue per check, assigned to Michael:
com.nodespace.desktop)nodespacecommand can approve; its identifier isnodespace; a shadowing unsigned command is refusedThe team id in the requirement is the one the release workflow already signs with.
🤖 Generated with Claude Code