Repository navigation
fix(e2e): mask default command output and registered secrets - #1910
Conversation
Walkthrough
Pre-merge checks:
|
✅ Deploy Preview for devsydev canceled.
|
✅ Deploy Preview for images-devsy-sh canceled.
|
|
This pull request is merged. |
skevetter
left a comment
There was a problem hiding this comment.
Independent review at 8bcae12:
No blocking findings. CI is green on this head (the earlier Unit Tests (ubuntu-latest) failure was a data race in pkg/tunnel that this PR does not touch, and it passed on rerun).
Checked on scratch tests and mutations (all removed), go vet and go test -race on e2e/framework, hack/ci and hack/microsandbox, and the real CI job logs of this head:
- Cat checks masked. I downloaded the logs of all 78
Test ...jobs of the run and grepped for every literal this PR registers.managed-value-99,mounted-value-77,env-value-55,managed-ci-42,SUPER_SECRET_TEST_VALUE_7B91,setup-logs-secret-93817,test-value-12345,second-secret-42and thesentinel-*values appear 0 times. As a positive control, theTest up-provider-dockerandTest cilogs of the last main run before this PR containmanaged-value-99(1 line),mounted-value-77(2),env-value-55(1) andmanaged-ci-42(1). The specs did run on this head (50 passed inup-provider-docker, 24 inci). - Every exec helper masks live output.
ExecCommandCapture,Output,Stdout,Containing,JSONandDiagnosticCaptureall go through one path that masks stdout and stderr with the environment plus registered values, and they still return the raw captured bytes. No unmasked variant exists, so nothing needs a guard list. I ran each of the four main helpers against a child process printing a registered value as a plain line, on stderr, without a trailing newline, split across two writes, in JSON, in JSON with&"<escaped, with CRLF, inside ANSI colour codes, on a 300 KB line, behind a carriage-return progress update, and with the process killed mid-line. Nothing leaked in any case. - The sentinel check fails on a leak. I extracted the workflow block verbatim and ran it under
bash -eandbash --noprofile --norc -eo pipefailwith a fake CI tool. A clean run, a leak on stdout, a leak on stderr, a failed run and a missing canary end with exit 0, 1, 1, 1 and 1. A planted leak with no trailing newline, after CRLF, or wrapped in ANSI codes is found. A missing or empty sentinel file, or a missing output file, fails closed. The message names only the record index and line, never the value. 200 MB of log against 60 sentinels takes about 6 s. The canary proves the sentinel file was populated by the e2e process: the microsandbox jobs (which run undersudo) and the Windows WSL job passed, so the path is forwarded there too. - Workflow scope. The diff adds no permissions and no secrets. The sentinel file and
e2e-output.loglive inRUNNER_TEMPand match none of theupload-artifactpaths. The sentinel file is created withumask 077. - Mutations: dropping the registered values from the exec redactor, the canary requirement, the sentinel append, the dedupe, the sentinel env forwarding in
hack/ci, or the first-hit exit inscanSentinelseach fails a test.
Non-blocking:
- The sentinel check is an exact substring match on the raw registered value. Output containing the value base64-encoded, URL-encoded or case-changed passes both the live masker and the check, and so does a log JSON line where
&,"or<in the value is written as a\u00xxescape (the live masker handles that form, the check does not). A new secret that a spec forgets to pass toRegisterSecretis also not covered. - The check scans only the tee'd stream. The MicroSandbox
.jsonand.logartifacts (kept 14 days) and the Ginkgo JSON reports are not scanned. - Mutating
externalCommandDiagnosticor the ssh ControlMaster error redactor to dropValues: registeredSecretValues()leaves the suite green, so those two call sites have no test. - Short registered values (for example
s3cr3t) can mask unrelated output and, in the check, fail a job on an innocent substring. TheRegisterSecretcomment already says so.
No description provided.