test(connectivity): isolate all checker env vars in TestDetectProxyConfig - #676
Merged
Merged
Conversation
…nfig TestDetectProxyConfig cleared only the proxy variables (HTTPS_PROXY, NO_PROXY and friends) before each case. DetectProxyConfig also reads NODE_EXTRA_CA_CERTS, KRB5_CONFIG and KRB5CCNAME, so those leaked in from the host environment. Any developer with NODE_EXTRA_CA_CERTS set (a corporate TLS-inspection CA bundle, for example) fails six of the seven subtests with a diff between "" and their own certificate path. Unsetting the variable makes the same suite pass, which is a confusing way to find out the test was never isolated. Derive the cleared list from envVarSpecs, the same list the production code iterates, so variables added there are isolated automatically instead of silently reintroducing this. Co-authored-by: Cursor <cursoragent@cursor.com>
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
rrama
marked this pull request as ready for review
August 3, 2026 10:08
This comment has been minimized.
This comment has been minimized.
basti-snyk
approved these changes
Aug 21, 2026
…y-config-test-env-isolation Resolves a conflict in checker_test.go: main independently fixed the same TestDetectProxyConfig env-var leak (PR #692) via a hardcoded envVarsToClean list, flagged in its own comment as needing manual sync with envVarSpecs. Kept this branch's derive-from-envVarSpecs loop instead, which removes that sync-drift risk entirely, while preserving main's new "Node and Kerberos env vars set" test case.
PR Reviewer Guide 🔍
|
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.
Description
TestDetectProxyConfigcleared the environment before each subtest, but only the proxy variables:DetectProxyConfigiteratesenvVarSpecs, which also coversNODE_EXTRA_CA_CERTS,KRB5_CONFIGandKRB5CCNAME. Those three were never cleared, so the host machine's environment leaked into the result.On any machine with
NODE_EXTRA_CA_CERTSset — a corporate TLS-inspection CA bundle, for instance — six of the seven subtests fail:Unsetting the variable makes the same suite pass untouched, which is a confusing way to discover the test was never isolated. CI does not set these variables, which is why this has gone unnoticed.
The cleared list is now derived from
envVarSpecsitself, so a variable added to the production spec is isolated automatically rather than quietly reintroducing this. It also removes the duplicated list of variable names.Found while running the full suite to validate an unrelated change (#673).
Update after merging
main: while this branch was open,mainindependently picked up the same isolation bug via an unrelated PR (#692) and fixed it too — with a hardcodedenvVarsToCleanlist whose own comment flags it as needing manual sync withenvVarSpecs. So the original failure this PR reported no longer reproduces onmain. What this PR still adds: replacing that hardcoded, manually-synced list with theenvVarSpecs-derived loop, so the sync-drift riskmain's own comment calls out can't recur. Mergedmainin; the merge commit resolves the conflict between the two approaches by keeping this loop andmain's newer "Node and Kerberos env vars set" test case.Checklist
make test) —connectivity_check_extension/...passes withNODE_EXTRA_CA_CERTSstill set in my shell, which reproduced the failure before this changemake generate) — n/amake lint) — 0 issuesMade with Cursor