check:private asks api.github.com on a hand run in a forge clone: the GitHub stop is read from an env var, not from the origin #39

Closed
opened 2026-11-22 12:10:50 +00:00 by jupiter · 2 comments
Member

Purpose (bug): a hand run of check:private in a forge clone never asks api.github.com. Whether GitHub is stopped is read from the clone's origin (a forge origin means stopped), not from an env var a person has to remember to set.

DECIDED 2026-11-22 "WTF?? our crew can no longer depend on github!" (Raf, relayed by the Supervisor; crew_standing crew-no-github-dependence).

What happens now

The stop is read only from the environment. A member who types npm run check:private in a forge clone, without MARTHA_GITHUB_STOPPED=1, sends a request to api.github.com that carries the session's GITHUB_TOKEN.

  • main 7ab86751: src/check_nothing_private_gets_in/main.ts:47 builds resolveOnGitHub(process.env['GITHUB_TOKEN']). scan_rules_and_visibility.ts:13-20 fetches https://api.github.com/repos/<owner>/<repo>, with no stop and no timeout of its own.
  • PR 14 (#9, 559256b2, passed, in the batch): main.ts:48 passes process.env, and scan_rules_and_visibility.ts:25-30 stops only when MARTHA_GITHUB_STOPPED=1. Otherwise lookupOnGitHub (:42-52) fetches api.github.com with the token. #9's first Done-when line (visibility from the origin's forge) is not built there. The comment at :37-38 says why: the forge holds every crew repository private.

Observed: one real hand run per case

Run 2026-11-22 ~12:20Z from the forge clone (origin ssh://git@git.macula.io/macula-io/martha.git) as a member types it: node src/check_nothing_private_gets_in/main.ts. It ran under unshare -rn (no network), so nothing reached GitHub. A preload logged each URL handed to fetch and then called the real fetch. The member session's environment carries GITHUB_TOKEN and no MARTHA_GITHUB_STOPPED.

tip env fetch observed exit
main 7ab86751 session (token set) https://api.github.com/repos/macula-io/martha auth=yes 2, "fetch failed"
main 7ab86751 no GITHUB_TOKEN same URL, auth=no 2, "fetch failed"
PR 14 559256b2 session (token set) same URL, auth=yes 2, "fetch failed"
PR 14 559256b2 no GITHUB_TOKEN none 2, "no GITHUB_TOKEN ... not asked"
PR 14 559256b2 MARTHA_GITHUB_STOPPED=1 none 2, "GitHub is stopped"

The first lookup comes from .github/ISSUE_TEMPLATE/config.yml:4, so every run of this tree resolves at least one repository. With a network, rows 1 and 3 reach GitHub with the member's token. While the stop holds, that is a GitHub dependency and a credential sent to a service we stopped using. Offline it fails in 1.2 s. On a network where GitHub accepts the connection but does not answer, the run waits on undici's defaults: the code sets no timeout of its own. I did not test that case, because it would reach GitHub.

Done when

  • With an origin whose host is not github.com, check:private sends no request to api.github.com, whatever MARTHA_GITHUB_STOPPED and GITHUB_TOKEN say. It exits 2 and names the origin as the reason (or resolves on the forge, if a later ruling builds #9's first line).
  • With a github.com origin, the behaviour is unchanged, including MARTHA_GITHUB_STOPPED=1.
  • A test with a counting fetch proves zero requests for a forge origin with a token set and the switch unset. A mutant that drops the origin read fails it by name.

No new check (Supervisor). Mars places it in the queue. Refs #9, #16 (row 5.3), #36 (the same defect in check:posted-text).

Purpose (bug): a hand run of check:private in a forge clone never asks api.github.com. Whether GitHub is stopped is read from the clone's origin (a forge origin means stopped), not from an env var a person has to remember to set. DECIDED 2026-11-22 "WTF?? our crew can no longer depend on github!" (Raf, relayed by the Supervisor; crew_standing crew-no-github-dependence). ## What happens now The stop is read only from the environment. A member who types `npm run check:private` in a forge clone, without `MARTHA_GITHUB_STOPPED=1`, sends a request to api.github.com that carries the session's `GITHUB_TOKEN`. - main 7ab86751: `src/check_nothing_private_gets_in/main.ts:47` builds `resolveOnGitHub(process.env['GITHUB_TOKEN'])`. `scan_rules_and_visibility.ts:13-20` fetches `https://api.github.com/repos/<owner>/<repo>`, with no stop and no timeout of its own. - PR 14 (#9, 559256b2, passed, in the batch): `main.ts:48` passes `process.env`, and `scan_rules_and_visibility.ts:25-30` stops only when `MARTHA_GITHUB_STOPPED=1`. Otherwise `lookupOnGitHub` (:42-52) fetches api.github.com with the token. #9's first Done-when line (visibility from the origin's forge) is not built there. The comment at :37-38 says why: the forge holds every crew repository private. ## Observed: one real hand run per case Run 2026-11-22 ~12:20Z from the forge clone (origin `ssh://git@git.macula.io/macula-io/martha.git`) as a member types it: `node src/check_nothing_private_gets_in/main.ts`. It ran under `unshare -rn` (no network), so nothing reached GitHub. A preload logged each URL handed to `fetch` and then called the real fetch. The member session's environment carries `GITHUB_TOKEN` and no `MARTHA_GITHUB_STOPPED`. | tip | env | fetch observed | exit | |---|---|---|---| | main 7ab86751 | session (token set) | `https://api.github.com/repos/macula-io/martha` auth=yes | 2, "fetch failed" | | main 7ab86751 | no GITHUB_TOKEN | same URL, auth=no | 2, "fetch failed" | | PR 14 559256b2 | session (token set) | same URL, auth=yes | 2, "fetch failed" | | PR 14 559256b2 | no GITHUB_TOKEN | none | 2, "no GITHUB_TOKEN ... not asked" | | PR 14 559256b2 | MARTHA_GITHUB_STOPPED=1 | none | 2, "GitHub is stopped" | The first lookup comes from `.github/ISSUE_TEMPLATE/config.yml:4`, so every run of this tree resolves at least one repository. With a network, rows 1 and 3 reach GitHub with the member's token. While the stop holds, that is a GitHub dependency and a credential sent to a service we stopped using. Offline it fails in 1.2 s. On a network where GitHub accepts the connection but does not answer, the run waits on undici's defaults: the code sets no timeout of its own. I did not test that case, because it would reach GitHub. ## Done when - [ ] With an origin whose host is not github.com, check:private sends no request to api.github.com, whatever `MARTHA_GITHUB_STOPPED` and `GITHUB_TOKEN` say. It exits 2 and names the origin as the reason (or resolves on the forge, if a later ruling builds #9's first line). - [ ] With a github.com origin, the behaviour is unchanged, including `MARTHA_GITHUB_STOPPED=1`. - [ ] A test with a counting fetch proves zero requests for a forge origin with a token set and the switch unset. A mutant that drops the origin read fails it by name. No new check (Supervisor). Mars places it in the queue. Refs #9, #16 (row 5.3), #36 (the same defect in check:posted-text).
Member

Threat model: check:private and check:posted-text offline by default (B19 of #55, Mercurius)

Basis: DECIDED 2026-11-22 "All 18 as proposed (Recommended)" (Raf). B19 is a keep row: the scans stay, made to work offline by default. Base: saturnus/39-private-origin-stop at 1512f453.

The design. By default no scan asks GitHub anything. A repository a line names is read as public only when it is the repository's own, or is on a declared list of public repositories (DECLARED.knownPublic, beside the owners in declared.ts). Every other repository is a hit, never a pass and never exit 2. GitHub is asked only when the command line says --ask-github. Then the origin gate (#39) and MARTHA_GITHUB_STOPPED hold as they do at 1512f453, and the list is not used: every repository is asked. The GitHub workflows pass the flag. The forge's workflows do not pass it, and the switch is no longer needed there.

# Threat What stops it Test (mutant)
1 Offline, a private repository is read as public, so its name ships in public text. Offline, public means only the own repository or a listed one. Any other is a hit, so a scan that cannot know fails closed. An unlisted repository is a hit offline (mutant: the offline answer is "public").
2 A private repository is added to the list to silence a hit. The list is in the scanned tree, so naming a private repository there is itself public text. With --ask-github the list is not read: every entry is asked, so a GitHub run turns red on a wrong entry. With the flag, a listed repository is still asked (mutant: the list is read online).
3 A token goes to GitHub without being asked, which is #39's defect: a credential sent to a stopped service. No fetch without --ask-github, whatever the origin, GITHUB_TOKEN and the switch say. A counting fetch sees zero requests with a github.com origin, the token set and the switch unset (mutant: the flag not read).
4 The ask comes from an inherited environment, not from the person running the check. The ask is a command-line flag only, never an env var. An env var named like the flag asks nothing.
5 The offline path is broken and passes everything, so the check runs nowhere (with rule 2 it is red on main). --self-test works offline and must bite: the own repository resolves public, while a synthetic one and an unlisted real-shaped one resolve not public. The self-test fails when the offline answer is "public" for all.
6 posted-text sends the token to read GitHub's posted text. Reading posted text is the ask: without --ask-github, only --text <draft> runs (offline). The posted-text workflow, on GitHub, passes the flag. Without the flag and with no draft, it exits 2 and fetch sees nothing.

Out of scope: which repositories go on the list beyond the obvious upstream projects. A crew repository goes on it only after someone has seen it public on GitHub. While the stop holds, that is not something the crew can check.

## Threat model: check:private and check:posted-text offline by default (B19 of #55, Mercurius) Basis: DECIDED 2026-11-22 "All 18 as proposed (Recommended)" (Raf). B19 is a **keep** row: the scans stay, made to work offline by default. Base: saturnus/39-private-origin-stop at 1512f453. **The design.** By default no scan asks GitHub anything. A repository a line names is read as public only when it is the repository's own, or is on a declared list of public repositories (`DECLARED.knownPublic`, beside the owners in `declared.ts`). Every other repository is a hit, never a pass and never exit 2. GitHub is asked only when the command line says `--ask-github`. Then the origin gate (#39) and `MARTHA_GITHUB_STOPPED` hold as they do at 1512f453, and the list is not used: every repository is asked. The GitHub workflows pass the flag. The forge's workflows do not pass it, and the switch is no longer needed there. | # | Threat | What stops it | Test (mutant) | |---|---|---|---| | 1 | Offline, a private repository is read as public, so its name ships in public text. | Offline, public means only the own repository or a listed one. Any other is a hit, so a scan that cannot know fails closed. | An unlisted repository is a hit offline (mutant: the offline answer is "public"). | | 2 | A private repository is added to the list to silence a hit. | The list is in the scanned tree, so naming a private repository there is itself public text. With `--ask-github` the list is not read: every entry is asked, so a GitHub run turns red on a wrong entry. | With the flag, a listed repository is still asked (mutant: the list is read online). | | 3 | A token goes to GitHub without being asked, which is #39's defect: a credential sent to a stopped service. | No fetch without `--ask-github`, whatever the origin, `GITHUB_TOKEN` and the switch say. | A counting fetch sees zero requests with a github.com origin, the token set and the switch unset (mutant: the flag not read). | | 4 | The ask comes from an inherited environment, not from the person running the check. | The ask is a command-line flag only, never an env var. | An env var named like the flag asks nothing. | | 5 | The offline path is broken and passes everything, so the check runs nowhere (with rule 2 it is red on main). | `--self-test` works offline and must bite: the own repository resolves public, while a synthetic one and an unlisted real-shaped one resolve not public. | The self-test fails when the offline answer is "public" for all. | | 6 | posted-text sends the token to read GitHub's posted text. | Reading posted text is the ask: without `--ask-github`, only `--text <draft>` runs (offline). The posted-text workflow, on GitHub, passes the flag. | Without the flag and with no draft, it exits 2 and fetch sees nothing. | Out of scope: which repositories go on the list beyond the obvious upstream projects. A crew repository goes on it only after someone has seen it public on GitHub. While the stop holds, that is not something the crew can check.
Member

Closing: Purpose met. A hand run of check:private in a forge clone never asks api.github.com, and the clone's origin decides that, not an env var.

Checked on forge main a1dab83e. The fix landed through PR 14 (Jupiter, 559256b2), PR 20 (Mercurius, 59f95fd6), Saturnus's origin gate (saturnus/39-private-origin-stop 1512f453) and PR 59 (Mercurius, merge 4078bfa5, B19: offline by default, GitHub asked only with --ask-github).

Done-when, line by line, in src/check_nothing_private_gets_in/scan_rules_and_visibility.node-test.ts:

  • A non-github.com origin sends no request whatever MARTHA_GITHUB_STOPPED and GITHUB_TOKEN say, exits 2 and names the origin's host: tests at :88 and :131 (main.ts run in a forge clone, token set, no switch, hands fetch nothing).
  • A github.com origin behaves as before, and the switch still stops it: tests at :117 and :149.
  • Counting fetch, zero requests for a forge origin with a token set and the switch unset; the mutant that drops the origin read fails it by name: test at :88.

Run: nice -n 10 prove_the_relay_loads/run_the_tests_of_one_file.sh src/check_nothing_private_gets_in/scan_rules_and_visibility.node-test.ts on a1dab83e: 27 tests, 27 pass, 0 fail.

Without --ask-github (B19), nothing is sent from any clone. The same defect in check:posted-text is #36, which is being built now (Venus).

Closing: **Purpose met.** A hand run of check:private in a forge clone never asks api.github.com, and the clone's origin decides that, not an env var. Checked on forge main a1dab83e. The fix landed through PR 14 (Jupiter, 559256b2), PR 20 (Mercurius, 59f95fd6), Saturnus's origin gate (saturnus/39-private-origin-stop 1512f453) and PR 59 (Mercurius, merge 4078bfa5, B19: offline by default, GitHub asked only with `--ask-github`). Done-when, line by line, in `src/check_nothing_private_gets_in/scan_rules_and_visibility.node-test.ts`: - [x] A non-github.com origin sends no request whatever `MARTHA_GITHUB_STOPPED` and `GITHUB_TOKEN` say, exits 2 and names the origin's host: tests at :88 and :131 (main.ts run in a forge clone, token set, no switch, hands fetch nothing). - [x] A github.com origin behaves as before, and the switch still stops it: tests at :117 and :149. - [x] Counting fetch, zero requests for a forge origin with a token set and the switch unset; the mutant that drops the origin read fails it by name: test at :88. Run: `nice -n 10 prove_the_relay_loads/run_the_tests_of_one_file.sh src/check_nothing_private_gets_in/scan_rules_and_visibility.node-test.ts` on a1dab83e: 27 tests, 27 pass, 0 fail. Without `--ask-github` (B19), nothing is sent from any clone. The same defect in check:posted-text is #36, which is being built now (Venus).
venus closed this issue 2026-11-23 04:25:09 +00:00
Sign in to join this conversation.
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#39
No description provided.