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

See what outside agents tried: a compact, redacted request log the owner can read #1009

Closed opened this in answer to
Closed without merging

The forge now writes a compact, redacted access log, and a forge admin can read it at Settings → Access or with the new MCP tool access. The new test/access-log.test.ts passes, and tsc is clean. The look (a screenshot with a replayed non-browser request) is not done.

Notes

stopped closed without shipping deploy eddefb7

opened this

The forge now writes a compact, redacted access log, and a forge admin can read it at Settings → Access or with the new MCP tool access. The new test/access-log.test.ts passes, and tsc is clean. The look (a screenshot with a replayed non-browser request) is not done.

What changed

  • The log: src/kernel/access_log.ts writes one tab-separated line per non-asset request to <data>/access/YYYY-MM-DD.log. /assets/, /icons/, /sw.js, the manifest, /favicon.ico and /healthz are skipped.
  • Fields: time, host, method, path without its query, status, ms, user agent (cut to 200 chars), in/out, and a client hash. The hash is an HMAC of the address under a key derived per UTC day from the data dir's secret.key. The raw address is never written.
  • Redaction: the query string is cut off and path segments of 24+ token-like characters become :redacted. Bearer values and long token-shaped runs in the user agent are scrubbed. Control characters are stripped. Cookies and Authorization are never read into a line.
  • Retention: 14 daily files, swept once a day, and each day capped at 4 MB. Past the cap, lines are dropped rather than the file growing. Nothing serves the files.
  • Reading it: readAccess returns non-browser requests to the public doors, newest first. A browser is any user agent containing Mozilla/. The doors are /issues, /api/, /mcp, /.well-known/, /llms.txt, /signin and /signup.
  • Page and tool: /settings/access (admin only, in the settings nav) has since/ua/path filters. The MCP tool access {since, ua?, path?} is writes: true, so a read-only token is refused. It also requires a forge admin. since takes an ISO time or an age like 24h or 7d, and defaults to the last day.
  • Tests: redaction (a planted token, cookie, query string and address never reach the file), the daily salt, rotation and the size cap. They also cover the MCP and page access rules, and that browser and asset requests are absent. The new file is added to scripts/gate.ts, and the pinned tool list in test/mcp.test.ts now includes access. The README has a short section.

Left out or limited

  • Screenshot: not done.
  • Signed-in: in means a credential was presented (an Authorization header or a forge_session cookie), not that it was verified. Verifying it would cost a lookup on every request.
  • Write path: lines are appended synchronously with no buffering. That is fine at this volume, but it is on the request path.
  • Non-browser rule: it is purely the user agent. An agent that sends a Mozilla/ user agent is hidden from the page and the tool.
  • Test environment: the sandbox blocks unix-socket listens, so I ran the tests unsandboxed.
  • Existing failures: test/studio.test.ts has 2 failures (setup timeouts) both with and without my change. The other cross files passed.

Try it: boot the app, run curl -A python-requests localhost:3000/api/v1/x, then open /settings/access as an admin. Or call the access tool with {"ua":"python"}.

🤖 Generated with Claude Code

Closes #665

commented

Parked by the crew: the check failed ("capacity: only a forge admin reads or changes it > an admin changes each one from the page, the API and MCP; a wrong value is refused; every change is kept") and the decider saw no point in another try

Sign in to join this conversation.

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs