Repository navigation
feat: add ParticipantTokens.require and portal X-Participant-Token header plumbing - #1439
Open
JorimTheuns wants to merge 6 commits into
Open
JorimTheuns wants to merge 6 commits into
JorimTheuns wants to merge 6 commits into
Conversation
JorimTheuns
force-pushed
the
feat/portal-participant-token
branch
from
November 30, 2026 12:15
da5f99b to
2ffc356
Compare
JorimTheuns
changed the base branch from
main
to
fix/verify-manual-edit-pii-redaction
November 30, 2026 12:15
JorimTheuns
force-pushed
the
fix/verify-manual-edit-pii-redaction
branch
from
December 1, 2026 22:29
98ffb51 to
7c2d14e
Compare
JorimTheuns
force-pushed
the
feat/portal-participant-token
branch
from
December 1, 2026 22:33
24b8fbb to
ee3da74
Compare
… it on finish - A participant.token_invalid answer clears the stored token and resends the call once without it (the server checks the token before doing anything), so a chunk upload is not lost. The retry logs a warning. - Only participant.token_invalid counts as a rejection; other 403s keep the token. - The finish screen keeps the token while open (report sign-up, the landscape step) and clears it on leaving, deferred so StrictMode's dev remount does not count; /start still clears every token. - Verify helpers take the conversation id as a required string.
…participant-token
…participant-token # Conflicts: # dembrane/frontend/src/locales/cs-CZ.po # dembrane/frontend/src/locales/de-DE.po # dembrane/frontend/src/locales/en-US.po # dembrane/frontend/src/locales/es-ES.po # dembrane/frontend/src/locales/fr-FR.po # dembrane/frontend/src/locales/it-IT.po # dembrane/frontend/src/locales/nl-NL.po # dembrane/frontend/src/locales/uk-UA.po
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds strict participant token verification on the backend and
X-Participant-Tokenstorage and header attachment in the web portal so upcoming landscape, handoff, and public-intake routes can require participant tokens without breaking existing sessions.Changes
dembrane/platform/packages/conversations/src/participant-token.ts):ParticipantTokens.require(header, conversationId, projectId?), which rejects missing headers withUnauthenticatedErrorand invalid, forged, or mismatched tokens withForbiddenErrorregardless ofPARTICIPANT_TOKEN_REQUIRED.tokens.check(...)so in-flight recordings and dashboard uploads are unaffected on deploy.ParticipantTokens.requireinportal-units.test.ts.dembrane/frontend/src/lib/participantToken.ts,dembrane/frontend/src/lib/api.ts, portal routes/hooks/components):X-Participant-TokenfromPOST /api/participant/projects/:project_id/conversations/initiatein theapiNoAuthresponse interceptor (CORS already exposesx-participant-tokenand reflectsAccess-Control-Request-Headers).sessionStorageunderportal:token:<conversationId>with an in-memory fallback whensessionStoragethrows in private browsing, so tokens do not linger across sessions on shared tablets.ParticipantPostConversation, dashboard upload finish, andParticipantStartmount for fresh shared-tablet sessions) and on403token-rejection errors (participant.token_invalidor bare403) across bothapiNoAuthand ExploreuseChat.X-Participant-Tokenvia one shared explicit helper (participantTokenConfig/participantTokenHeaders) at every participant conversation API call: upload URL, upload confirmation, text upload, finish, summary, conversation/chunk/reply polling, chunk delete, S3 connectivity check, heartbeat and keepalive leave pings, report subscription, Explore replies (useChat), and Verify artifact generation, listing, fetching, revision, and approval.sessionStoragestorage, private-browsing fallback,initiatecapture, header attachment, finish/start clearing, and403token-rejection clearing.Verification
bun test(57/57 passing inpackages/conversationsunit tests),bunx biome ci .,bun run typecheck.vitest run src/portal src/lib(51 files, 398/398 passing),pnpm lint,pnpm exec tsc,pnpm messages:extract,pnpm messages:compile,node scripts/check-translations.mjs --strict,node scripts/sync-accounts-contract.mjs --check,node scripts/sync-error-codes.mjs --check,pnpm run check:case.Review fixes (supersede the Changes above where they differ)
participant.token_invalid, not on a bare 403.getVerificationArtefactByIdandupdateVerificationArtefactnow requireconversationId.Known limits
PARTICIPANT_TOKEN_REQUIREDis off.