An app refused an outside host says so in the forge's words (#12182)
The forge's gate refuses every outside host that a repository's forge.json egress does not declare. The refusal says whose no it was, so an app never blames the service it was calling.
- The words. The status line and body are
403 refused by this forge: <host>:<port> is not in this app's forge.json egress, withX-Forge-Egress: refused(refusedWords,src/apps/egress.ts, the one source: #13537). The log line and the owner's Blocked row, on the page and in the terminal, print the same sentence, andtest/egress-words.test.tspins it literally. The template'ssrc/egress.tsreads the same words. - The log. The first refusal of a host and port in an hour is one line in the forge's log,
[egress] <app>: refused by this forge: <host>:<port> is not in this app's forge.json egress(a private destination:[egress] <app> was refused <host>:<port>: a private destination) (cellHooks,src/apps/egress_refused.ts). The line is printable ASCII, at most 200 bytes (logSafe), because the host is the app's own choice. The memory behind "once an hour" holds at most 2,000 keys (SAID_MAX); the oldest goes first. - Needs you. An admin of the repository sees one line per refused host: "game tried to reach huggingface.co and was refused: Allow it (3 tries, last just now)", linking to the app's settings (
needsYouLine, one wording forblockedLines). The page's needs-you stack and the terminal's both readblockedLinesthroughsrc/crew/notify.ts; Allow on the settings page lands the host live and inforge.json. - The crew. The brief tells an agent to add a host its change calls to
forge.jsonegressin the same change. - The check. A new app's
forge.jsoncarriescheck.run: bun scripts/egress-check.ts && bun test, which fails when a literal host in the code is not declared. - The template copy.
templates/app-template.jsoncarriesscripts/egress-check.ts,src/egress.tsand their tests. It is hand-edited until the template repository gets the same files:bun scripts/take-template.tsreplaces it from trevato/app-template, so the same change must land there first, or the next take reverts it.
Tests: test/egress-refused.test.ts, test/app-template.test.ts.