Repository navigation
feat(auth): implement service API key support for session creator in turns API - #1357
Merged
Merged
Conversation
thesujai
requested review from
chiragjn,
debajyoti-truefoundry and
heerambavi1998
as code owners
November 12, 2026 09:01
🦋 Changeset detectedLatest commit: 0658ad1 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
…ext for improved session handling
Stops a JWT caller from skipping owner and authorizer checks by sending assume-user alone. Co-authored-by: Cursor <cursoragent@cursor.com>
heerambavi1998
approved these changes
Nov 12, 2026
…xt and streamline session handling logic
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 24538a7. Configure here.
…veRequestContext parameter and clarifying assume-user handling
…RequestContext parameter and improve error handling for missing assume-user header
thesujai
enabled auto-merge (squash)
November 13, 2026 05:25
thesujai
disabled auto-merge
November 13, 2026 05:28
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
Closes AGE-2771
Changes
How was this tested?
Checklist
pnpm build,pnpm test,pnpm typecheck,pnpm lint:ci, andpnpm format:checkpass locallypackages/trueforge-sdk,python/trueforge_sdk,.github/fern/openapi/openapi.json,docs/openapi.json) — fork PRs omit SDK regen; maintainers regenerate after merge.env.exampleupdated if configuration or behavior changedNote
High Risk
Extends authentication so a service key plus
assume-userimpersonates the session creator on turn list/create, which is security-sensitive and changes route mounting order.Overview
Service API keys can now call list turns and create turn on
/api/v1/sessions/{session_id}/turnswhen they sendassume-user: session-creator, acting as the session’s creator instead of a JWT user.The server adds
assumeUserhandling (applyAssumeUserToContext,resolveTurnRequestContext), mounts turns behindcreateAuthOrServiceKeyMiddleware(JWT or service key) before JWT-only session routes, and tightens service create-turn to sessions bound to a named agent (no creator-owner check on that path). OpenAPI, Fern, and TypeScript/Python SDK clients expose optionalassumeUseron those session methods.Reviewed by Cursor Bugbot for commit 0658ad1. Bugbot is set up for automated code reviews on this repo. Configure here.