fix(#1264): harden unattended identity bootstrap
ci/woodpecker/pr/ci Pipeline failed

This commit is contained in:
goals
2026-08-16 18:33:39 -05:00
parent 43fa047787
commit 9dc90be7e1
14 changed files with 448 additions and 288 deletions
+51 -32
View File
@@ -1,59 +1,78 @@
# Issue #1264 Independent Code and Security Review
# Issue #1264 Code and Security Review
> Scope: uncommitted delivery delta for `fix/1264-fleet-unattended-first-start` against
> `origin/next@476db12b92971634b67fd2057b7577ee5894e449` | Reviewer: Codex CLI via Mosaic review tools
> Branch: `fix/1264-fleet-unattended-first-start` | Base:
> `origin/next@476db12b92971634b67fd2057b7577ee5894e449`
## Initial code review
## Initial automated review
Command:
Codex reviewed the pre-PR uncommitted delta with:
```bash
~/.config/mosaic/tools/codex/codex-code-review.sh --uncommitted \
-o /tmp/1264-codex-code-review.json
```
Result: `request-changes`, confidence `0.93`, `20` files reviewed, `0` blockers, `1` should-fix.
Result: `request-changes`, confidence `0.93`, 20 files, one should-fix. `checkSoul()` trimmed
`MOSAIC_AGENT_NAME` for pre-seed resolution while composition used the original value, so a padded
name could seed files before later refusal.
Finding: `checkSoul()` trimmed `MOSAIC_AGENT_NAME` for pre-seed roster resolution while later
composition used the original value. A padded exact name could therefore seed identity files and
then fail composition.
Remediation rejected blank/leading/trailing-whitespace values before roster lookup or writes and
added three built-CLI no-side-effect regressions. Automated re-review approved that delta with no
findings (confidence `0.86`). Initial security review reported risk `none` (confidence `0.91`).
Remediation:
## Formal exact-head review
- treat any present blank or surrounding-whitespace value as an invalid fleet launch;
- reject it before roster lookup or identity writes; and
- add three real-CLI no-side-effect regressions for leading padding, trailing padding, and empty
values.
Daphne reviewed PR #1268 at exact head `43fa0477877e0d0f110da8d11c3033b40ddeb191` and filed Gitea
review ID 168 as `REQUEST_CHANGES`. The review was source/PR-only; the canary remained untouched.
## Code re-review
Blocking groups:
Command:
1. class mismatch was validated after first-start mutation;
2. secure `USER.md` validation was discarded before ordinary path-following composition;
3. `existsSync()` treated a dangling destination symlink as missing, allowing counterpart partial
publication; and
4. the built-CLI/evidence chain allowed stale ignored `dist/`, cited an unshipped canary object, and
carried conflicting test totals/pane wording.
The diagnostic's defaults-only repair advice was also inaccurate for roster/class/destination
failures.
## Formal-review remediation
All four blocking groups received regressions before production changes. The RED run produced four
failures while 1,568 existing tests passed. Remediation then:
- validates canonical name and class before seeding;
- preflights destination directory entries with `lstatSync()` so target and dangling symlinks fail
before publication;
- securely reads `USER.md` through an `O_NOFOLLOW` descriptor at composition time;
- adds a Mosaic build before package Vitest and a dependency build in the clean-checkout command;
- replaces defaults-only advice with neutral named-component repair guidance; and
- reconciles shipping canary provenance, pane chronology, commands, and totals.
Remediation code review:
```bash
~/.config/mosaic/tools/codex/codex-code-review.sh --uncommitted \
-o /tmp/1264-codex-code-rereview.json
-o /tmp/1264-remediation-code-review.json
```
Result: `approve`, confidence `0.86`, `15` files reviewed, no findings. The review sandbox could run
package typecheck but could not run Vitest because its checkout was read-only and Vite attempted to
create a timestamped config artifact (`EROFS`). This is not scored as test evidence; the executor's
writable worktree independently passed the focused and full suites recorded in the QA report.
Result: `approve`, confidence `0.88`, 6 files, no findings. Summary: the fail-closed destination
checks, class-validation order, secure composition, and build-before-Vitest path are coherent.
## Security review
Final command:
Remediation security review:
```bash
~/.config/mosaic/tools/codex/codex-security-review.sh --uncommitted \
-o /tmp/1264-codex-security-rereview.json
-o /tmp/1264-remediation-security-review.json
```
Result: risk `none`, confidence `0.91`, `20` files reviewed, `0` critical/high/medium/low findings.
The review specifically confirmed roster validation before seeding, bounded no-symlink reads,
no-clobber publication, unsafe/padded identity refusal, and fail-closed behavior before runtime.
Result: risk `none`, confidence `0.93`, 9 files, no critical/high/medium/low findings. The sandbox
could not run Vitest because Vite attempted to create a temporary config artifact on its read-only
mount (`EROFS`); executor-owned focused and full results are recorded in the QA report.
## Independent PR review gate
## Remaining review gate
Automated review is complete. The PR still requires a formal reviewer who is neither the implementation
seat nor Fred, per the assignment. That review and CI status are recorded in the QA report when
available.
Daphne must re-review the next exact pushed head. This report cannot record that future verdict
without changing the reviewed head, so the authoritative terminal verdict belongs to PR #1268's
Gitea review record. Fred and goals are excluded as reviewers.