Skip to content

About

One-command static health check for proxy environment variables and config files — zero network, zero dependencies.

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

proxycheckup

One-command static health check for proxy environment variables and config files — zero network, zero dependencies.

CI tests node dependencies license

English | 简体中文

proxycheckup looks at the proxy configuration your shell and your project already carry — environment variables (HTTP_PROXY, HTTPS_PROXY, ALL_PROXY, NO_PROXY, any case), .npmrc and .git/config — and reports what disagrees with what. It is a static checker: it never opens a socket, never runs git, and never reads anything outside the paths you point it at.

Why

Proxy misconfiguration rarely fails loudly. It fails quietly: HTTP_PROXY and http_proxy set to different endpoints, a proxy URL missing its scheme, an https:// prefix on an endpoint that does not serve TLS, .npmrc and the environment pointing at different proxies, a NO_PROXY entry that tools silently ignore, or a Node version whose built-in fetch simply does not read proxy variables. proxycheckup surfaces all of that in one offline command, as a pass/warn/fail checklist.

How the usual alternatives line up for proxy configuration specifically:

What it looks at Works offline Cross-file conflicts NO_PROXY semantics Fix per finding
proxycheckup proxy env vars, .npmrc, .git/config, Node fetch behavior ✔ ✔ ✔ (--host simulation) ✔ every finding carries a fix
Manual inspection (env | grep -i proxy, cat .npmrc, git config --get http.proxy) everything — by eye ✔ by hand by hand —
npm config list / npm doctor npm's effective config only; doctor also probes the registry doctor needs network ✘ (npm's view only) ✘ ✘
curl -v <url> one live request through the configured proxy needs network ✘ (tests one request, not the configuration) applies the rules, does not audit them ✘
dotenv-linter .env file syntax ✔ ✘ (.env only) ✘ subset auto-fixable

This table describes each tool's scope as its own project documents it; it is for orientation, not a ranking.

Install

# run once, without installing:
npx proxycheckup

or install globally, or run straight from a checkout:

npm install -g proxycheckup   # adds a `proxycheckup` command
node bin/proxycheckup.js      # from a git checkout

Requires Node >= 18.17. Zero dependencies — npx does not download anything beyond the package itself.

Usage

proxycheckup [options]
Option Description
--help, -h Show usage and exit.
--version Print the version and exit.
--json Emit a stable, machine-readable JSON report.
--host <hostname> Simulate NO_PROXY matching for this hostname and explain the result.
--node-version <x.y.z> Evaluate Node's built-in fetch proxy behavior as if running this version (default: the running version).
--config <path> Inspect this directory (its .npmrc and .git/config) or an explicit .npmrc file, instead of the current directory.

Exit codes

Code Meaning
0 No fail-level findings (warnings are allowed).
1 At least one fail-level finding.
2 Usage error (unknown option, missing value, invalid --node-version).

That makes the command safe to wire into CI or a pre-commit hook:

proxycheckup --json || echo "proxy configuration has fail-level findings"

Example output

Real run, abridged with …. The project has .npmrc with proxy=http://proxy.corp.example:3128 and .git/config with http.proxy = socks5://gate.example.internal:1080, and the shell exports HTTP_PROXY=http://proxy.corp.example:3128, http_proxy=http://other.corp.example:8080, HTTPS_PROXY=proxy.corp.example:3128, NO_PROXY=localhost, .internal.example.com, *.oops.example.com:

$ proxycheckup
proxycheckup v0.1.0 — static health check for proxy configuration (no network requests made)

Node: v24.14.1 — built-in fetch can honor HTTP(S)_PROXY/NO_PROXY (opt in with NODE_USE_ENV_PROXY=1)

Scanned files:
  .npmrc: /tmp/demo-project/.npmrc
  .git/config: /tmp/demo-project/.git/config

Checks:
  ✘ fail  env.case-mismatch — HTTP_PROXY/http_proxy: the same variable is written twice with different values (HTTP_PROXY="http://proxy.corp.example:3128" vs http_proxy="http://other.corp.example:8080"); tools pick different variants, so behavior is unpredictable.
      fix: Keep only one case variant, or set every variant to the same value.
  ✔ pass  env.empty-value — no proxy env var is set to an empty (or whitespace-only) value
  ✘ fail  env.missing-scheme — HTTPS_PROXY is set to "proxy.corp.example:3128" without a URL scheme; some tools assume http://, others reject the value outright.
      fix: Use a full URL, e.g. http://proxy.corp.example:3128.
  ⚠ warn  noproxy.invalid-entry — NO_PROXY entry "*.oops.example.com" is not a valid host matcher: a wildcard is only allowed as the standalone entry "*". Tools usually ignore such entries, so traffic may bypass the proxy unexpectedly.
      fix: Fix or remove "*.oops.example.com" — valid forms are "*", "host", ".host" and "host:port".
  ⚠ warn  npmrc.env-mismatch — .npmrc proxy ("http://proxy.corp.example:3128") disagrees with http_proxy ("http://other.corp.example:8080"); npm will use the .npmrc value while other tools follow the environment.
      fix: Make both sides identical, or remove the side you do not want.
  ⚠ warn  gitconfig.npmrc-mismatch — git http.proxy ("socks5://gate.example.internal:1080") disagrees with .npmrc proxy ("http://proxy.corp.example:3128").
      fix: Use the same proxy endpoint in both files.
  …
  ✔ pass  node.fetch-proxy — Node v24.14.1 can honor HTTP(S)_PROXY/NO_PROXY in built-in fetch (NODE_USE_ENV_PROXY=1 enables it on v22.21.0+ and v24+; NO_PROXY is respected when enabled)

Summary: 9 pass, 5 warn, 2 fail

--host explains why a given host does or does not bypass the proxy (rules taken from the effective NO_PROXY, or from .npmrc noproxy when the shell has none):

$ proxycheckup --host sub.internal.example.com
NO_PROXY simulation for "sub.internal.example.com" (rules from NO_PROXY):
  rules:
    - localhost
    - .internal.example.com
  result: MATCH — suffix match: "sub.internal.example.com" ends with ".internal.example.com"
  traffic: this host bypasses the proxy

Summary: 13 pass, 2 warn, 0 fail

The full option reference is one command away:

$ proxycheckup --help
proxycheckup v0.1.0 — one-command static health check for proxy configuration.
Zero network requests, zero dependencies.

Usage:
  proxycheckup [options]

Options:
  --help                  Show this help and exit.
  --version               Print the version and exit.
  --json                  Emit a stable, machine-readable JSON report.
  --host <hostname>       Simulate NO_PROXY matching for this hostname and explain the result.
  --node-version <x.y.z>  Evaluate Node's fetch proxy behavior as if running this version
                          (default: the running process.version).
  --config <path>         Inspect this directory (its .npmrc and .git/config) or an explicit
                          .npmrc file, instead of the current directory.

What is checked:
  - proxy env vars (HTTP_PROXY/HTTPS_PROXY/ALL_PROXY/NO_PROXY, any case): conflicting
    case variants, empty values, missing URL scheme, https:// misuse on the proxy
    endpoint, ALL_PROXY disagreements, SOCKS endpoints on HTTP(S)_PROXY
  - NO_PROXY syntax plus per-host suffix-match simulation via --host
  - .npmrc proxy / https-proxy / noproxy vs the environment
  - .git/config [http] proxy vs .npmrc and the environment
  - Node version: when built-in fetch honors proxy env vars (v22.21.0+ or v24+, nodejs/node#57165)

Exit codes:
  0  no fail-level findings
  1  at least one fail-level finding
  2  usage error (unknown option, missing value, invalid --node-version)

Examples:
  proxycheckup
  proxycheckup --json
  proxycheckup --host build.internal.example.com
  proxycheckup --node-version 20.19.0 --config ./fixtures/project

What it scans

Four surfaces, nothing else:

  1. Proxy environment variables — HTTP_PROXY/HTTPS_PROXY/ALL_PROXY/NO_PROXY in any case variant, including conflicting double-writes.
  2. .npmrc — only the proxy, https-proxy and noproxy keys (plus ${VAR} placeholders in them; inline #/; comments are stripped like npm does).
  3. .git/config — only [http] proxy (per-URL [http "…"] overrides are tracked but excluded; inline comments are stripped like git does).
  4. The Node version — when built-in fetch can honor proxy env vars.

Paths default to ./.npmrc and ./.git/config; --config points somewhere else. Your home directory is never read.

What it checks

Environment variables

  • HTTP_PROXY/http_proxy (same for HTTPS_PROXY, ALL_PROXY, NO_PROXY) written twice with different values → fail
  • Variables set to an empty string → warn
  • Proxy URL without a scheme (proxy.corp.example:3128) → fail
  • Proxy URL that does not parse at all → fail
  • https:// prefix on the proxy endpoint — the scheme on a proxy variable describes how to reach the proxy, not which traffic to proxy → warn
  • ALL_PROXY disagreeing with HTTP_PROXY/HTTPS_PROXY → warn
  • SOCKS endpoints on HTTP(S)_PROXY → warn

NO_PROXY

  • Per-entry syntax audit: *, host, .host, host:port, comma/whitespace separated. Invalid entries are usually ignored by tools, which is exactly the danger → warn
  • --host a.example.com simulates which rule would match and explains the suffix semantics: example.com matches a.example.com (dot boundary), but never badexample.com.

Cross-file consistency

  • .npmrc proxy / https-proxy / noproxy vs the environment: value mismatches and drift (one side set, the other not) → warn
  • .git/config [http] proxy vs .npmrc and vs the environment → warn
  • Scope note: per-URL overrides — keys under [http "https://…"] headers — are scoped settings, not global ones (verified against git: plain git config --get http.proxy resolves to the global value). proxycheckup compares the global [http] proxy only; per-URL keys are parsed into an overrides list and never trigger findings.

Node version behavior

  • Below the support boundary, the built-in fetch ignores HTTP(S)_PROXY/NO_PROXY → warn. Proxy-env support for fetch exists from Node v22.21.0 (the v22 'Jod' LTS backport of nodejs/node#57165, released 2025-10-20) and from Node v24.0.0 (where the PR landed after being merged on 2025-03-20); the v23.x line and older lines never carried it.
  • The suggested fix for those versions: upgrade to Node >= 22.21.0 (or >= 24) and set NODE_USE_ENV_PROXY=1, or configure an explicit proxy agent.
  • At or above the boundary: reported as a pass. The check is a pure version comparison; --node-version overrides the running version.

JSON report

--json prints a single JSON document with stable, deterministically ordered fields. Excerpt of a real run (some checks rows omitted):

{
  "tool": "proxycheckup",
  "version": "0.1.0",
  "node": { "version": "v24.14.1", "fetchProxyEnv": "supported" },
  "configFiles": {
    "npmrc": { "path": "/tmp/demo-project/.npmrc", "found": true },
    "gitconfig": { "path": "/tmp/demo-project/.git/config", "found": true }
  },
  "noProxy": { "source": "none", "raw": null, "entries": [] },
  "host": null,
  "checks": [
    {
      "id": "env.missing-scheme",
      "severity": "fail",
      "message": "HTTPS_PROXY is set to \"proxy.corp.example:3128\" without a URL scheme; some tools assume http://, others reject the value outright.",
      "fix": "Use a full URL, e.g. http://proxy.corp.example:3128."
    }
  ],
  "summary": { "pass": 11, "warn": 3, "fail": 1, "exitCode": 1 }
}
  • checks covers every check id — at least one row per id, pass rows included — but a single id can appear on more than one row when several variables or pairs trigger it (for example, one env.missing-scheme row per affected proxy variable). Consumers looking for problems should iterate findings rather than index checks by id; findings contains only warn and fail rows. Rows are shaped { id, severity, message, fix }.
  • host is null unless --host was given; then it carries the matched rule and a human-readable reason.
  • noProxy.entries is the parsed rule table (raw, validity, wildcard, host, port).

Privacy and safety

  • Zero dependencies; Node standard library only.
  • No network access of any kind — everything is static analysis.
  • Only reads the two config paths you point it at (default ./.npmrc and ./.git/config); your home directory is never touched.
  • Never runs git or any other subprocess.
  • The report only echoes proxy-related keys — npmrc auth tokens and similar values are parsed for structure and then ignored.

Development

npm test   # runs `node --test`, fully offline

The test suite is built entirely from synthetic fixtures: env dictionaries, config file strings, and temporary directories created with fs.mkdtemp. It never reads your real user directory and never touches the network.

$ npm test
…
ℹ tests 92
ℹ suites 0
ℹ pass 92
ℹ fail 0
ℹ cancelled 0
ℹ skipped 0
ℹ todo 0
ℹ duration_ms 454

See CONTRIBUTING.md for the project layout, design constraints and how to add a check.

Roadmap

  • Opt-in scanning of user-level ~/.npmrc / ~/.gitconfig (currently project-local only, by design)
  • --host accepting several hostnames in one run
  • A strictness mode so warning-level findings can fail CI (ESLint's --max-warnings style)
  • Fix hints that name the exact file/line to change
  • Report text in additional languages

Nothing here is a promise — ideas are tracked, not scheduled. Working on one? Open an issue first.

License

MIT — Copyright © 2026 Jerry Lee (ecoreal).

About

One-command static health check for proxy environment variables and config files — zero network, zero dependencies.

Topics

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages