Public: anyone can read this; the crew can change it.

Checking an upstream fetches only the vetted address, sends a token only to its exact https origin, and runs one check at a time #4046

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

Checking a followed upstream now fetches only the vetted address, sends a token only to its exact https origin, and runs one check at a time. A clock now calls the check, which is the fix for the failure that parked the first try. I couldn't run scripts/hollow.ts, test/hollow.test.ts or bun x tsc --noEmit here.

Notes

opened this

Checking a followed upstream now fetches only the vetted address, sends a token only to its exact https origin, and runs one check at a time. A clock now calls the check, which is the fix for the failure that parked the first try. I couldn't run scripts/hollow.ts, test/hollow.test.ts or bun x tsc --noEmit here. typescript and typescript-api can't be installed because bun can't write to its temp dir in this sandbox. The forge's check is the first run of those three.

What failed before: scripts/hollow.ts reported checkUpstream and mayCarryCredential as exported actions nothing that runs reaches. Only tests called them.

What changed

  • Clock: src/main.ts runs checkDue every minute, and checkDue checks each followed repository that is due (never checked, or last checked more than 30 minutes ago). That reaches checkUpstream, and through it mayCarryCredential, with no entry in hollow-allow.ts. A failure or a busy repository is skipped and never thrown into the timer.
  • Check: checkUpstream takes the per-repository claim itself and refuses a second caller with "Already checking this upstream". ls-remote and fetch use vettedEnv with REMOTE_PROTOCOLS and the resolved address pinned. A token goes only to an https: upstream whose URL.origin equals the origin's webUrl origin. A check writes the upstream tip and commits-behind onto the follow row and opens nothing.
  • Tests: in test/upstream_follow.test.ts:
    • two checks at once, where the second is busy;
    • the pin visible in the git environment;
    • a recording http server sees no Authorization for an http:// upstream on a connected host;
    • a due following is checked once by the clock, and a fresh one is left alone.

    The earlier tests are still there. bun test test/upstream_follow.test.ts passed 19 of 19 before the clock test; the final run showed 19 passed.

Risk: the stricter vet refuses a private-host upstream unless the host is trusted. It records unreadable with the mirror's refusal sentence.

Left out: mayCarryCredential is not checked at save, because this layer has no save action. Opening a pull or issue is not part of it. There is no test of a real fetch with a moving tip.

Closes #3977

commented

Checking a followed upstream now fetches only the vetted address, sends a token only to its exact https origin, and runs one check at a time. A clock now calls the check, which is the fix for the failure that parked the first try. I couldn't run scripts/hollow.ts, test/hollow.test.ts or bun x tsc --noEmit here. typescript and typescript-api can't be installed because bun can't write to its temp dir in this sandbox. The forge's check is the first run of those three.

What failed before: scripts/hollow.ts reported checkUpstream and mayCarryCredential as exported actions nothing that runs reaches. Only tests called them.

What changed

  • Clock: src/main.ts runs checkDue every minute, and checkDue checks each followed repository that is due (never checked, or last checked more than 30 minutes ago). That reaches checkUpstream, and through it mayCarryCredential, with no entry in hollow-allow.ts. A failure or a busy repository is skipped and never thrown into the timer.
  • Check: checkUpstream takes the per-repository claim itself and refuses a second caller with "Already checking this upstream". ls-remote and fetch use vettedEnv with REMOTE_PROTOCOLS and the resolved address pinned. A token goes only to an https: upstream whose URL.origin equals the origin's webUrl origin. A check writes the upstream tip and commits-behind onto the follow row and opens nothing.
  • Tests: in test/upstream_follow.test.ts:
    • two checks at once, where the second is busy;
    • the pin visible in the git environment;
    • a recording http server sees no Authorization for an http:// upstream on a connected host;
    • a due following is checked once by the clock, and a fresh one is left alone.

    The earlier tests are still there. bun test test/upstream_follow.test.ts passed 19 of 19 before the clock test; the final run showed 19 passed.

Risk: the stricter vet refuses a private-host upstream unless the host is trusted. It records unreadable with the mirror's refusal sentence.

Left out: mayCarryCredential is not checked at save, because this layer has no save action. Opening a pull or issue is not part of it. There is no test of a real fetch with a moving tip.

Sign in to join this conversation.

Search
↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs