Skip to content

[worker] mask secrets in the records written to worker stdout - #4782

Merged
hSATAC merged 1 commit into
mainfrom
ash/eng-28628-mask-secrets-in-eas-in-stdoutstderr-too
Oct 30, 2026
Merged

hSATAC merged 1 commit into
mainfrom
ash/eng-28628-mask-secrets-in-eas-in-stdoutstderr-too

Conversation

@hSATAC

@hSATAC hSATAC commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Why

The worker printed every build log record and its own job-error records to its stdout unmasked: the build logger was a child of the default logger and inherited bunyan's stdout stream. The uploaded log already went through the secrets filter; stdout did not.

Remaining part of #4634. Closes ENG-28628.

How

  • Move the job's mask list to module scope and give the default logger a masking stream to stdout.
  • Build the build logger with its own masking stream instead of defaultLogger.child(), with the uploads piped from it.
  • Serialize object fields even with no secret registered, so a circular field cannot stall the stdout stream.
  • Delete the ws.ts debug record that logged the whole launcher message, job.secrets included.

Test Plan

Added worker unit coverage for masked build and worker records on stdout, a stalled stdout not blocking the uploads, circular and deep values without secrets, and the copied log level. Also ran lint, format check, TypeScript checks, and the changeset validator.

@linear-code

linear-code Bot commented Oct 29, 2026

Copy link
Copy Markdown

ENG-28628

objectMode: true,
write(_chunk: any, _encoding: BufferEncoding, callback: (error?: Error | null) => void) {
write(chunk: any, _encoding: BufferEncoding, callback: (error?: Error | null) => void) {
process.stdout.write(`${JSON.stringify(chunk)}\n`);

@hSATAC hSATAC Oct 29, 2026 •

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.

Stdout now uses the same format as the uploaded logs: same logId, no hostname. Since stdout stays on the host, I kept the format consistent across all three outputs.

@codecov

codecov Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 75.99%. Comparing base (08c92bf) to head (31c2144).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4782      +/-   ##
==========================================
+ Coverage   75.96%   75.99%   +0.04%     
==========================================
  Files        1064     1064              
  Lines       52961    52979      +18     
  Branches    11590    11598       +8     
==========================================
+ Hits        40224    40254      +30     
+ Misses      11768    11758      -10     
+ Partials      969      967       -2     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@hSATAC
hSATAC force-pushed the ash/eng-28628-mask-secrets-in-eas-in-stdoutstderr-too branch from 615980e to 31c2144 Compare October 29, 2026 12:02
@github-actions

Copy link
Copy Markdown

✅ Thank you for adding a changeset!

@hSATAC
hSATAC marked this pull request as ready for review October 29, 2026 12:03
@hSATAC
hSATAC merged commit 243c8b8 into main Oct 30, 2026
11 checks passed
@hSATAC
hSATAC deleted the ash/eng-28628-mask-secrets-in-eas-in-stdoutstderr-too branch October 30, 2026 08:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants