feat(github): add JIT token API endpoint for agent GitHub access#964
Open
sh1nj1 wants to merge 1 commit into
Open
feat(github): add JIT token API endpoint for agent GitHub access#964sh1nj1 wants to merge 1 commit into
sh1nj1 wants to merge 1 commit into
Conversation
Add GET /github/api/token?creative_id=123 endpoint that returns the requesting user's GitHub OAuth token with security checks: - User must have write+ permission on the creative - GitHub integration must exist on the creative or an ancestor - Returns the requesting user's own GithubAccount token This enables external agents (e.g., OpenClaw) to securely obtain GitHub tokens at execution time without embedding them in prompts or chat context.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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
Add
GET /github/api/token?creative_id=123endpoint that enables external agents (e.g., OpenClaw) to securely obtain GitHub OAuth tokens at execution time.Security Checks
writeor higher permission on the creativeRepositoryLink) must exist on the creative or one of its ancestorsGithubAccount.token(not the integration owner's)Use Case
Instead of embedding GitHub tokens in prompts/chat context, agents can call this API at execution time:
Files Changed
engines/collavre_github/app/controllers/collavre_github/api/base_controller.rb— OAuth-based API auth (Doorkeeper)engines/collavre_github/app/controllers/collavre_github/api/tokens_controller.rb— Token endpoint with permission/integration checksengines/collavre_github/config/routes.rb— Route registrationengines/collavre_github/test/controllers/collavre_github/api/tokens_controller_test.rb— 7 tests covering auth, permissions, ancestor lookup, and happy pathTests
All 1291 tests pass (0 failures, 0 errors).