Credential-less auth shim: authenticated HTTP request -> reconcile-trigger sentinel write (ADR 0037)
  • TypeScript 86.7%
  • JavaScript 6.9%
  • Dockerfile 6.4%
Hitta en fil
Kodförråd filer (senaste incheckning först)
Filnamn Senaste incheckningsmeddelande Senaste incheckningsdatum
Bitborg Renovate fa6707bfa8
Alla kontroller lyckades
ci / ci (push) Successful in 1m2s
chore(deps): update dev dependencies (non-major) (#92)
2026-11-30 01:37:03 +00:00
.forgejo/workflows fix: close the server on SIGTERM and audit dev dependencies too (#70) 2026-10-18 11:32:54 +00:00
.vscode build: add vscode config 2026-07-29 01:15:34 +02:00
src docs: name keycloak in the shim text and list the 500 response (#83) 2026-11-15 11:02:29 +00:00
.env.example chore: drop legacy name from .env.example (#69) 2026-10-17 21:08:43 +00:00
.gitignore feat: initial reconcile-trigger auth shim (ADR 0037 phase 2) 2026-07-29 00:49:54 +02:00
.markdownlint-cli2.jsonc fix: unbreak the ci format check and add lefthook hooks (#3) 2026-07-29 12:31:34 +00:00
.prettierignore feat: initial reconcile-trigger auth shim (ADR 0037 phase 2) 2026-07-29 00:49:54 +02:00
.prettierrc.json feat: initial reconcile-trigger auth shim (ADR 0037 phase 2) 2026-07-29 00:49:54 +02:00
Containerfile chore(deps): update toolchain to v24.22.3 (#86) 2026-11-16 00:37:24 +00:00
eslint.config.mjs chore: drop unused lint plugin, logger seam and dead build settings (#64) 2026-10-11 09:16:46 +00:00
lefthook.json fix: close the server on SIGTERM and audit dev dependencies too (#70) 2026-10-18 11:32:54 +00:00
LICENSE feat: initial reconcile-trigger auth shim (ADR 0037 phase 2) 2026-07-29 00:49:54 +02:00
package.json chore(deps): update dev dependencies (non-major) (#92) 2026-11-30 01:37:03 +00:00
pnpm-lock.yaml chore(deps): update dev dependencies (non-major) (#92) 2026-11-30 01:37:03 +00:00
pnpm-workspace.yaml chore(deps): set the pnpm release-age gate explicitly (#87) 2026-11-16 10:19:29 +00:00
README.md docs: name keycloak in the shim text and list the 500 response (#83) 2026-11-15 11:02:29 +00:00
renovate.json chore(renovate): opt in to the shared automerge-safe preset (#22) 2026-08-09 19:55:21 +00:00
tsconfig.build.json chore: drop unpinned sort-package-json hook, stale pin and dead lint config (#63) 2026-10-10 16:34:53 +00:00
tsconfig.json chore: drop unused lint plugin, logger seam and dead build settings (#64) 2026-10-11 09:16:46 +00:00
vitest.config.ts chore: drop unpinned sort-package-json hook, stale pin and dead lint config (#63) 2026-10-10 16:34:53 +00:00

bitborg-reconcile-trigger

A tiny, credential-less auth shim that turns an authenticated HTTP request into a reconcile-trigger sentinel write for bitborg — the network ingress adapter of the event-driven reconcile trigger (ADR 0037).

What it does

The entitlement reconciler (ADR 0035) is a oneshot fired promptly by a systemd .path unit when a sentinel file appears. Co-located bitborg-web writes that sentinel directly. Callers that can only reach the host over HTTP — the Forgejo repository webhook (new repos) and the future payment service (cross-host) — go through this shim instead:

POST /  (Authorization: Bearer <token>)  →  validate → touch the sentinel → 204

That's the whole job. The shim:

  • holds no Forgejo or Keycloak credentials — a valid token can at most request a reconcile the timer would run anyway, never dictate its outcome;
  • validates a per-source bearer token (constant-time), mapping it to a source label used only for logging;
  • fails closed: refuses to start without a sentinel path, or with a token under 32 characters, a duplicate token, an unparseable source=token pair or an invalid port.

It deliberately does not terminate TLS or do IP filtering: in production it runs as a container on the internal podman network (reached by name), with TLS + the firewall/allowlist handled at the edge (Caddy + nftables) by bitborg-infra.

Endpoints

Method Path Auth Response
GET /healthz none 200 (container health probe)
POST any Bearer 204 on valid token (sentinel written)
POST any Bearer 500 on valid token, sentinel write failed
POST any bad/absent 401
other — — 405

Configuration

See .env.example: RECONCILE_SHIM_SENTINEL, RECONCILE_SHIM_TOKENS (source=token,…), RECONCILE_SHIM_PORT (default 8099).

Development

pnpm install
pnpm test         # vitest
pnpm lint         # eslint + prettier
pnpm typecheck
pnpm build        # → dist/
pnpm dev          # build, then run dist/main.js

Deployed as a pinned container image (built + pushed by Forgejo Actions on a v* tag); consumed by bitborg-infra, with Renovate opening the bump PR — the same mechanics as the reconciler (ADR 0033 / ADR 0035). No :latest. Release order: merge the version bump, verify main and package.json, then tag. A tag pushed before the bump merges builds the wrong commit.

Licence

AGPL-3.0.