Skip to content

Add create-github-app-token plugin implementation - #1

Open
lox wants to merge 2 commits into
mainfrom
add-plugin-implementation
Open

Add create-github-app-token plugin implementation#1
lox wants to merge 2 commits into
mainfrom
add-plugin-implementation

Conversation

@lox

@lox lox commented Aug 22, 2026

Copy link
Copy Markdown

Why

Buildkite users need a first-party equivalent to actions/create-github-app-token that can securely create short-lived GitHub App installation tokens without embedding private keys in pipeline configuration.

What

  • adds a dependency-light Buildkite plugin that signs a short-lived JWT, discovers or accepts an installation, and requests repository- and permission-scoped tokens
  • accepts private keys only through Buildkite Secret or environment-variable references, registers tokens for redaction before export, and supports GitHub Enterprise Server
  • revokes tokens in pre-exit by default, with fail-closed handling and cleanup for temporary key and token state
  • documents least-privilege usage and includes CI plus automated coverage for creation, scoping, redaction, failures, revocation, and cleanup

Amp-Thread-ID: https://ampcode.com/threads/T-01a0277c-8ac1-77fc-91b8-f1fc859fe02f
Co-authored-by: Lachlan Donald <lachlan@buildkite.com>

@buildsworth-bk-app buildsworth-bk-app Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The preferred client-ID path rejects the identifier format GitHub now issues for newly created Apps; details inline.

Want to dig deeper?

Paste this into your agent to explore the findings from this review's Buildkite build:

Download the buildsworth logs from build 19610, then answer my questions about the findings.

Install the reading-buildsworth-logs skill to run this.

About buildsworth

Model: gpt-5.6-sol with xhigh thinking.

How to request a review: Comment @buildsworth-bk review on the PR, or request buildsworth-bk as a reviewer.

Risk labels (how buildsworth classifies risk) — buildsworth classifies risk itself from the diff. Unless repository policy already allows L2 approval, grant it by mentioning @buildsworth-bk (see approval ceiling and L2 approval grant):

  • L1 — Low risk (dep bumps, docs/copy, lockfiles, small presentational fixes). buildsworth may approve by default.
  • L2 — Standard risk (new UI, additive API fields, refactors). Approved only when repository policy or a verified grant allows it; otherwise comment-only.
  • L3 — High risk (auth, migrations, payments, secrets, perf-critical paths). Human review always required.

Comment thread lib/plugin.bash
client_id="$(plugin_indirect_value "$app_id_env" app-id-env)" || return
fi
[[ -n "$client_id" ]] || client_id="$(plugin_config app-id)"
[[ "$client_id" =~ ^(Iv1\.[A-Fa-f0-9]+|[0-9]+)$ ]] || {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocking: This accepts only legacy Iv1.<hex> client IDs, while newly created GitHub Apps receive opaque IDs such as Iv23li.... Those IDs are the preferred issuer documented by this plugin, but every such configuration fails here before JWT creation. Please treat client IDs as opaque non-empty values (while retaining numeric App-ID support) and cover the current format in a regression test.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still open — the current validation still only accepts Iv1.<hex> or numeric IDs, so opaque client IDs such as Iv23li... are rejected before JWT creation.

Amp-Thread-ID: https://ampcode.com/threads/T-01a0277c-8ac1-77fc-91b8-f1fc859fe02f
Co-authored-by: Lachlan Donald <lachlan@buildkite.com>

@buildsworth-bk-app buildsworth-bk-app Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous blocker is still open; this pass also found one command-environment side effect, called out inline.

Want to dig deeper?

Paste this into your agent to explore the findings from this review's Buildkite build:

Download the buildsworth logs from build 19628, then answer my questions about the findings.

Install the reading-buildsworth-logs skill to run this.

Comment thread lib/plugin.bash
local client_id client_id_env app_id_env private_key private_key_env private_key_secret
local installation_id installation_id_env output_variable skip_revoke jwt permissions payload token
local response state_dir
umask 077

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Blocking: Buildkite sources hook scripts into the job shell, so this changes the command's umask from the agent's value to 077 and never restores it. Every file or directory the user's command creates is therefore restricted (for example, 0666 becomes 0600), which can break shared workspaces and artifacts. Please preserve and restore the existing umask on every exit, or scope the restrictive mask to the sensitive file writes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants