Skip to content

P5 O10 M10 follow-up: an unenrolled mawsd answers status, keys and policy without loading its endpoint - #315

Merged
SSFSKIM merged 9 commits into
masterfrom
p5-o10-readonly
Oct 28, 2026
Merged

SSFSKIM merged 9 commits into
masterfrom
p5-o10-readonly

Conversation

@SSFSKIM

@SSFSKIM SSFSKIM commented Oct 28, 2026

Copy link
Copy Markdown
Owner

P5 O10 M10's follow-up, owed in P5 Decision Log 124 (lever (a) of Decision Log 114). Before this change, an unenrolled mawsd loaded its endpoint module for any daemon.endpoint command. That means one mawsd endpoint status or mawsd keys on a machine that never enrolled kept about 6 MiB resident until restart. Now status, keys and policy (bare or --json) are answered without loading the module. This happens only when the endpoint's state directory is private, readable and searchable by the process, and holds nothing.

What changed

  • src/endpoint/answers.ts (new): the three commands' renderers, from plain values. The module's cli.ts now uses them too, so the seam's answer and the module's are the same bytes. It imports nothing at run time, since it rides mawsd's run path.
  • src/endpoint/presence.ts: unloadedAnswer and holdsNothing.
    • The state directory has to be private (assertPrivateDirectory), readable and searchable (accessSync(R_OK | X_OK)), and empty.
    • Anything else goes to the module as before. That covers another command, other arguments, a directory holding any entry, and one the store would refuse. The module then answers with its own parsing and refusals.
    • A load already under way is awaited.
  • src/mawsd/endpoint-seam.ts: asks unloadedAnswer before loading.
  • src/endpoint/cli.ts and policy.ts: render through answers.ts.
  • legacy status stays the module's, because it counts key copies under stale-<time>/.
  • e2e/supervisor-packaged.spec.ts: the packaged expectation flips. A read-only command on the packaged, unenrolled mawsd no longer loads the endpoint.

Tests

  • test/endpoint/presence.test.ts: the seam's answer equals the module's for each command and form over an unenrolled state. Each disqualifying case is covered:
    • a file or directory in the state dir;
    • group or other mode bits;
    • a directory that can be read but not searched (0600). This case runs only where search is actually denied: macOS's inherited ACLs can leave a chmodded temporary directory searchable;
    • other arguments.
  • src/mawsd/endpoint-seam.test.ts, cli.test.ts and process-endpoint.test.ts: the module stays unloaded after a read-only command, and loads for anything else.

Review

A doperpowers:reviewer-medium review over two rounds. Its findings were fixed in dfd9cd4 (the unsearchable directory) and ebab91f (that test's ACL guard). The remaining finding is logged in docs/tech-debt-tracker.md (f76e26a): a state directory whose path is within a few bytes of PATH_MAX answers code 3 from the module where the seam would answer 0.

Validation

Both runs below are on 696a1e4, before this merge of master:

  • 40753528960: class 1a plus hosted e2e:supervisor-daemon, e2e:daemon-unit and e2e:desk-web-hub. Green, with one flaky: session-plane.spec.ts:124, the holdOrgKey set-up row master's tracker now carries.
  • 40753525879: packaged and unit:darwin. Green.

The landing set on this head (a172fb1, origin/master merged with #310 in it):

  • the hosted run: class 1a plus hosted e2e:default, e2e:desk-web-hub, e2e:supervisor-daemon, e2e:daemon-unit and packaged;
  • unit:darwin, once tonight's measured series has left the mini.

Run ids follow in a comment.

Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)

…d policy without loading its endpoint

The seam, the command line through a real daemon, and the built daemon's process scene hold that a read-only
command over a state directory that holds nothing loads no module and answers byte for byte as the module
started on it does (test/endpoint/presence.test.ts compares the two against the real module); every other
command, argument or state directory is the module's. The packaged check's `endpoint status` now answers
unenrolled with no load, and `enroll` with a non-code is the command that loads the chunk from app.asar.
Each fails on M10's code (cbc9402): the module loads at the first read-only command.

Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
…awsd no module (P5 Decision Log 114's lever (a))

M10 loaded the endpoint at the first `daemon.endpoint` command of any kind, so one `mawsd endpoint status` or
`mawsd keys` on an unenrolled machine kept about 6 MiB resident until restart. Now `status`, `keys` and
`policy`, bare or `--json`, are answered by the seam while the module is unloaded and the state directory is
private and holds nothing: presence.ts renders them through answers.ts, the renderers the module's cli.ts now
uses too, so both say the same bytes, and UNENROLLED_STATUS is the module's own endpointStatus over no state.
Anything else (another command, other arguments, a directory holding any file or directory, or one the store
would refuse) loads the module as before, which answers with its own parsing and refusals; a load under way
is awaited. `legacy status` stays the module's: it counts key copies under stale-<time>/.

Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
…h is the module's to answer

`holdsNothing` passed a state directory at mode 0400 or 0600: `assertPrivateDirectory` looks only at the group and
other bits and `readdirSync` needs only read permission. But the module's EndpointState.open lstats each state file
inside it, gets EACCES and rethrows, so its start fails and its command line answers code 3, the endpoint has not
started, where the seam answered a successful unenrolled reply. Now the seam also requires that the process can read
and search the directory (accessSync R_OK | X_OK); anything that fails is the module's to answer, as before.

The test sets a 0600 directory beside the 0750 one, expects no seam answer, and starts the real module on it to hold
that its `keys` is not code 0 (skipped for root, which searches any directory). It fails on the previous code: the
seam answers `keys` over the 0600 directory.

Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
…ch is actually denied

The case chmodded the state directory to 0600 and assumed that denies search, guarded only by a root check. On macOS
chmod leaves inherited ACLs in place: a temporary directory carrying an owner `allow search,directory_inherit` ACL
leaves the fixture searchable, so the seam rightly answers, the real module starts, and the test's `toBeNull()` failed
falsely. Now the block asks `accessSync(X_OK)` after the chmod and runs its assertions only when that is denied; the
check replaces the root guard, since root searches any directory too. The restore to 0700 stays in the `finally`.

Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
…near PATH_MAX (O10 M10 follow-up's review)

Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
docs/tech-debt-tracker.md: both sides appended a row; both kept.

Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
…) into p5-o10-readonly

Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
…p5-o10-readonly

The tracker's two new rows, the unloaded answers' PATH_MAX gap and session-plane's holdOrgKey set-up, both kept.

Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-28T22:07:22.346670Z a172fb1 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@SSFSKIM

SSFSKIM commented Oct 28, 2026

Copy link
Copy Markdown
Owner Author

Landing set on a172fb1 (master d392c4d, no drift): run 40777141227 GREEN, 12/12 jobs. Class 1a (static, probes, unit 1-4/4), hosted e2e:default, e2e:desk-web-hub, e2e:supervisor-daemon, e2e:daemon-unit and packaged; no flaky lines. The tested tree equals the head's tree (da930f384). unit:darwin needs the mini, which is under a measured hold tonight; it runs once CI-opt slots it.

Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)

@SSFSKIM
SSFSKIM merged commit bde9430 into master Oct 28, 2026
SSFSKIM added a commit that referenced this pull request Oct 28, 2026
…up.sh missing-bus row

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
@SSFSKIM

SSFSKIM commented Oct 28, 2026

Copy link
Copy Markdown
Owner Author

Post-landing: unit:darwin on a172fb1 passed too, run 40782939608 (EC2 Mac).

Sminos-Session: p5-desk-track-owner#b4948247 (doperpowers on macbook)

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