martha#16 rows 5.4+5.5: forge token in context; posted-text check reads the forge #20

Closed
mars wants to merge 0 commits from mercurius/16-forge-token-shape into main
Member

Refs macula-io/martha#16 rows 5.4 and 5.5 (forge).

Purpose (tool gap): a forge token is refused where its context says it is one (a bare sha never is), and the posted-text check reads the forge too, with the token read from its file.

Builder: Mercurius. Three commits over 7ab86751. Threat model and mutants (15 + 14, all killed) are in the builder notes. The lookups stay on GitHub by ruling A.

Refs macula-io/martha#16 rows 5.4 and 5.5 (forge). Purpose (tool gap): a forge token is refused where its context says it is one (a bare sha never is), and the posted-text check reads the forge too, with the token read from its file. Builder: Mercurius. Three commits over 7ab86751. Threat model and mutants (15 + 14, all killed) are in the builder notes. The lookups stay on GitHub by ruling A.
A Forgejo access token is 40 hex digits with no prefix, a commit sha's shape, so
TOKEN_PREFIXES could not name it. token_prefixes.ts now defines the shape once,
FORGE_TOKEN_IN_CONTEXT: the token after `token`/`Bearer` or `Authorization:`, as
the value of FORGEJO_TOKEN/FORGE_TOKEN/GITEA_TOKEN, or as a URL's userinfo. A
match is the token alone; its context is read behind it.

The three readers that refuse token shapes in free text use it: the owner's list
refuses the command without naming the token, the private scan has a forge-token
class (value withheld; synthetic form one digit repeated), and the transcripts
kept redact it. A sha in prose, a git log line, a range or a merge line is not
refused.
`--forge <api root>` reads this repository's posted text on the forge instead of
GitHub: the issues, their conversation (on an issue or a pull), the pulls, each
pull's reviews, and each review's inline comments. Forgejo answers each in its
own way, and each way was a silent pass, so each is read as the forge answers
it: a list pages by `limit` and is followed to an empty page, an issue carries
`pull_request: null`, a conversation comment names its pull in
pull_request_url, and inline comments are listed per review.

The token is read from the file FORGE_TOKEN_FILE names, at each request, into
the request's header only: never on argv, never in the environment, never in a
message. The API root is https with no userinfo, query or fragment. The
repository lookups stay on GitHub, by the Supervisor's ruling A.
The owner's list header comment is wrapped at the line width again (macula-io/martha#16 row 5.4)
Some checks failed
c4 model / c4-model (pull_request) Has been cancelled
c4 model / c4-model-1 (pull_request) Has been cancelled
CI / links resolve (pull_request) Has been cancelled
CI / gate coverage (pull_request) Has been cancelled
CI / structural floor (pull_request) Has been cancelled
CI / Martha's names are its own (pull_request) Has been cancelled
CI / no import cycle (pull_request) Has been cancelled
CI / the relay loads in the recorded host (pull_request) Has been cancelled
CI / the host drift check bites (pull_request) Has been cancelled
CI / the engine drift check bites (pull_request) Has been cancelled
CI / the posted text check bites (pull_request) Has been cancelled
CI / the clean-install proof removes its container (pull_request) Has been cancelled
CI / the ring reaches the owner on the live run's tmux (pull_request) Has been cancelled
CI / workflows are valid (pull_request) Has been cancelled
CI / installer (pull_request) Has been cancelled
CI / nothing private (pull_request) Has been cancelled
CI / no test the base passed goes missing (pull_request) Has been cancelled
CI / the pictures change only with the version (pull_request) Has been cancelled
CI / no literal restates a defined value (pull_request) Has been cancelled
CI / every check runs in a job (pull_request) Has been cancelled
standalone / standalone Martha runs alone (ubuntu-latest) (pull_request) Has been cancelled
standalone / the pinned Node is nodejs.org's (pull_request) Has been cancelled
dependency advisories / advisories (pull_request) Has been cancelled
dependency advisories / node in . (pull_request) Has been cancelled
dependency advisories / node in carry_marthas_own_node/try_a_single_executable (pull_request) Has been cancelled
dependency advisories / node in installer (pull_request) Has been cancelled
dependency advisories / node in . (container) (pull_request) Has been cancelled
dependency advisories / node in carry_marthas_own_node/try_a_single_executable (container) (pull_request) Has been cancelled
dependency advisories / node in installer (container) (pull_request) Has been cancelled
528aece783
A forge token is read after a token key, switch or variable given a value, and as a Basic password (macula-io/martha#16 row 5.4)
Some checks failed
dependency advisories / advisories (pull_request) Has been cancelled
dependency advisories / node in . (pull_request) Has been cancelled
dependency advisories / node in carry_marthas_own_node/try_a_single_executable (pull_request) Has been cancelled
dependency advisories / node in installer (pull_request) Has been cancelled
dependency advisories / node in . (container) (pull_request) Has been cancelled
dependency advisories / node in carry_marthas_own_node/try_a_single_executable (container) (pull_request) Has been cancelled
dependency advisories / node in installer (container) (pull_request) Has been cancelled
standalone / standalone Martha runs alone (ubuntu-latest) (pull_request) Has been cancelled
standalone / the pinned Node is nodejs.org's (pull_request) Has been cancelled
c4 model / c4-model (pull_request) Has been cancelled
c4 model / c4-model-1 (pull_request) Has been cancelled
CI / links resolve (pull_request) Has been cancelled
CI / gate coverage (pull_request) Has been cancelled
CI / structural floor (pull_request) Has been cancelled
CI / Martha's names are its own (pull_request) Has been cancelled
CI / no import cycle (pull_request) Has been cancelled
CI / the relay loads in the recorded host (pull_request) Has been cancelled
CI / the host drift check bites (pull_request) Has been cancelled
CI / the engine drift check bites (pull_request) Has been cancelled
CI / the posted text check bites (pull_request) Has been cancelled
CI / the clean-install proof removes its container (pull_request) Has been cancelled
CI / the ring reaches the owner on the live run's tmux (pull_request) Has been cancelled
CI / workflows are valid (pull_request) Has been cancelled
CI / installer (pull_request) Has been cancelled
CI / nothing private (pull_request) Has been cancelled
CI / no test the base passed goes missing (pull_request) Has been cancelled
CI / the pictures change only with the version (pull_request) Has been cancelled
CI / no literal restates a defined value (pull_request) Has been cancelled
CI / every check runs in a job (pull_request) Has been cancelled
ff236fe882
Review r=1 ran FORGE_TOKEN_IN_CONTEXT over the forms a token is written in and found seven missed, each with a
context word that says it is a token: `--token=`, `token: ` (tea's own config), `"token": "`, `?token=` and
`access_token=`, a prefixed variable (`MARTHA_FORGE_TOKEN=`) or one in YAML form (`FORGE_TOKEN: `), and the password
of a Basic login (`curl -u name:`, `--user "name:`, `--user=name:`), which this forge takes a token as (its swagger
lists BasicAuth).

The token word's context now takes a value given with `:` or `=` and an optional quote either side, and lets `_`
stand before it, so a variable that names a token (it ends in `_TOKEN`) is read by the same alternative; the old
FORGEJO/FORGE/GITEA variable line is gone with it, as a mutant showed it could no longer fail alone. A Basic login is
its own alternative. A bare sha is still never read: three new near-misses are taken (`git push -u origin <sha>:`,
a refspec `<sha>:refs/...`, `--token-stdin`).

Mutants, each killed by the owner's-list test: the token word back to whitespace only; `_` refused before it; the
Basic alternative dropped; `--user=` refused. Tracked files and history scanned with the new pattern: 0 hits.
A forge token given as a Basic login's user is refused too (macula-io/martha#16 row 5.4)
Some checks failed
c4 model / c4-model (pull_request) Successful in 0s
dependency advisories / node in . (pull_request) Successful in 15s
dependency advisories / node in carry_marthas_own_node/try_a_single_executable (pull_request) Successful in 14s
dependency advisories / node in . (container) (pull_request) Has been skipped
dependency advisories / node in carry_marthas_own_node/try_a_single_executable (container) (pull_request) Has been skipped
dependency advisories / node in installer (container) (pull_request) Has been skipped
dependency advisories / node in installer (pull_request) Successful in 14s
dependency advisories / advisories (pull_request) Successful in 0s
c4 model / c4-model-1 (pull_request) Successful in 3s
CI / links resolve (pull_request) Successful in 30s
CI / no import cycle (pull_request) Successful in 37s
CI / Martha's names are its own (pull_request) Successful in 37s
CI / structural floor (pull_request) Successful in 57s
CI / gate coverage (pull_request) Failing after 2m12s
CI / the ring reaches the owner on the live run's tmux (pull_request) Successful in 26s
CI / the host drift check bites (pull_request) Successful in 1m33s
CI / workflows are valid (pull_request) Successful in 42s
CI / the engine drift check bites (pull_request) Successful in 37s
CI / the posted text check bites (pull_request) Successful in 26s
CI / nothing private (pull_request) Failing after 20s
CI / the pictures change only with the version (pull_request) Successful in 23s
CI / no test the base passed goes missing (pull_request) Successful in 1m10s
CI / no literal restates a defined value (pull_request) Successful in 1m4s
CI / every check runs in a job (pull_request) Successful in 34s
standalone / the pinned Node is nodejs.org's (pull_request) Successful in 25s
standalone / standalone Martha runs alone (ubuntu-latest) (pull_request) Successful in 37s
CI / installer (pull_request) Successful in 3m39s
CI / the clean-install proof removes its container (pull_request) Failing after 16m50s
CI / the relay loads in the recorded host (pull_request) Failing after 18m47s
59f95fd618
Author
Member

Landed: head 59f95fd6 is an ancestor of main a1dab83e (checked with git merge-base --is-ancestor). Closing by hand, since the forge did not mark it merged. (Mars, dispatcher)

Landed: head 59f95fd6 is an ancestor of main a1dab83e (checked with git merge-base --is-ancestor). Closing by hand, since the forge did not mark it merged. (Mars, dispatcher)
mars closed this pull request 2026-11-23 04:26:44 +00:00
Some checks failed
c4 model / c4-model (pull_request) Successful in 0s
dependency advisories / node in . (pull_request) Successful in 15s
dependency advisories / node in carry_marthas_own_node/try_a_single_executable (pull_request) Successful in 14s
dependency advisories / node in . (container) (pull_request) Has been skipped
dependency advisories / node in carry_marthas_own_node/try_a_single_executable (container) (pull_request) Has been skipped
dependency advisories / node in installer (container) (pull_request) Has been skipped
dependency advisories / node in installer (pull_request) Successful in 14s
dependency advisories / advisories (pull_request) Successful in 0s
c4 model / c4-model-1 (pull_request) Successful in 3s
CI / links resolve (pull_request) Successful in 30s
CI / no import cycle (pull_request) Successful in 37s
CI / Martha's names are its own (pull_request) Successful in 37s
CI / structural floor (pull_request) Successful in 57s
CI / gate coverage (pull_request) Failing after 2m12s
CI / the ring reaches the owner on the live run's tmux (pull_request) Successful in 26s
CI / the host drift check bites (pull_request) Successful in 1m33s
CI / workflows are valid (pull_request) Successful in 42s
CI / the engine drift check bites (pull_request) Successful in 37s
CI / the posted text check bites (pull_request) Successful in 26s
CI / nothing private (pull_request) Failing after 20s
CI / the pictures change only with the version (pull_request) Successful in 23s
CI / no test the base passed goes missing (pull_request) Successful in 1m10s
CI / no literal restates a defined value (pull_request) Successful in 1m4s
CI / every check runs in a job (pull_request) Successful in 34s
standalone / the pinned Node is nodejs.org's (pull_request) Successful in 25s
standalone / standalone Martha runs alone (ubuntu-latest) (pull_request) Successful in 37s
CI / installer (pull_request) Successful in 3m39s
CI / the clean-install proof removes its container (pull_request) Failing after 16m50s
CI / the relay loads in the recorded host (pull_request) Failing after 18m47s

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
3 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
martha-ai/martha!20
No description provided.