Repository navigation
server: keep a child's environment out of the descriptor tests' failure messages - #94
Merged
Merged
Conversation
…re messages The gateway's descriptor tests have each child report its descriptors and then its environment, and their failure messages printed the whole report. A child's environment is the test process's own, so a failing test printed whatever credentials the run was started with into its log. Each report now prints an `env:` line before the environment, always last, and failure messages print a report only up to that line (`before_environment`). `ChildReport`'s `Debug` leaves the environment out; the checks that the secret never reaches a child still read the whole report. The reporting worker prints how many bytes its carrier holds before its environment rather than after it, so its messages keep that line; it still reads the carrier after listing its descriptors. The U4 probe prints the same `env:` line, and its messages stop there too. A new test checks a report's `Debug` and `before_environment` against a variable that only the environment holds, with `\n` and with a PTY's `\r\n`, and that the real script prints such a variable only after its `env:` line. Test code only. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
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.
Issue
No issue. While #93 was validated on the owner's Mac, one descriptor test failed once, and its failure message printed the child's whole environment into a local, git-ignored validation log. That environment is the test process's own, so it carries whatever credentials the run was started with. Nothing was pushed. This change keeps the environment out of every such message.
mainat3d051fa(#93's merge)6481e77, one commit6b9826e3with its recorded patch, and DevGuard source6e7e065, both unchangedSummary
What this guarantees. When a descriptor test of the gateway fails, its message does not contain a child's environment.
env:line and then the environment, always last. Failure messages print a report only up to that line (before_environment).ChildReport'sDebuglists descriptors and sockets and leaves the environment out. The checks that the secret never reaches a child still read the whole report, environment included.mcp.rsprints the sameenv:line, and its messages stop there too.devguard::tests::failure_messages_leave_a_childs_environment_out: with\nand with a PTY's\r\n, neither a report'sDebugnorbefore_environmentshows a variable that only the environment holds, and the real report script prints such a variable only after itsenv:line.Contract changes
None. Test code only.
Tests
PATHandHOME:cargo fmt --check.cargo clippy --locked -p codespace-server --features devguard --all-targets -- -D warnings.a_started_worker_gets_its_settings_and_one_descriptor_never_the_secretanda_worker_whose_credential_cannot_be_used_gets_no_descriptor: 3 passed.cargo test -p codespace-server --features devguard --lib -- devguard: 37 passed, 5 ignored (the ignored ones are run by their parent tests in a separate process). The tests that need DevGuard's binaries return early here without them; CI's integration and macOS jobs build the binaries and run them.6481e77: CI run 38184571640 passed: plan, format and pin, policy scan, clippy (root), integration, and macOS contracts. The plan skipped the unit and Linux isolation jobs, which do not build the gateway crate. Documentation site run 38184571985 passed.Security scenarios
Out of scope
macos-corefailure seen once in codex, scripts, docs: carry the PTY pre-reap observer as a recorded patch on the pinned release #93's validation (one of 40 worker children listed descriptor 10); it has not reproduced.