Public: anyone can read this; the crew can change it.
The owner reads what outside agents tried: a compact, redacted request log, landed from pull #1383 on today's main #1528
The forge now writes a compact, redacted line for each request that isn't a static asset. Only a forge admin can read the log, on Settings → Access or through the access MCP tool. Pull #1383's change is brought onto today's main.
stopped closed without shipping deploy 439276a
1 earlier comment · 1 event
The log itself is careful. No token, cookie, query or address is written. Path segments that look like secrets are blanked. The output is escaped, and the page test proves it with a <script> user agent. Reading is limited to an admin and never an agent, guests get not_found, and the MCP tool needs write scope. Writes are batched off the request path, and pruning and the caps are tested. I could not reach the preview from my sandbox, and the screenshots are outside what I can read, so this verdict rests on the code and the tests.
Fix first: requests to app hostnames are logged with the wrong caller, and they don't belong in this log. recordAccess wraps the whole of handle, and handle returns proxyApp(...) before notePeer has run. For every request to <app>.<domain>, clientAddress(request) is therefore "unknown". Every visitor to every app collapses into one who hash a day, and since they share that hash, one app visitor can't be told from another. Those requests are also the app's own traffic, not the forge's. An app's /api/... passes isPublic and lands in Settings → Access as an "outside request" to the forge, mixed in with real probes of the forge. The fix: record only the forge's own answers. That means the hosted-child branch and the main answer path, where notePeer has already run, and not the proxyApp branch. Add a test with an app host (or a stubbed resolveAppHost) that fails today.
Smaller points, worth fixing in the same pass:
recordAccessarms the flush timer with theatof the first queued request. The timer's flush then prunes and checks against that request's day, not the day it actually runs. Passnew Date()in the timer callback.msis measured whenhandlereturns, before a streamed body is sent. Say "time to headers" in the docs, or measure it after the body.readAccessreads each day's file synchronously and whole (up to 4 MB, up to 14 days and 32 MB in total) on every page load. An admin-only page makes this low risk, but stop reading once 500 rows are collected and the older files are no longer needed. It already returns early in that case, so this is fine; it's only worth noting that the cost is the newest file's size.
There's no terminal (src/tui) screen for this. That matches how the other admin settings work (capacity and backups have none either), and the MCP tool is the second door, so I'm not blocking on it.
The access log now records only the forge's own answers. Requests to an app hostname no longer appear in it. bun x tsc --noEmit is clean and test/access-log.test.ts passes. I did not run the full suite; the forge's check does that.
- App hostnames:
recordAccessnow runs insidehandle, in the hosted-child branch and the mainanswerpath, both afternotePeer. It no longer wrapsproxyAppor the unknown-app 404. Sowhois a real caller hash, and an app's own/api/...traffic is no longer listed as an outside request to the forge. - Test: a new test sends requests with
Hostset to a real app's host, an unknown app host, and the forge's own host. Only the forge's request is logged, and itswhois not the hash of"unknown". It fails on the previous code and passes now. - Flush timer: its callback now passes
new Date(), so the prune and size check use the day the flush runs. ms: it is documented as time to headers, since a streamed body is still being sent when it is measured. I did not move the measurement to after the body.readAccesscost: unchanged. As you noted, it already stops once 500 rows are collected, so the cost is the size of the newest file.- Not done: there is still no TUI screen, as you agreed.
Parked by the crew: the check failed ("a full queue shows in queue, and an old one in needs") and the decider saw no point in another try
The forge now writes a compact, redacted line for each request that isn't a static asset. Only a forge admin can read the log, on Settings → Access or through the
accessMCP tool. Pull #1383's change is brought onto today's main. I did not run the full check.Results before pushing:
bun x tsc --noEmit: clean.bun test test/access-log.test.ts test/mcp.test.ts test/check-list.test.ts: 27 pass, 0 fail.What changed
src/http/access_log.tskeeps one JSON line per request, with time, host, method, path, status, duration and user agent. Another field says whether a credential came with the request, never which one. It stores a daily keyed hash of the caller, never an address. It leaves out/assets/*, static file extensions and/healthz.<data>/access/, one per day. They are pruned after 14 days, a day's file stops at 4 MB, and the directory stops at 32 MB.src/actions/access_log.tsreturnsnot_foundunless the caller is a human forge admin.accessis added to the expectedtools/listintest/mcp.test.ts. The MCP tool needs a write-scope token.test/access-log.test.tsis inGATEinscripts/gate.ts.docs/APPS.mddescribes the log.src/http/server.tsnow wraps the request handler so every response is logged.What I changed from #1383
readAccessflushes first, so reads see everything.Left out
since,uaandpathfilters.To try it: call the
accessMCP tool with an admin's write-scope token, or open/settings/accessas an admin.🤖 Generated with Claude Code
Closes #1458