镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

JITSU-261: bearer authentication for the functions-server API - #1603

Closed
sahiltyagi-jitsu wants to merge 2 commits into
newjitsufrom
fix/jitsu-261-functions-server-auth
Closed

sahiltyagi-jitsu wants to merge 2 commits into
newjitsufrom
fix/jitsu-261-functions-server-auth

Conversation

@sahiltyagi-jitsu

@sahiltyagi-jitsu sahiltyagi-jitsu commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

JITSU-261 (audit finding T3, Critical). Part of JITSU-250. Companion infra PR is in jitsu-cloud-infra (ingress policy).

Problem

The functions-server HTTP API (/udfrun, /multi, /connection/...) trusted any caller that could reach the pod and used the workspaceId from the request body.

Change

Bearer authentication, off until tokens are configured: FUNCTIONS_SERVER_AUTH_TOKENS (hashed) or FUNCTIONS_SERVER_RAW_AUTH_TOKENS. Every route except /health needs a matching token, compared in constant time. Rotor's own callers send FUNCTIONS_SERVER_AUTH_KEY; the console and ingest already send ROTOR_AUTH_KEY. New env names, so rotor's own ROTOR_AUTH_TOKENS is untouched.

Verified

  • Unit tests for the auth module (open by default, raw and hashed tokens, bad headers); typecheck clean.

Run against a real Deno server (added)

  • The existing 30-test functions-chain suite passes against the real Deno functions-server with the auth code present and no tokens configured (default open behaviour unchanged).
  • New functions-server-auth.e2e.test.ts (7 tests) starts the real server with two tokens configured and calls it over HTTP: /health stays open; /udfrun, /profileudfrun, /multi and /connection/... return 401 without a token, with a wrong, truncated, or non-Bearer token; both configured tokens get past authentication.

Not verified / rollout

  • The tokens are not yet configured on any real deployment.
  • To switch on: set the tokens on the functions-servers and FUNCTIONS_SERVER_AUTH_KEY on rotor/profiles first, using the same key the console and ingest send.

/udfrun and the other endpoints trusted any caller that could reach the
pod and used the workspaceId from the request body. With
FUNCTIONS_SERVER_AUTH_TOKENS or FUNCTIONS_SERVER_RAW_AUTH_TOKENS set the
server now requires a matching bearer token (compared in constant time) on
every route except the health check. Rotor's own callers send
FUNCTIONS_SERVER_AUTH_KEY; the console and ingest already send
ROTOR_AUTH_KEY. Off until tokens are configured.

JITSU-261
@sahiltyagi-jitsu
sahiltyagi-jitsu marked this pull request as ready for review October 27, 2026 07:42
jitsu-code-review[bot]
jitsu-code-review Bot previously approved these changes Oct 27, 2026

@jitsu-code-review jitsu-code-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review of 269af326d07031de72305eb135a48d6ed0d22f70

Reviewed the full diff. Found one deployment integration defect that prevents authentication from remaining enabled on operator-managed functions servers.

Comment on lines +84 to +86
// Functions server HTTP auth (see lib/functions-server-auth.ts). Tokens set on the functions-server, key on its callers
FUNCTIONS_SERVER_AUTH_TOKENS: z.string().optional(),
FUNCTIONS_SERVER_RAW_AUTH_TOKENS: z.string().optional(),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[P1] [P1] Forward auth tokens through the functions-server operator

Operator-managed functions servers cannot retain these settings. bulker/operator/operator.go builds a fixed container environment without either token variable, and its configuration has no token forwarding or Secret reference. Manually enabling authentication on a Deployment is also undone when a function/configuration change triggers updateDeploymentFromData, which replaces the pod template. The replacement pods therefore silently return to unauthenticated access. Wire the token settings through the operator and its configuration hash so authentication survives reconciliation.

@jitsu-code-review jitsu-code-review Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review of 9f0ad5c4d4bfa5c0da6ea7c8c6cfc045c98e2543

Reviewed the entire incremental diff and relevant server, helper, and test configuration. No high-confidence defects found. Tests were not run because Deno and dependencies are unavailable.

@absorbb

absorbb commented Oct 27, 2026

Copy link
Copy Markdown
Contributor

already fixed

@absorbb absorbb closed this Oct 27, 2026
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.

2 participants