fix(tool-sandbox): drop trailing newline from captured credential phantoms - #1475
Merged
lukehinds merged 2 commits intoJul 22, 2026
Merged
Conversation
Contributor
PR Review SummarySize
Affected crates
Blast radius — ContainedThis PR touches: source code Updated automatically on each push to this PR. |
…ntoms Signed-off-by: James Carnegie <me@kipz.org>
kipz
force-pushed
the
kipz/fix-phantom-trailing-newline
branch
from
July 21, 2026 14:21
c12be9f to
8200de7
Compare
kipz
marked this pull request as ready for review
July 21, 2026 15:06
kipz
added a commit
to kipz/nono
that referenced
this pull request
Jul 21, 2026
…m captured credential phantoms
kipz
added a commit
to kipz/nono
that referenced
this pull request
Jul 21, 2026
…m captured credential phantoms
lukehinds
approved these changes
Jul 22, 2026
1 task
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Linked Issue
Closes #1472
Summary
nonce_stdout()(macOS and Linux tool-sandbox platform code) unconditionally appends a trailing\nto everycapture_credentialphantom before writing it to stdout. Any consumer that captures raw stdout bytes without trimming (e.g. Go'sexec.Command().Output()) receives that extra byte as part of the credential value — which breaks it if the value is later placed in an HTTP header.Real credential-fetching CLIs are inconsistent about a trailing newline —
gh auth token, for instance, includes one, while other tools deliberately omit it precisely because their output is meant to be captured raw.capture_credentialstands in for whichever specific command a profile intercepts, and nono has no way of knowing which convention that command follows. Unconditionally adding a byte is therefore unsafe in general: it's a no-op for callers that already trim, and a silent corruption for callers that don't, whenever the real command happens to be one of the many that omit it.normalize_captured_credentialalready reflects this on the inbound side, trimming a trailing newline off whatever the real command produced before storing it — this PR makes the outbound phantom follow the same principle: return exactly what was generated, nothing appended.Agent Disclosure
This PR was written by an AI coding agent (Claude Code) on behalf of the reporter, who reviewed and approved the change, the issue, and this PR description before submission.
Files consulted:
crates/nono-cli/src/tool-sandbox/platform/macos.rsandcrates/nono-cli/src/tool-sandbox/platform/linux.rs(bothnonce_stdout()implementations, identical in shape).Test Plan
nonce_stdout_appends_no_trailing_newline(macOS and Linux) asserting the returned bytes equal the input phantom exactlymake fmt&&make ci— clean (clippy-D warnings, fmt-check, full test suite,cargo audit, alias inventory, doc lint)capture_credentialintercept onecho:0a. After this change: 69 bytes (nono_+ 64 hex chars), no trailing newline.Checklist
CHANGELOG.mdif neededAgent Compliance Check