Skip to content

Security audit remediation (PD-001…PD-050) - #24

Open
aronprins wants to merge 3 commits into
masterfrom
audit-fixes-2026-06
Open

Security audit remediation (PD-001…PD-050)#24
aronprins wants to merge 3 commits into
masterfrom
audit-fixes-2026-06

Conversation

@aronprins

Copy link
Copy Markdown
Owner

Implements the highest-priority fixes from docs/bugs/audit.md. Build passes and all 52 unit tests are green; new tests cover the security-relevant changes.

What's fixed

Supply chain

  • PD-015 — verify the bundled Node binary against nodejs.org SHASUMS256.txt before extraction
  • PD-016 — version-keyed Node cache marker; a stale cache is rebuilt on NODE_VERSION bump

Electron main process

  • PD-001 — single-instance lock + second-instance focus (stops a 2nd instance killing the 1st's server)
  • PD-002 — strict /^\d+$/ PID validation before treeKill
  • PD-005/006 — idempotent killServer (shared promise) with SIGKILL escalation after 5s
  • PD-008 — port-probe connect timeout

Connection layer

  • PD-040/041/049 — preflight abort timer armed through body read, 256 KB body cap, malformed JSON no longer misclassified as "unreachable"
  • PD-042/050 — atomic profile write, discriminating reader (backs up corrupt files, no clobber on EACCES), mode 0600
  • PD-043/044 — private-host classifier (IPv6-literal guard for fc/fd, 0.0.0.0, fe80::/10, IPv4-mapped IPv6)
  • PD-011/046 — UUID-validate/regenerate profile ids + de-dup on load

Launcher UI

  • PD-010 — verify-token staleness guard + verified-URL match before connect
  • PD-013/014 — null snapshot guards, connect re-entry/double-submit guard
  • PD-009 — preload onStatus returns an unsubscribe

Release gates / CI

  • PD-021 — missing embedded server bundle now fails verification
  • PD-022 — notarization fails closed unless ALLOW_UNNOTARIZED_MACOS_BUILD=true
  • PD-030 — workflow_dispatch inputs routed through step env: + tag validation (all 3 workflows)
  • new ci.yml — build + unit tests on PR/push
  • PD-038 — noImplicitOverride, noFallthroughCasesInSwitch

Deferred (tracked in the audit's Remediation log)

PD-017/018/019/020 (need a committed staging lockfile / pinned upstream commit), PD-031 (SHA-pin actions), PD-032 (entitlements need a notarized test build), noUncheckedIndexedAccess (broad unrelated fallout), and remaining lows.

Test plan

  • pnpm build
  • node --test test/*.test.mjs → 52 passing ✅ (added cases for PD-010 classifier, PD-039 window-policy adversarial URLs, PD-011/046/042 profile sanitization)

🤖 Generated with Claude Code

aronprins and others added 3 commits June 11, 2026 10:13
Implements the highest-priority fixes from docs/bugs/audit.md across the
Electron main process, connection layer, launcher UI, build/release scripts,
and CI. Build and all 52 unit tests pass; new tests cover the security-relevant
behavior changes.

Supply chain:
- PD-015: verify bundled Node against nodejs.org SHASUMS256.txt before extract
- PD-016: version-keyed Node cache; stale cache rebuilt on NODE_VERSION bump

Electron main (src/main.ts):
- PD-001: single-instance lock + second-instance focus
- PD-002: strict numeric PID validation before treeKill
- PD-005/006: idempotent killServer with shared promise + SIGKILL escalation
- PD-008: port-probe connect timeout

Connection layer:
- PD-040/041/049: preflight body timeout, 256KB size cap, JSON misclassification
- PD-042/050: atomic profile write, discriminating reader, mode 0600, .bak backup
- PD-043/044: private-host classifier fixes (fc/fd, 0.0.0.0, fe80, mapped IPv6)
- PD-011/046: UUID-validate/regenerate profile ids + de-dup on load

Launcher UI (src/launcher-html.ts):
- PD-010: verify-token staleness guard + verified-URL match before connect
- PD-013/014: null snapshot guards, connect re-entry guard
- PD-009: preload onStatus returns unsubscribe

Release gates / CI:
- PD-021: missing embedded server bundle fails verification
- PD-022: notarization fails closed unless ALLOW_UNNOTARIZED_MACOS_BUILD=true
- PD-030: workflow_dispatch inputs via step env: + tag validation
- add ci.yml (build + unit tests on PR/push)
- PD-038: noImplicitOverride, noFallthroughCasesInSwitch

See docs/bugs/audit.md "Remediation log" for deferred items.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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