carlos / platform Public

reviews: Astra #1056 round 1 (NOT READY)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev b7270ff598e56f40459a8db460c5bac49972e1c1 parent 2b1a513
1 file changed, +50 −0
  • docs/superpowers/reviews/CODEX-FINDINGS-SERVICES-SECRET-SCRIPTS-1056-R1.md +50 −0

CI failed — run details

Intent

Attributed to this commit: 34.0 g CO₂e (4,473,443 tokens). This is an attribution, not a measurement — usage counted from this commit's own marker forward to the next one on services-secret-scripts-1056, never backward from it. A turn that produced more than one commit books all of its tokens to the last one, and a concurrent session on this branch can add to the same figure. Some of it was priced using the shared default rate, because no model-specific factor row exists yet for at least one model involved. The Carbon view has the repo total, which is never derived from this attribution.

diff --git a/docs/superpowers/reviews/CODEX-FINDINGS-SERVICES-SECRET-SCRIPTS-1056-R1.md b/docs/superpowers/reviews/CODEX-FINDINGS-SERVICES-SECRET-SCRIPTS-1056-R1.md
new file mode 100644
index 000000000..85da4685e
--- /dev/null
+++ b/docs/superpowers/reviews/CODEX-FINDINGS-SERVICES-SECRET-SCRIPTS-1056-R1.md
@@ -0,0 +1,50 @@
+Round 1 against `884bb164140b59f4d699328f69f256a3589969c1`: **one P1 and four P2 findings**.
+
+1. **P1 — Default account resolution breaks JSON output.**
+ Both commands call `resolvedAccount` outside the JSON output guard: [services.go:229](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/services-secret-scripts-1056/services.go:229) and line 469. Default resolution unconditionally prints `account: …` for configured defaults, single memberships, and the compatibility fallback ([apimode.go:573](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/services-secret-scripts-1056/apimode.go:573), lines 586 and 593). This also happens with piped stdout.
+
+ Consequently, the documented command without `--account` produces invalid JSON for `jq`. A credential can be minted or rotated without its replacement secret reaching the destination. All three JSON tests supply `--account`, bypassing this path.
+
+ **Fix:** Keep account-resolution diagnostics and prompts off stdout in JSON mode, including login resolution. Test create and rotate with omitted accounts, configured defaults, and discovered memberships.
+ **Fault family:** Machine-readable stdout must contain exactly one JSON object.
+
+2. **P2 — JSON write failures report success.**
+ [services.go:318](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/services-secret-scripts-1056/services.go:318) discards `Encoder.Encode`’s error. Serialization can succeed while writing fails—for example, redirecting to `/dev/full` or a full filesystem. The credential has already changed, but the command returns successfully without delivering its secret.
+
+ **Fix:** Propagate write errors, exit nonzero, and explain recovery without including the secret. Add a failing-writer test.
+ **Fault family:** Successful credential delivery must be reflected accurately in the exit status.
+
+3. **P2 — Windows MSYS2/Cygwin terminals bypass the refusal.**
+ [appconfig_cli.go:428](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/services-secret-scripts-1056/appconfig_cli.go:428) checks only `isatty.IsTerminal`. The pinned dependency implements Windows console detection separately from `IsCygwinTerminal`; MSYS2/Cygwin PTYs are pipes. Those terminals therefore reach `ReadAll`, potentially waiting for—and visibly echoing—typed secret input.
+
+ **Fix:** Include `isatty.IsCygwinTerminal` in the terminal check. Test the actual detection boundary; the current test injects an already-decided boolean.
+ **Fault family:** Interactive secret input must be refused before reading.
+
+4. **P2 — Stdin has no size limit.**
+ [appconfig_cli.go:477](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/services-secret-scripts-1056/appconfig_cli.go:477) reads until EOF without a cap. A wrong file or unending producer can exhaust memory before any validation. The console’s 256 KiB request limit applies only after reading, copying, sealing, and encoding.
+
+ **Fix:** Establish a supported plaintext limit, read at most that limit plus one byte, and refuse excess input without echoing it. Test the boundary and an oversized reader.
+ **Fault family:** Secret ingestion must use bounded memory.
+
+5. **P2 — The name heuristic makes legitimate values unrepresentable.**
+ [appconfig_cli.go:500](/home/paulca/amadan.net/carlos/platform/.claude/worktrees/services-secret-scripts-1056/appconfig_cli.go:500) rejects every value beginning with its own key. For example, storing the literal value `FILTER=active` under `FILTER` now fails in both `env set` and `secrets set`, although that value passes the existing value validator. Quoting or using stdin cannot bypass the refusal.
+
+ **Fix:** Provide an explicit literal-value escape while retaining the accidental-prefix guard, and test it through both commands. Document the behavior for `env set` too.
+ **Fault family:** Typo prevention must preserve a deliberate way to store valid values.
+
+Census rulings for this commit:
+
+| Unit or envelope | Verdict | Basis |
+|---|---|---|
+| `appconfig_cli.go:parseSecretsArgs` | **APPROVED** | Reads the invoking process’s stdin; introduces no tenant-selected pathname or privileged read. The `legacy / accepted-legacy` disposition is appropriate. |
+| Root package envelope `.` | **APPROVED** | Reviewed the parser, validation, secret-setting integration, create/rotate branches, and JSON helpers. Existing sealing and authorization paths remain intact; no new root authority is granted. |
+
+These are census approvals, not approval of the functional defects above. I could not record them on #280 because sandbox networking blocked Amadan.
+
+Source inspection confirms literal `KEY=-`, mixed pairs, newline stripping, and existing `--environment` handling. Empty values and forbidden value characters still reach existing validation; read-error handling does not print partially read stdin bytes. Console storage is unchanged. The new tests meaningfully exercise their stated guards, but miss the findings above.
+
+Targeted `go test -run` with `GOCACHE` unset could not start: the sandbox refused Go’s temporary build directory. Runtime tests, census tests, and cross-platform compilation remain unverified. No files were changed.
+
+HEAD contains only the brief after the requested commit. Local `origin/main` also contains a later fleet-label change; its apparent reversals in the two-dot diff are not changes authored by this branch.
+
+**NOT READY**
\ No newline at end of file