Repository navigation
feat(tools): mint-token and agent session setup for the agent app (AGT-4, AGT-5) - #11
Merged
Merged
Conversation
tools/agent/mint-token reads the app key with op read straight into openssl, signs the JWT, and prints an installation token limited to the named repositories, for GH_TOKEN of an agent session. Key and JWT never reach a file, a command line or the output. The test runs it against a throwaway key, a fake op and a local fake API; the tools workflow runs it. CODEOWNERS names tools/ and .github/ for the maintainer (AGT-10). Signed-off-by: Moep90 <3042152+Moep90@users.noreply.github.com>
…(AGT-5) Fedora setup for a session whose only GitHub credential is the app token: a separate OS user started with run0, or a rootless podman container with a named volume. Both keep the maintainer's home, keyring, 1Password, Vault token and SSH and GPG keys out of reach. Ends with the checks of AGT-5. Signed-off-by: Moep90 <3042152+Moep90@users.noreply.github.com>
|
5 finding(s), none judged useful, approved |
neat-bot
approved these changes
Nov 5, 2026
neat-bot
left a comment
There was a problem hiding this comment.
I went through this change and have nothing to flag.
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.
These are the workstation tools for agent sessions under the agent app. The spec is in kadet-hub/registry#558 (AGT-4, AGT-5), and the setup checklist is at the end of that pull request.
tools/agent/mint-tokenprints an installation token for the repositories I name. That token becomesGH_TOKENof an agent session. The script takesAGENT_APP_ID(client ID or app ID) andAGENT_KEY_REF(theop://reference).op readpipes the key straight intoopenssl dgst -sign, so the key is never a file, a shell variable or an argument.curlgets the JWT on stdin, because other local users can read a process's command line.GET /orgs/kadet-hub/installation. The token request names the repositories, so the token covers nothing else.tools/agent/test_mint_token.pygenerates a throwaway RSA key, puts a fakeopand acurlwrapper that logs its arguments onPATH, and runs the script against a local fake API throughGITHUB_API_URL. It checks:iat60 s back,expwithin 10 minutes and a numericiss;{"repositories": [...]};curl's command line;Six mutations of the script each made the suite fail: the JWT on
curl's argv, the key through a temp file (two variants), no repositories in the body, no argument check, and an error that prints the body and the JWT. The newtoolsworkflow runs the suite on pull requests that changetools/.tools/agent/sessions.mdsets up a session on Fedora in one of two ways:run0 --setenv=GH_TOKENwithPrivateTmpandProtectProc=invisible;--env GH_TOKEN.Either way the session can't reach my home, the keyring with the
ghlogins, 1Password, the Vault token or the SSH and GPG keys. The bot identity,gh auth setup-gitand the AGT-5 checks are the same for both. I testedgh auth setup-gitandgh auth git-credentialwith only a dummyGH_TOKENin a throwaway home: the helper answersx-access-token. I checked that a transient unit's environment shows insystemctl showfor an unprivileged user, which is why the guide warns aboutrun0. I did not create a user or build the image on this machine, so the guide's checks are what verifies it..github/CODEOWNERSnames/.github/and/tools/. The script handles the app key, and the app will be able to open pull requests here. The file changes nothing until code owner review is on in this repository'smainruleset, which is step 7 of the checklist.