Skip to content

feat(installer): preflight network profile — proxy + TLS-inspection read (#582) - #590

Merged
shujaatTracebloc merged 4 commits into
developfrom
fix/582-network-probe
Aug 4, 2026
Merged

feat(installer): preflight network profile — proxy + TLS-inspection read (#582)#590
shujaatTracebloc merged 4 commits into
developfrom
fix/582-network-probe

Conversation

@shujaatTracebloc

@shujaatTraceblocshujaatTracebloc commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

What & why

Closes#582 (child 1/4 of #578, network resilience — ships independently).

On a restricted/corporate network the installer dove straight into the long work and
only failed minutes in, with no up-front sense of what the network allows. This adds a
fast, bounded, non-fatal preflight network probe that runs before the endpoint
checks and prints a plain-language "network profile" line, so the user sees what's
happening instead of dying later.

What it detects (and prints)

Runs at the start of the connectivity check; a plain direct connection stays silent
(the reachability lines already confirm egress). When noteworthy, one line, e.g.:

Network: corporate proxy detected (proxy.corp:8080); TLS inspection detected; your company's certificate is configured.

  • Explicit proxy from the environment (HTTPS preferred) — announced as a bare
    host:port with any user:pass credentials stripped (PII-free, per Installer must never expose tracebloc internals or user PII in logs/output #576).
  • Configured corporate CA bundle (TRACEBLOC_CA_BUNDLE / CURL_CA_BUNDLE).
  • TLS inspection, affirmatively (best-effort): reads the issuer of the cert served
    for a well-known public host (through the proxy when one is set); a non-public issuer
    means a corporate CA is re-signing TLS. This catches inspection even when it's
    working (CA trusted) — the case the existing tls-failure path never surfaces.

Bounded / never hangs / never fatal

  • bash: needs openssland a timeout tool (timeout/gtimeout), else returns
    unknown — we never run an unbounded openssl s_client a blackholed :443 could hang.
  • PowerShell: .NET HttpWebRequest with an 8s timeout and a scoped, restored
    server-certificate-validation callback (captures the issuer, then reverts).
  • The probe only informs; the existing break-and-inspect hint keeps owning the
    actionable CA fix guidance.

Cross-platform, one-to-one

preflight.sh (_pf_network_profile + _pf_env_proxy / _pf_env_ca_bundle /
_pf_issuer_is_public / _pf_detect_tls_inspection) ↔ install-k8s.ps1
(Show-NetworkProfile + Get-EnvProxy / Get-EnvCaBundle / Test-IssuerIsPublic /
Get-TlsInspectionState) with identical copy.

Tests

  • bash: 9 bats — credential stripping, HTTPS precedence, CA detection, issuer
    classification (public vs corporate), the silent-direct path, the noteworthy line, and
    the unknown-when-openssl-absent (never-hangs) guard.
  • PowerShell: 7 Pester — the same behaviours.
  • Full Pester 427/0/9 (incl. the installer(ps1): cosign bootstrap is silent for minutes — looks frozen; users kill it #468 non-ASCII string-literal hygiene guard);
    preflight.bats 118/0; manifest --check, check-facts, check-style all clean.
    (preflight.sh + install-k8s.ps1 are manifested — manifest.sha256 regenerated.)

Notes


Note

Low Risk
Installer-only informational preflight; bounded probes with credential handling tested; does not change cluster install or auth paths.

Overview
Adds a non-fatal, bounded network profile step at the start of installer preflight connectivity checks (bash preflight.sh and PowerShell install-k8s.ps1), before endpoint probes.

When the environment is noteworthy, users see one plain-language line (proxy as stripped host:port, optional corporate CA bundle path, and best-effort TLS inspection via issuer heuristics on github.com). Plain direct connections stay silent. Proxy credentials are stripped from output/logs but retained for probe connections (authenticated proxies, openssl env: password on bash).

Exports state for later reuse (PF_NET_* / $script:Net*). Includes bats/Pester coverage and updated manifest.sha256.

Reviewed by Cursor Bugbot for commit a5b2d5b. Bugbot is set up for automated code reviews on this repo. Configure here.

…ead (#582)
Child 1/4 of #578. On a restricted/corporate network the installer dove straight
into the long work and only failed minutes in, with no up-front sense of what the
network allows. Add a fast, bounded, non-fatal network probe that runs BEFORE the
endpoint checks and prints a plain-language "network profile" line:
- Explicit proxy detected from the environment (HTTPS preferred), announced as a
bare host:port with any user:pass credentials stripped (PII-free, #576).
- A configured corporate CA bundle (TRACEBLOC_CA_BUNDLE / CURL_CA_BUNDLE) announced.
- TLS inspection detected affirmatively (best-effort): read the issuer of the cert
served for a well-known public host (through the proxy when set); a non-public
issuer means a corporate CA is re-signing TLS. Bounded and non-hanging — bash
needs openssl + a timeout tool (else "unknown"); PowerShell uses .NET with an 8s
timeout and a scoped, restored cert-validation callback.
A plain direct connection stays silent (the reachability lines already confirm
egress). The existing break-and-inspect hint keeps owning the actionable CA fix.
Cross-platform with one-to-one copy (preflight.sh _pf_network_* / install-k8s.ps1
Show-NetworkProfile). preflight.sh + install-k8s.ps1 are manifested; manifest
regenerated. Tests: 9 bats + 7 Pester covering credential stripping, proxy
precedence, issuer classification, the silent-direct path, and the noteworthy line.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@shujaatTraceblocshujaatTracebloc self-assigned this Aug 4, 2026
@shujaatTracebloc
shujaatTracebloc marked this pull request as ready for review August 4, 2026 13:30
# Conflicts:
#	scripts/manifest.sha256
#	scripts/tests/install-k8s.Tests.ps1
Comment threadscripts/install-k8s.ps1 Outdated
…cated proxy (#582)
Bugbot (Medium): the network profile stripped proxy credentials for DISPLAY (correct,
PII-safe) but reused that stripped host:port for the probe's own CONNECTION. On an
authenticated corporate proxy the HEAD/CONNECT then 407s, issuer capture fails, and the
profile returns "unknown" — so inspection is never reported on the exact TLS-inspecting
networks the probe exists to detect.
Connect with the real credentials; keep display stripped:
- preflight.sh: add _pf_env_proxy_raw (verbatim env value). _pf_detect_tls_inspection
passes -proxy host:port plus -proxy_user/-proxy_pass (openssl >= 3.0) when the proxy
carries credentials. _pf_env_proxy / the profile line stay credential-stripped.
- install-k8s.ps1: add Get-EnvProxyRaw. Get-TlsInspectionState builds the WebProxy from
the raw URL and sets WebProxy.Credentials (NetworkCredential) when UserInfo is present;
Show-NetworkProfile still uses the stripped Get-EnvProxy for the printed line.
Credentials reach openssl / the WebProxy only — never printed or logged. Tests: bash +
Pester assert the raw helper preserves creds while display strips, that the openssl
CONNECT carries -proxy_user on an auth proxy (with the password absent from the result),
and that the probe uses the credentialed proxy while the display path does not.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

@cursorcursorBot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 4 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 975516c. Configure here.

Comment threadscripts/lib/preflight.sh Outdated
Comment threadscripts/lib/preflight.sh Outdated
Comment threadscripts/lib/preflight.sh Outdated
Comment threadscripts/lib/preflight.sh Outdated
Four Bugbot follow-ups on the bash credential-passing added last commit:
- [High] Password no longer sits in openssl argv (visible via ps / /proc/*/cmdline):
pass it via env: — openssl reads $_TB_PROXY_PASS, exported ONLY inside the probe's
command-substitution subshell, so it never reaches argv or the parent shell.
- [Med] The issuer pipeline is guarded with `|| issuer=""`, so a failed/timed-out
probe returns "unknown" instead of aborting _pf_detect_tls_inspection under
`set -euo pipefail` (mirrors _pf_probe_url). The bats setup now stubs the probe by
default (like _pf_probe_url) so connectivity tests never hit the real github.com;
the real-probe tests source preflight.sh fresh in a subshell.
- [Med] Username-only proxies (http://user@host, no password) no longer reuse the
username as the password — split on ':' only when present.
- [Med] Proxy credentials are URL-decoded (_pf_urldecode) before use, matching the
PowerShell peer's Uri.UnescapeDataString, so %-encoded secrets authenticate the
same on Linux and Windows.
Tests: url-decode parity, env:-not-argv (password absent from openssl argv),
username-only-not-reused, and the openssl-absent "unknown" guard — all sourcing the
real probe in a hermetic subshell.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@shujaatTracebloc
shujaatTracebloc merged commit 4723f48 into developAug 4, 2026
46 checks passed
@shujaatTracebloc
shujaatTracebloc deleted the fix/582-network-probe branch August 4, 2026 14:20
LukasWodka added a commit that referenced this pull request Aug 4, 2026
Re-resolves the recurring install-k8s.ps1 + manifest conflict; re-applies the two
-Encoding UTF8 log-writer edits on develop's tip and regenerates the R8 manifest.
LukasWodka added a commit that referenced this pull request Aug 5, 2026
…#589) (#600)
Bugbot on the staging mirror flagged 4 issues in the corporate-proxy / TLS-
inspection probe (from #590/#582):
- HIGH: the TLS probe cleared an already-captured issuer via `|| issuer=""`;
openssl s_client often exits non-zero (SIGPIPE after x509) even on a good
handshake, so MITM networks read as 'unknown'. Use `|| true` (empty capture is
still caught below).
- proxy password url-decode ran the whole string through printf '%b', mangling
literal backslashes; escape them first so only percent-escapes expand (PS parity).
- `openssl -help | grep -q` under pipefail dropped -proxy_user on authenticated
proxies (grep -q closes the pipe, openssl gets SIGPIPE); capture then match.
- PS Get-TlsInspectionState: [System.Uri] rejected schemeless proxy.corp:8080;
prepend a scheme like the display path already does.
Regenerated the R8 manifest for the install-k8s.ps1 change.
Sign up for freeto 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.

Network resilience (1/4): preflight network probe + plain-language network profile

3 participants

@shujaatTracebloc@saadqbal@LukasWodka