Skip to content

WB-184: auth port#7

Merged
kacpercierzniewski merged 6 commits into
mainfrom
WB-184-auth-port
May 27, 2026
Merged

WB-184: auth port#7
kacpercierzniewski merged 6 commits into
mainfrom
WB-184-auth-port

Conversation

@kacpercierzniewski
Copy link
Copy Markdown
Contributor

No description provided.

Introduces an AuthPort interface so consumers can plug their own auth
provider into the reference backend without forking HTTP routes. Ships
with AllowAllAuthPort as the permissive default (loud startup warning)
and a docs guide showing a JWT-based implementation.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
feat(backend): add AuthPort seam for backend
Comment thread apps/backend/src/routes/workflows.ts
kacpercierzniewski and others added 2 commits May 22, 2026 14:19
The previous refactor dropped logger.info('execute requested') and
logger.warn('snapshot invalid') from the execute handler. Two effects:
ESLint flagged the `logger` import as unused, and operationally there
was no way to correlate a client execute request with the backend
executionId, or to surface invalid published snapshots in dashboards.
Restored at the same call sites as before.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@kacpercierzniewski kacpercierzniewski marked this pull request as draft May 26, 2026 11:23
kacpercierzniewski and others added 2 commits May 26, 2026 13:59
…efault, route tests

- Replace `Authorize` (Response | null) with `assertAuthorized` that throws
  `AuthDeniedError`; `app.onError` in server.ts maps to 401/403. Removes the
  `if (denied) return denied` footgun: a handler that calls the assertion
  cannot accidentally let the next line run.
- Add optional `attributes` slot to per-row AuthResource kinds so future ABAC
  ports can receive loaded rows without a breaking change.
- Flip AllowAllAuthPort polarity: require explicit `WB_AUTH_PORT=allow-all`
  to construct, instead of "wide everywhere except NODE_ENV=production".
  Default-secure now means a forgotten env var fails loudly. .env(.example)
  ship the variable for local dev.
- Add routes/workflows.test.ts and routes/executions.test.ts pinning that
  every handler calls assertAuthorized with the correct action+resource,
  and that deny short-circuits before any DB or engine work.
- ADR refresh: SSE / EventSource caveats (cookie or short-lived query
  token), CORS gotchas for real ports, provider-specific JWT roles claim
  note, throw-based decision rationale.
- README: "No real authentication" first; the AllowAllAuthPort mention
  follows as the mechanism, not the headline.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@kacpercierzniewski kacpercierzniewski marked this pull request as ready for review May 26, 2026 12:44
@kacpercierzniewski kacpercierzniewski merged commit 78b875b into main May 27, 2026
2 of 4 checks passed
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