/api/bootstrap is unauthenticated: whoever reaches an unclaimed install first becomes admin #40

Open
opened 2026-10-09 12:42:38 +00:00 by niklas · 0 comments
Owner

The concurrent-call race is fixed (advisory lock + transaction, test TestBootstrap_ConcurrentCallsCreateOneAdmin), but the endpoint is still open and unrate-limited until the first user exists. On a server exposed before someone bootstraps it, anyone can claim it.

Now that the operator no longer calls /api/bootstrap (it authenticates with TERDUT_OPERATOR_KEY), the first human admin is its only caller, so it can be gated:

  • Require a one-time token from the environment/Secret (TERDUT_BOOTSTRAP_TOKEN), or
  • Make bootstrap-job.yaml the only path and disable the route otherwise, and
  • Rate-limit the route like login/signup.

The chart's bootstrap Job also extracts the key with grep -o '"key":"[^"]*"'; use jq or have the server write the Secret.

Update examples/demo/run-demo.sh in terdut-operator if the call shape changes.

The concurrent-call race is fixed (advisory lock + transaction, test `TestBootstrap_ConcurrentCallsCreateOneAdmin`), but the endpoint is still open and unrate-limited until the first user exists. On a server exposed before someone bootstraps it, anyone can claim it. Now that the operator no longer calls `/api/bootstrap` (it authenticates with `TERDUT_OPERATOR_KEY`), the first human admin is its only caller, so it can be gated: - Require a one-time token from the environment/Secret (`TERDUT_BOOTSTRAP_TOKEN`), or - Make `bootstrap-job.yaml` the only path and disable the route otherwise, and - Rate-limit the route like login/signup. The chart's bootstrap Job also extracts the key with `grep -o '"key":"[^"]*"'`; use `jq` or have the server write the Secret. Update `examples/demo/run-demo.sh` in terdut-operator if the call shape changes.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: niklas/terdut-server#40