Repository navigation
Conversation
Optional mode identifies the caller when a valid Auth0 JWT is sent and continues anonymous otherwise, for public routes such as /prediction. Strict mode is unchanged. isBearerJWT replaces the inline helper in index.ts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Mount verifyAAIToken in optional mode on /prediction, after the rate limiter, so extension chats carry the caller's User.id to Langfuse again. Stop scoping the chatflow lookup by the caller's active workspace. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Real RS256 verification against a local issuer, Postgres with the app's migrations, real user/workspace provisioning and chatflow lookup. Runs only when TEST_PG_URL is set. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| ['/', '/:id'], | ||
| getMulterStorage().array('files'), | ||
| predictionsController.getRateLimiterMiddleware, | ||
| optionalAAIAuth, |
This branch had an error being 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.
Why
Chats from the Chrome extension reach Langfuse with no
userId. The IAS usage dashboard shows the extension as "no signed-in person since 2026-03-04".The extension never sent a user id. It sends the user's Auth0 JWT as
Authorization: Bearer. Before the Flowise 3.0.11 upgrade, the old middleware read that token on public routes (jwtCheckPublic,authRequired: false), soreq.userwas set. After the upgrade, whitelisted routes skip auth entirely, and/api/v1/prediction/is whitelisted.buildChatflowgetsuser = undefined, so the trace getsuserId = undefined.What changes
verifyAAITokengets anoptionalmode. With a valid Auth0 JWT it setsreq.user. With no header, an API key, an expired, forged or wrong-audience token, an org outsideAUTH0_ORGANIZATION_ID, or a DB error, the request continues anonymous. It never sends a 401. Strict mode (no options) is unchanged./predictionruns it after the rate limiter, at router level, the same way/auth/medoes. The global whitelist is not touched.createPredictionno longer scopes the chatflow lookup byreq.user.activeWorkspaceId. That filter came from upstream Chore/WorkspaceID Check FlowiseAI/Flowise#5228. On a public route it guards nothing, because the same request without a token is served. It would also 404 chatflows in the caller's other workspaces, which is the bug fixed for internal-predictions in 3cddc90. A comment and a test keep a future upstream merge from adding it back.isBearerJWTreplaces the identical inline helper insrc/index.ts.What else changes when a user is present
All four match what Studio already does on
/internal-prediction, and what/predictiondid before the upgrade:billedUserId = user?.id || chatflow.userId), unlessOVERRIDE_CUSTOMER_IDis set.ChatMessage.userIdis set, so extension chats may show in the user's Studio history.Merging to
stagingupdates the release PR to production for every tenant, so billing and chat history need an OK before this merges.Tests (all local; no workflow runs jest)
verifyAAITokenand 2 for the router. Each new test failed before the change.test/integration/prediction, 9 tests): real RS256 verification against a local issuer, Postgres with the app's own migrations, real user and workspace provisioning, real chatflow lookup. OnlybuildChatflowand the streaming check are mocked. It runs only whenTEST_PG_URLis set. Run steps are in the file header.req.user.idequal to the user's DB id, and two requests do not duplicate the user.console.warntext, so they are equivalent. Two more are on old router lines that are not in this diff.index.test.tssuite except the root one, before and after the change. Same result, plus the new suites.services/documentstore(3 tests) andauth/middleware(does not start: circular import atAzureSSO extends SSOBase) already fail onstaging.Not covered by these tests
src/index.tsis only reached by the full-server suite. It gets checked on staging.ias: a chat from the extension, a logged-out Help Center chat, and an agent execution resumed from Studio.userIdand cannot be recovered.🤖 Generated with Claude Code