Add setenv-guard lint check (Phase 2c, #1193) - #1206
Open
ptone wants to merge 2 commits into
Open
Conversation
added 2 commits
August 22, 2026 12:47
Phase 2c of the CI custom linter framework (#1193). Adds a formatting-grade lint script that flags `_ = os.Setenv(...)` where the environment variable name contains TOKEN, SECRET, KEY, or AUTH. Silencing the error return on a credential-bearing Setenv is a process-wide exposure risk — the value leaks into every child process and a failure to set the variable is never noticed. The 5 existing occurrences are allowlisted with comments. New occurrences will fail the build. Includes: - hack/check-setenv-guard.sh — the lint script - Makefile integration (check-setenv-guard target + check-custom dep) - CI workflow step in .github/workflows/ci.yml
Review R1: file-path-only allowlist entries would silently pass any future os.Setenv in the same file. Anchor each entry on the specific env var name so new sensitive Setenv calls are still caught. Grows allowlist from 4 entries to 5 (one per actual occurrence).
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.
Summary
Phase 2c of the CI custom linter framework (#1193). Adds a formatting-grade lint
script that flags
_ = os.Setenv(...)where the environment variable namecontains TOKEN, SECRET, KEY, or AUTH (case-insensitive).
check-setenv-guardtarget, wired intocheck-custom.github/workflows/ci.ymlAll 5 existing occurrences are allowlisted.
make cipasses clean.Refs #1193
Test plan
./hack/check-setenv-guard.shexits 0 (all 5 known uses allowlisted)make check-setenv-guardpassesmake check-custompasses (includes this new check)make cipasses