Skip to content

fix: Always restore process umask#3939

Merged
DrJosh9000 merged 1 commit into
mainfrom
fix-restore-umask-always
May 25, 2026
Merged

fix: Always restore process umask#3939
DrJosh9000 merged 1 commit into
mainfrom
fix-restore-umask-always

Conversation

@DrJosh9000
Copy link
Copy Markdown
Contributor

Description

Ensure the process umask is restored, even if there is a failure to listen on the socket.

Context

https://slopcannon.tail952194.ts.net/lachlan/deepsec-buildkite-agent/MEDIUM/agent-other-insecure-permissions-0da6fccd11.md

Changes

Add a deferred Umask(oldUmask) immediately after checking the error from the first umask.
Setting the same umask twice (defer + usual call after creating the socket) is fine.

Testing

  • Tests have run locally (with go test ./...). Buildkite employees may check this if the pipeline has run automatically.
  • Code is formatted (with go tool gofumpt -extra -w .)

Disclosures / Credits

The bug was found by deepsec, the fix is by me.

@DrJosh9000 DrJosh9000 requested a review from a team as a code owner May 21, 2026 06:30
@DrJosh9000 DrJosh9000 added the bug label May 21, 2026
@DrJosh9000 DrJosh9000 requested a review from a team as a code owner May 21, 2026 06:30
@DrJosh9000 DrJosh9000 enabled auto-merge May 21, 2026 06:33
@DrJosh9000 DrJosh9000 merged commit 494405c into main May 25, 2026
5 checks passed
@DrJosh9000 DrJosh9000 deleted the fix-restore-umask-always branch May 25, 2026 01:55
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.

2 participants