carlos / platform Public

review: round 1 findings and scoped-check brief, staticcheck-sa1019

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev 8a172df63aec562626c54fa9c10449e6f16c3de4 parent 2000972
2 files changed, +58 −0
  • docs/superpowers/reviews/CHECK-BRIEF-staticcheck-sa1019-R1-fix.md +18 −0
  • docs/superpowers/reviews/FINDINGS-staticcheck-sa1019-R1.md +40 −0

CI cancelled — superseded by a newer push — run details

diff --git a/docs/superpowers/reviews/CHECK-BRIEF-staticcheck-sa1019-R1-fix.md b/docs/superpowers/reviews/CHECK-BRIEF-staticcheck-sa1019-R1-fix.md
new file mode 100644
index 000000000..78b761865
--- /dev/null
+++ b/docs/superpowers/reviews/CHECK-BRIEF-staticcheck-sa1019-R1-fix.md
@@ -0,0 +1,18 @@
+# Scoped check: staticcheck-sa1019, after round 1 (not a review round)
+
+Repo carlos/platform, branch `staticcheck-sa1019` (tip in the prompt).
+Round 1 (`docs/superpowers/reviews/FINDINGS-staticcheck-sa1019-R1.md`) ended
+READY AFTER FIXES with one P2 in `dbHandleSecret`. The fix is commit
+20009722. Scope: `git show 20009722` only.
+
+Check:
+1. The P2: resolved, partly, not.
+2. For every ECDSA key the old `D.FillBytes(make([]byte, 32))` accepted, is
+ the derived secret byte-for-byte the same, on P-256, P-384 and P-521?
+ Does every key it refused still refuse? Independently recompute the
+ golden values if you can.
+3. Do the fixtures fail under the mutations they claim?
+
+Answer each: OK, or a finding with file:line, failure scenario and fix,
+marked P1 or P2. End with exactly one line: CHECK PASSED, or CHECK FAILED
+with the P1s. Do not edit files, spawn reviewers or run full suites.
diff --git a/docs/superpowers/reviews/FINDINGS-staticcheck-sa1019-R1.md b/docs/superpowers/reviews/FINDINGS-staticcheck-sa1019-R1.md
new file mode 100644
index 000000000..16c61a1d7
--- /dev/null
+++ b/docs/superpowers/reviews/FINDINGS-staticcheck-sa1019-R1.md
@@ -0,0 +1,40 @@
+Round 1, reviewing `5048247f1c7a077530e2c12003fafcebd92f8a0f...80304c738bf190ed02c2e900213b2f7abbe29a36`. The requested tip adds only the review brief to the commit named inside it.
+
+**P1: None found.**
+
+**P2: Preserve scalar-width compatibility for larger curves.**
+[internal/console/apidbclaim.go:64](/home/paulca/amadan.net/carlos/platform-staticcheck-sa1019/internal/console/apidbclaim.go:64)
+
+`PrivateKey.Bytes()` returns the curve’s fixed-width encoding. The old `D.FillBytes(make([]byte, 32))` rejected a scalar only when its **value** needed more than 32 bytes. The new check rejects every P-384 or P-521 key, including valid keys whose scalar fits.
+
+For example, a valid P-384 key with `D = 1` previously produced a handle secret; its new 48-byte encoding triggers the panic. [Store.SigningKey:3350](/home/paulca/amadan.net/carlos/platform-staticcheck-sa1019/internal/console/store.go:3350) checks that a loaded key is ECDSA without restricting its curve. Such a stored key therefore changes from successful startup to a panic. Generated P-256 keys are unaffected, so this is an edge-case compatibility finding.
+
+Fix: when the encoding exceeds 32 bytes, reject only if an excess leading byte is nonzero; otherwise use its final 32 bytes. Add deterministic P-384 fixtures for a fitting scalar and an overflowing scalar. The current [test:132](/home/paulca/amadan.net/carlos/platform-staticcheck-sa1019/internal/console/apidbclaim_test.go:132) exercises only a randomly generated large scalar and misses this distinction.
+
+Fault family: preserve the accepted key set and byte-for-byte database-handle derivation.
+
+**P3: None.**
+
+The remaining checks found:
+
+- **Tar acceptance is unchanged.** `tar.TypeRegA` and `tarTypeRegNUL` both equal `'\x00'`. The physical-header predicate, link/device refusal, path validation and size checks retain their behavior.
+- **All 16 production suppressions are justified and line-scoped.** The tunnel needs x/net’s explicit ping and closing state, existing-connection handling, and server-specific draining/refusal machinery. In particular, `h2StreamID` depends on x/net’s response-writer shape. `Request.Cancel` remains active in the pinned transport. The S3 SDK retains legacy `Prefix` responses, and the SQL wrapper already prefers context methods before falling back. None offers a straightforward behavior-preserving migration within this change.
+- **The Director migrations are test-only.** No production reverse proxy changes.
+- **The parser migrations retain their scan scope**, including files excluded by build tags, and preserve object resolution where the guards use it.
+- **The new tests target their claimed mutations.** Source inspection confirms that refusing NUL headers, removing the legacy-prefix check, or using bare `SetURL` contradicts their assertions. Independently recomputing the three secret goldens matched the old derivation. The missing key-width case is covered by the P2 above.
+
+**Census verdicts for the reviewed tip:**
+
+| Unit or envelope | Verdict and evidence |
+|---|---|
+| `staticcheck.conf:external` | **APPROVE.** [Line 35](/home/paulca/amadan.net/carlos/platform-staticcheck-sa1019/staticcheck.conf:35) enables SA1019. Its SHA-256 matches the overlay. The existing `legacy / accepted-legacy` disposition remains appropriate; no root read is added. |
+| `.` | **APPROVE.** The configuration change affects tooling. [move_offline_run_test.go:1336](/home/paulca/amadan.net/carlos/platform-staticcheck-sa1019/move_offline_run_test.go:1336) retains the source guard’s checks. No production root behavior changes. |
+| `internal/demobuild` | **APPROVE.** [source.go:242](/home/paulca/amadan.net/carlos/platform-staticcheck-sa1019/internal/demobuild/source.go:242) substitutes an identical constant. No archive acceptance or refusal boundary changes. |
+| `internal/edge` | **APPROVE.** Production changes in [tunnel.go:101](/home/paulca/amadan.net/carlos/platform-staticcheck-sa1019/internal/edge/tunnel.go:101) are suppressions and formatting. Authentication, connection adoption, liveness and retry classification remain unchanged. |
+| `internal/tunnelclient` | **APPROVE.** [upgrade.go:116](/home/paulca/amadan.net/carlos/platform-staticcheck-sa1019/internal/tunnelclient/upgrade.go:116) and `RoundTripUpgrade` retain their executable behavior. No draining, refusal or upgrade boundary is weakened. |
+
+Validation limits: focused Go tests and the census dependency check could not complete because the filesystem is read-only. Mutation tests were assessed from source, not executed. Changed Go files pass `gofmt`; `git diff --check` is clean. No files were edited, reviewers spawned, or full suites run.
+
+Apply the P2 within round 1 without reopening the review, retaining the required security-change check on the resulting fix.
+
+READY AFTER FIXES
\ No newline at end of file