You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(installer): install.sh runtime hardening (umask, size check, signal traps, bin-dir and HOME guards, noexec tmp) #168
A set of runtime hardening gaps in install.sh, grouped because each is a few lines and they touch the same code paths:
umask: the script never sets one. A permissive inherited umask (e.g. 0000) produces a group/world-writable bin directory and binary on PATH. Set umask 022 before any mkdir or file placement.
Size check: manifest.json ships a size per binary; install.sh never reads it. Compare the downloaded byte count against it before hashing: a truncated download then fails with a clear size-mismatch error instead of a checksum mismatch.
Signal traps: only an EXIT trap is installed, and bash skips EXIT traps when killed by an untrapped fatal signal. Ctrl-C during a download leaks the temp directory. Add trap 'exit 130' INT, trap 'exit 143' TERM, trap 'exit 129' HUP so termination exits through the existing cleanup/reporting trap.
Bin dir guards: refuse SQUIRREL_BIN_DIR values that are empty after expansion or /.
HOME guard: fail early with an actionable message when HOME is unset instead of dying mid-run with unbound variable.
noexec temp dirs: the downloaded binary is executed from $TMPDIR to run self install. On systems where /tmp is mounted noexec (hardened servers, some containers) that fails opaquely. Either stage under ~/.squirrel/tmp as a fallback when the exec fails with a permission error, or detect the mount option and report a clear error naming the cause.
Acceptance Criteria
directories and the binary created by the installer are never group/world-writable regardless of the inherited umask
a downloaded binary whose byte count differs from the manifest size is rejected with a size-mismatch error before hashing
Ctrl-C during the download leaves no temp directory behind and still fires the failure-report path
SQUIRREL_BIN_DIR=/ (or //, /., /..) or a whitespace-only value aborts with a clear error; a truly empty or unset value means "not set" and uses the default directory (so a CI step with an empty variable does not start failing)
running with HOME unset produces an actionable error message
on a noexec temp dir the install either succeeds via a fallback staging directory or fails with a message that names noexec as the cause
Verified against main after v0.0.152 (install.sh hardening landed). Met and ticked: criteria 1, 2, 3, 5 and 6 (umask never leaves a group or world writable result, a size mismatch is rejected before hashing, Ctrl-C leaves no temp dir and still reports, HOME unset gives an actionable error, a noexec temp dir falls back or names noexec; 36 hardening tests pass). Open: criterion 4: SQUIRREL_BIN_DIR of /, //, /.. or whitespace aborts, but a truly empty value is treated as not set (a CI step with an empty variable should not start failing), as the PR body says. Read literally the criterion wants an empty value to abort, so either the criterion needs amending to the shipped rule or the code needs to change. Leaving this open for that decision.
Activity
fix(installer): install.sh umask, size check, signal traps, bin dir a…
fix(installer): install.sh umask, size check, signal traps, bin dir a…
fix(installer): install.sh umask, size check, signal traps, bin dir a…
fix(installer): install.sh umask, size check, signal traps, bin dir a…
fix(installer): install.sh umask, size check, signal traps, bin dir a…
fix(installer): install.sh umask, size check, signal traps, bin dir a…
nc9 commentedon Oct 31, 2026
Verified against main after v0.0.152 (install.sh hardening landed). Met and ticked: criteria 1, 2, 3, 5 and 6 (umask never leaves a group or world writable result, a size mismatch is rejected before hashing, Ctrl-C leaves no temp dir and still reports, HOME unset gives an actionable error, a noexec temp dir falls back or names noexec; 36 hardening tests pass). Open: criterion 4:
SQUIRREL_BIN_DIRof/,//,/..or whitespace aborts, but a truly empty value is treated as not set (a CI step with an empty variable should not start failing), as the PR body says. Read literally the criterion wants an empty value to abort, so either the criterion needs amending to the shipped rule or the code needs to change. Leaving this open for that decision.nik
nc9 commentedon Oct 31, 2026
Shipped in v0.0.152 (
3ce62188), verified against main. Criterion 4 now states the shipped rule:/-like and whitespace-only values abort, a truly empty or unset value means not set (documented in the PR and covered by tests), so every acceptance criterion is met. Release: https://github.com/squirrelscan/squirrelscan/releases/tag/v0.0.152nik
test(install): pre-signed-era fixtures for the attestation and harden…