Skip to content

fix(e2e): mask default command output and registered secrets - #1910

Merged
skevetter merged 3 commits into
mainfrom
e2e-default-masking
Nov 25, 2026
Merged

skevetter merged 3 commits into
mainfrom
e2e-default-masking

Conversation

@skevetter

@skevetter skevetter commented Nov 25, 2026 •

Copy link
Copy Markdown
Contributor

No description provided.

@coderabbitai

coderabbitai Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

Explain Change →

Walkthrough

The E2E framework now registers secret values, masks them in command output, and can record them in a sentinel file. CI passes the file path to test suites, captures their output, and checks that output against the recorded values.

Changes: E2E Secret Redaction and Sentinel Validation

Layer / File(s) Summary
Register E2E secrets
e2e/framework/secret_registry.go, e2e/framework/sentinel_canary.go, e2e/framework/sentinel_canary_test.go, e2e/tests/ci/ci.go, e2e/tests/logs/setup_logs.go, e2e/tests/up-docker-compose/up_docker_compose.go, e2e/tests/up-features/up_features.go, e2e/tests/up/*
The framework adds a thread-safe secret registry that can append JSON-encoded values to a sentinel file. The canary and E2E fixtures register secrets before using them.
Capture and redact command output
e2e/framework/exec.go, e2e/framework/exec_capture_test.go, e2e/framework/exec_default_mask_test.go, e2e/framework/secret_registry_test.go, e2e/framework/ssh_agent.go
Command execution uses shared capture modes and includes registered secrets in redaction. Tests cover captured streams, live output, and registered-secret masking.
Forward and check sentinel records
hack/ci/e2e.go, hack/ci/sentinel.go, hack/ci/sentinel_test.go, hack/microsandbox/run.go, hack/microsandbox/sentinel_test.go
The CI CLI and MicroSandbox runner forward the sentinel-file path. The checker scans captured output for registered values and requires the canary record.
Enforce sentinel checks in CI
.github/workflows/pr-ci.yml
The unprivileged, MicroSandbox, and standard integration E2E steps capture output and run sentinel checks. Each step requires the test command, output capture, and check to succeed.

Estimated code review effort: 4 (Complex) | ~45 minutes

Change: Other

Sequence Diagram(s)

sequenceDiagram
  participant Actions as GitHub Actions
  participant E2ECLI as hack/ci e2eCLI
  participant Suite as E2E suite
  participant Register as framework.RegisterSecret
  participant SentinelFile as Sentinel file
  participant Checker as sentinel-check
  participant Log as Captured log
  Actions->>E2ECLI: Run suite with sentinel-file path
  E2ECLI->>Suite: Forward sentinel-file environment
  Suite->>Register: Register secret value
  Register->>SentinelFile: Append JSON-encoded value
  Suite-->>Log: Write captured test output
  Actions->>Checker: Check captured log and sentinel file
  Checker->>SentinelFile: Read sentinel records
  Checker->>Log: Scan output for recorded values
Loading

Possibly related PRs

  • devsy-org/devsy#1871: Changes the E2E diagnostic masking path used for subprocess output that this PR also updates.
Pre-merge checks: Passed 1 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Description check Warning The author left the pull request description empty. The repository template requires a What and why section, a linked issue line, a change type, an AI assistance disclosure, a testing section with the… Add a description that follows the repository template. Include: (1) a What and why section that starts with the problem, namely that e2e exec helpers leak raw command output and secrets into live logs; (2) a Fixes or Refs line for the rela…
Passed Passed checks: 1 passed

Check name Status Explanation
Title check Passed The title "fix(e2e): mask default command output and registered secrets" follows Conventional Commits and names the main change. The PR makes the e2e exec helpers mask live output by default and adds …
Full details: Title check

Explanation

The title "fix(e2e): mask default command output and registered secrets" follows Conventional Commits and names the main change. The PR makes the e2e exec helpers mask live output by default and adds a registry for secrets that the masker redacts. The title does not mention the sentinel-file check, which is a secondary part of the change, so it is not a full summary.

Full details: Description check

Explanation

The author left the pull request description empty. The repository template requires a What and why section, a linked issue line, a change type, an AI assistance disclosure, a testing section with the e2e test suite and run command, a verification section, and a checklist. None of these sections are filled in, so the description is largely incomplete.

Resolution

Add a description that follows the repository template. Include: (1) a What and why section that starts with the problem, namely that e2e exec helpers leak raw command output and secrets into live logs; (2) a Fixes or Refs line for the related issue, or "none"; (3) the change type, which is a bug fix; (4) the AI assistance disclosure with the tool, model, and share of change; (5) the testing section with the Ginkgo suites and spec names that cover the change, the run command, and the verification output; (6) the checklist items; and (7) notes for reviewers on the sentinel-file check, its single-line secret rule, and the risk that raw Gomega failure text can print expected literals.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@netlify

netlify Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for devsydev canceled.

Name Link
🔨 Latest commit 8bcae12
🔍 Latest deploy log https://app.netlify.com/projects/devsydev/deploys/6b06a4aec50a558694a86b01

@netlify

netlify Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for images-devsy-sh canceled.

Name Link
🔨 Latest commit 8bcae12
🔍 Latest deploy log https://app.netlify.com/projects/images-devsy-sh/deploys/6b06a4ae074c202c5ccd5bb1

@mergify

mergify Bot commented Nov 25, 2026 •

Copy link
Copy Markdown

This pull request is merged.

@skevetter skevetter left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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:

  1. 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-42 and the sentinel-* values appear 0 times. As a positive control, the Test up-provider-docker and Test ci logs of the last main run before this PR contain managed-value-99 (1 line), mounted-value-77 (2), env-value-55 (1) and managed-ci-42 (1). The specs did run on this head (50 passed in up-provider-docker, 24 in ci).
  2. Every exec helper masks live output. ExecCommandCapture, Output, Stdout, Containing, JSON and DiagnosticCapture all 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.
  3. The sentinel check fails on a leak. I extracted the workflow block verbatim and ran it under bash -e and bash --noprofile --norc -eo pipefail with 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 under sudo) and the Windows WSL job passed, so the path is forwarded there too.
  4. Workflow scope. The diff adds no permissions and no secrets. The sentinel file and e2e-output.log live in RUNNER_TEMP and match none of the upload-artifact paths. The sentinel file is created with umask 077.
  5. 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 in scanSentinels each fails a test.

Non-blocking:

  1. 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 \u00xx escape (the live masker handles that form, the check does not). A new secret that a spec forgets to pass to RegisterSecret is also not covered.
  2. The check scans only the tee'd stream. The MicroSandbox .json and .log artifacts (kept 14 days) and the Ginkgo JSON reports are not scanned.
  3. Mutating externalCommandDiagnostic or the ssh ControlMaster error redactor to drop Values: registeredSecretValues() leaves the suite green, so those two call sites have no test.
  4. Short registered values (for example s3cr3t) can mask unrelated output and, in the check, fail a job on an innocent substring. The RegisterSecret comment already says so.

@skevetter
skevetter merged commit 83e6d70 into main Nov 25, 2026
212 of 215 checks passed
@skevetter
skevetter deleted the e2e-default-masking branch November 25, 2026 10:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant