Skip to content

test(connectivity): isolate all checker env vars in TestDetectProxyConfig - #676

Open
rrama wants to merge 1 commit into
mainfrom
fix/proxy-config-test-env-isolation
Open

test(connectivity): isolate all checker env vars in TestDetectProxyConfig#676
rrama wants to merge 1 commit into
mainfrom
fix/proxy-config-test-env-isolation

Conversation

@rrama

@rrama rrama commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Description

TestDetectProxyConfig clears the environment before each subtest, but only the proxy variables:

proxyEnvVars := []string{"HTTPS_PROXY", "https_proxy", "HTTP_PROXY", "http_proxy", "NO_PROXY", "no_proxy"}

DetectProxyConfig iterates envVarSpecs, which also covers NODE_EXTRA_CA_CERTS, KRB5_CONFIG and KRB5CCNAME. Those three were never cleared, so the host machine's environment leaked into the result.

On any machine with NODE_EXTRA_CA_CERTS set — a corporate TLS-inspection CA bundle, for instance — six of the seven subtests fail:

Error: Not equal:
       expected: ""
       actual  : "/Users/…/zscaler-ca-bundle.pem"
Messages: NodeExtraCACerts mismatch

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 envVarSpecs itself, 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).

Checklist

  • Tests added and all succeed (make test) — connectivity_check_extension/... passes with NODE_EXTRA_CA_CERTS still set in my shell, which reproduced the failure before this change
  • Regenerated mocks, etc. (make generate) — n/a
  • Linted (make lint) — 0 issues
  • Test your changes work for the CLI — n/a, test-only change; no shipped code or public API touched

Made with Cursor

…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-io

snyk-io Bot commented Jul 30, 2026

Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@snyk-io

snyk-io Bot commented Jul 30, 2026

Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues
Secrets 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@rrama
rrama marked this pull request as ready for review August 3, 2026 10:08
@rrama
rrama requested review from a team as code owners August 3, 2026 10:08
@snyk-pr-review-bot

Copy link
Copy Markdown

PR Reviewer Guide 🔍

🧪 PR contains tests
🔒 No security concerns identified
⚡ No major issues detected
📚 Repository Context Analyzed

This review considered 5 relevant code sections from 5 files (average relevance: 0.81)

🤖 Repository instructions applied (from AGENTS.md)

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.

1 participant