Skip to content

fix(installer): failure report names the host and IP family of a failed request; step startup, not init - #1722

Closed
nc9 wants to merge 2 commits into
mainfrom
fix/installer-host-ip-family-1681
Closed

nc9 wants to merge 2 commits into
mainfrom
fix/installer-host-ip-family-1681

Conversation

@nc9

@nc9 nc9 commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

Part of #1681 (the install.sh side; the worker rate limit and a stable Sentry user key are a later private slice).

What

A failure report from install.sh (report version 4) now names where a failed network request was going and on which IP family, alongside the fields it always had (step, exit_code, error_line, error_output, ...):

  • host: install.squirrelscan.com, github.com, api.github.com or a *.githubusercontent.com host; anything else (a SQUIRREL_RELEASES_ENDPOINT or SQUIRREL_DOWNLOAD_ENDPOINT override, an internal mirror) is custom. No path, query or credentials, and no name from the user's own network.
  • ip_family: v4, v6 or unknown. curl does not expose the family of a failed connection (%{remote_ip} is empty when it fails), so a detached probe of OUR host reads the address from curl's own Trying <address> line (an IPv4 address with its port has one colon, an IPv6 one has more; the bracketed form of curl 8 too). It runs inside the same detached reporter as the POST, with the transport hardening and a 3 s connect and 5 s total bound, so the install never waits for it. custom hosts are never probed (unknown).
  • Sent for a bare curl network exit (6, 7, 28, 35, 52, 56), and for the more common case where error() exits 1 after a failed request: each request site now records curl's exit code (note_fetch_failed), so the report keeps the installer's own exit_code and still carries host and family. A later request clears it, so a checksum failure after a recovered fetch does not inherit a stale host.

A bug found on the way

note_fetch_host set a shell variable, and get_latest_version runs as version=$(...), a subshell: the exit trap never saw the host, which is how a report read "an unknown host (before the first request)" for a request that had been made. The host and code now also go to a small state file (the same pattern as ERROR_MSG_FILE), read once by the exit trap and removed on every exit path including signals.

step is never init

The default step is startup; report_error also maps an empty step or init to startup. A report that predates the named steps can no longer be mistaken for one from the current script. The step startup is unknown to the worker's KNOWN_STEPS today (buckets to other), and so are the new fields (its allowlist drops them): both are the private slice, and neither breaks anything meanwhile.

Verified

  • Docker, Ubuntu 22.04 with curl 7.81 and the repro harness: install.squirrelscan.com mapped to 127.0.0.1 reports host: install.squirrelscan.com, ip_family: v4, mapped to ::1 reports v6, with exit_code: 1 and the same error_line as before. Alpine 3 (musl, curl 8.23, bracketed trace): v6, libc: musl.
  • macOS system bash 3.2: bash -n, and the report path (a failure in a command substitution, then the exit trap) sends host and ip_family.
  • shellcheck: no new finding (4 existing notes unchanged); bash -n install.sh (the CI "Installer script syntax" step).
  • scripts/install-contract.test.ts (new cases: every network code, five trace shapes, custom host, GitHub hosts, command-substitution persistence, non-network and early failures, the error()-exit-1 case, stale-failure clearing, the step cases) and install-hardening-168.test.ts (signals leak no temp file) and install-path-setup.test.ts: 227 pass. The curl-hardening scan now counts six invocations (the probe is hardened).

Acceptance criteria (#1681)

  • An error report from install.sh includes the failing host (hostname only, ours or custom) and whether the attempt was IPv4 or IPv6, for every curl network failure code
  • A report is never sent with step=init from the current script
  • Worker /error rate limit per source: private slice
  • Stable Sentry user key per source: private slice
  • A worker test replaying the observed payload: private slice (the script side of the replay is in install-contract.test.ts)
  • Source of the 15-minute reports identified: not from this PR

Agent skill and docs

  • squirrelscan agent skill (squirrelscan/skills): no change. The skill covers installing and running the CLI, not what the installer's failure report carries.
  • Docs: quickstart.mdx (a custom endpoint's address never appears in the report; custom instead) and faq.mdx (the report's fields now include host and IP family) are updated; CHANGELOG bullet included. install.ps1 is unchanged (report version 3).

nc9 added 2 commits November 11, 2026 12:22
…ed request; step startup not init #1681

Signed-off-by: Nik Cubrilovic <[email protected]>
…ignores proxies, a fragment ends the host; tests and docs for the state file and probe #1681

Signed-off-by: Nik Cubrilovic <[email protected]>
@nc9

nc9 commented Nov 13, 2026

Copy link
Copy Markdown
Contributor Author

Already on main: 56e03dd and 6d1832a landed through a rebase-merged bundle, so this PR stayed open. #1681 stays open for the later private slice.

nik

@nc9 nc9 closed this Nov 13, 2026
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