Skip to content

Board: one password set in a terminal, no random secret, no Tailscale coupling (T229) - #115

Merged
erickb336 merged 10 commits into
mainfrom
board/t229-password-once
Oct 11, 2026
Merged

erickb336 merged 10 commits into
mainfrom
board/t229-password-once

Conversation

@erickb336

Copy link
Copy Markdown
Owner

Sage task T229. The board has no random secret any more. On the Mac it needs no sign-in. Through a private HTTPS tunnel it needs one password that the owner sets once in a terminal; until then, access from outside the Mac is off. No agent can set the password or read the board config. The board code names no tunnel vendor.

References #108 (T216, already closed): this replaces its "random secret" with the owner's password.

What changes for the owner

Case Before After
board --setup / --ensure with no config writes a random secret writes no secret and no password
Request through a tunnel, no password set signs in with the secret 403: "Access from outside this Mac is off: no board password is set. Set a password on the Mac: run in a terminal "
show board line, allowedHosts set, no password "sign in with the secret value in ..." "Phone access is off until you set a board password: run in a terminal on this Mac: "
board --set-password from a pipe or an agent sets the password refuses: "board --set-password needs a terminal: ..."
Config with an old secret the secret signs in loads; the secret signs no one in; --set-password drops it
Tailscale-* header with a loopback Host counts as a proxy not a proxy sign; only X-Forwarded-* and Forwarded count
Agent or chief runs --set-password, or reads board.json in a sage-board folder (Bash, Read, Grep) allowed refused by the hook, in every mode: "the board password rule (T229)"

Status 403 (not 401) for the not-set case: no credential can pass, so the browser should not show a sign-in dialog.

Evidence

  • npm run build, npm run check: all checks pass.
  • Each test file alone (fake ps, pgrep, kill first on PATH; scratch HOME and TMPDIR; 900 s alarm): board 58, board-acceptance 9, board-reader 7, board-model 16, board-render 13, board-observations 5, board-view 5, board-intent 5, board-server 15, board-cli 8, board-install 5, board-ensure 17, providers 92, sage-hook 233; 0 failures.
  • The new T229 tests fail on main (b0af484) for the expected reasons: 8 of 9 T229-named tests fail there, and the terminal refusal and guide tests fail too.
  • Manual: board --set-password in a pseudo-terminal (script) asked twice with the echo off and set the scrypt record; from a pipe it refused with exit 1.

Not verified

  • A real phone through a real tunnel.
  • The hook rule is a guard for agents, not a security boundary: an agent's code that builds the path at run time (for example in a script file) is not visible to it. The terminal check in the command stays the main barrier for the password.
  • scripts/board-enhancement.test.mjs needs Playwright, which is not installed here (it is not in npm test).

🤖 Generated with Claude Code

erickb336 and others added 3 commits October 11, 2026 04:51
…aders (T229)

- Setup and ensure write no secret. An old "secret" still loads but signs no one in.
- Until a password is set, every request that is not the Mac path gets 403 that names the set-password command; the ensure line says the same.
- board --set-password refuses when its input is not a terminal.
- The sign-in rule keeps X-Forwarded-* and Forwarded and drops Tailscale-* names.
- The board guide describes a private HTTPS tunnel that adds X-Forwarded-For, and says that a raw TCP forward bypasses the sign-in.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…config (T229)

- The board password rule refuses, in every mode, a command that runs the board command with --set-password, and a command, Read or Grep that names the board config (board.json in a sage-board folder, or ~/.config/sage-board). The board command may name its config after --config.
- The PreToolUse matcher now sends Read and Grep to the hook.
- The board note tells the chief to give the owner the set-password command to run in Terminal.
- README: what's new and the board section.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ok limits (F-T229-7, F-T229-8)

The 403 away from the Mac is one fixed sentence; the exact set-password
command stays only in the output of board --ensure on the Mac. The guide
no longer claims that the terminal check stops an agent: the hook stops
ordinary command shapes only, and full protection needs the sandbox.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
erickb336 and others added 7 commits October 11, 2026 05:37
…d covers file tools (F-T229-4, -5, -6, -8, -9)

- The set-password option counts in any word or quoted argument, with
  quotes and backslashes taken out, unless every program is grep or rg.
- A board command takes no variable, substitution, pattern or xargs words.
- Each path word resolves against its working folder (., .., //, ~,
  links) and matches only ~/.config/sage-board: the folder, board.json
  and the temporary .board-*.json files. Repository paths and search
  words such as board.json pass.
- A recursive search, copy, move or link of that folder or a folder
  above it is refused, and so is the Grep tool there.
- Write, Edit, MultiEdit and NotebookEdit get the real-path check.
- A line the reader cannot read is refused when it names the board or
  a config. Each word is checked once per call, so 1 MB stays fast.
- One table test for the chief, an agent and a plain session.
- The README no longer claims that the hook stops every agent.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…F-T229-13, -14, -17, -18, -19)

- F-T229-17: a linear matcher replaces the path regex. It steps through
  the path once per piece, so no word makes it backtrack; above 16
  pattern pieces a word keeps only its first and last text (fail closed).
- F-T229-18: the rule checks the value of key=value words, the path of
  file:// URLs, the git -C folder for the path words after it, the words
  of an xargs here-string, and texts with a slash in node -e or python3 -c
  code (also F-T229-13).
- F-T229-19: the terminal tool's cwd is the folder of its command.
- F-T229-14: the Glob tool goes to the hook and has the Grep path check.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…Ls, curl files and interpreter stdin (F-T229-20, -21, -22, -24)

- F-T229-20: a path resolves with one lstat for each new folder in a call,
  and realpath only for a link. A pattern word whose text is not in the
  config path stops early. real() starts a path over 4096 characters within
  them. The gh rule stats a file once before its realpath. 1 MB shapes now
  take 0.02 to 1.4 s of CPU (the old code: 3 to 69 s).
- F-T229-21: a word over 4096 characters with a pattern, a variable, board
  or .config fails closed.
- F-T229-22: a file: URL with any number of slashes, with and without its
  query and fragment; the files that curl reads after @ or =<.
- F-T229-24: an interpreter's code on stdin is read as its code argument.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
README What's new: keep both first lines.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ory has (F-T229-27)

T53 asserted 2 timing bounds; a justified bound in another test broke it. It now counts the bounds before and after the sample escape, so the escape adds exactly 1.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ounds CPU time only (F-T229-28, F-T229-29)

F-T229-29: the cheap path walk caught the too-many-links error of a link loop and read the part as missing, so an agent could touch or rm through a loop. The walk now lets the error through, and the logbook rule refuses the command, as before the walk. A table test covers writes, a read and the chief.

F-T229-28: the F-T229-20 test failed under load on its 10 s wall-clock kill. Each shape now runs in a child that measures the hook's own CPU time; a 120 s wall-clock limit only stops a hung test.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…s for a restart (F-T229-32)

A server of older code can still take the old random secret, so ensure no longer
says that phone access is off for it: it prints the stop command and asks for the
board again. It decides by the start time against the code's own file times, not by
the secret key in the config, which stays until set-password and would ask for a
restart again after every restart. The allowedHosts line now says how to turn
phone access on (QA R836).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@erickb336
erickb336 merged commit fb48e83 into main Oct 11, 2026
1 check passed
@erickb336
erickb336 deleted the board/t229-password-once branch October 11, 2026 15:53
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