Skip to content

fix(agent): serve only agent paths on the agent mTLS port - #191

Merged
fog-workflows[bot] merged 1 commit into
masterfrom
fix/agent-port-allowlist
Nov 10, 2026
Merged

fog-workflows[bot] merged 1 commit into
masterfrom
fix/agent-port-allowlist

Conversation

@mastacontrola

Copy link
Copy Markdown
Member

Problem

The fog-agent mTLS listener passed every request to the app. The admin UI, /login and /api/v1/* answered on the agent port.

Change

  • api/hooks/agent-tls/index.js: agentPath(url) allows only /agent/v1/* and the two CA files (/management/other/ca.cert.pem, ca.cert.der). Every other path gets 404 {"error":"not found"} before Express runs, so no session is made.
  • The check reads the raw path with no decoding. It refuses any character outside [A-Za-z0-9/_.-] and requires path.posix.normalize(raw) === raw. So /%61gent/v1/poll, %2F, .., \\ and NUL get 404.
  • Every path that fog-agent sends passes (checked in the fog-agent source: enroll, poll, renew, result, payload, identity/check, directory/rejoin/start, the CA probe). The 1.6 wire is unchanged.
  • docs/install.md describes the restricted port.

Test

  • npm test: 436 passing. The unit tests list allowed and refused paths, the encoded bypasses included. The integration test checks /login, / and /api/v1/host for 404 over mTLS with no cookie and no new session, and the CA file for 200.
  • With the old decode-first check put back, the bypass test fails (/%61gent/v1/poll true !== false).

🤖 Generated with Claude Code

The agent listener answered every route of the app, the admin UI too.
It now passes only /agent/v1/* and the two CA files to the app. Every
other path gets 404 {"error":"not found"}. The check reads the raw
path with no decoding, refuses any character outside [A-Za-z0-9/_.-],
and requires a normalized path, so /%61gent/v1/poll cannot reach /login.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@fog-workflows
fog-workflows Bot enabled auto-merge November 10, 2026 18:29
@fog-workflows
fog-workflows Bot added this pull request to the merge queue Nov 10, 2026
Merged via the queue into master with commit b44514b Nov 10, 2026
6 checks passed
@fog-workflows
fog-workflows Bot deleted the fix/agent-port-allowlist branch November 10, 2026 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant