From cd804cf219c8489ecb16c3f1f27cca7a4c0c1d35 Mon Sep 17 00:00:00 2001 From: Barak Korren Date: Mon, 26 Oct 2026 10:19:32 +0200 Subject: [PATCH 1/2] ci(dispatch): enable mint OIDC for dispatch jobs Grant id-token access to route and harness-dispatch, and pass the configured mint URL to both gha-event dispatch steps. Add workflow validation for the permissions and mint URL contract, and document the caller-side permission requirement. Signed-off-by: Barak Korren Assisted-by: Codex (gpt-6) --- .github/workflows/reusable-dispatch.yml | 7 +++ docs/guides/user/custom-poller-example.md | 6 ++ .../scaffold/workflow_call_alignment_test.go | 59 +++++++++++++++++++ 3 files changed, 72 insertions(+) diff --git a/.github/workflows/reusable-dispatch.yml b/.github/workflows/reusable-dispatch.yml index 3446df9384..55c69f70dc 100644 --- a/.github/workflows/reusable-dispatch.yml +++ b/.github/workflows/reusable-dispatch.yml @@ -24,6 +24,9 @@ # # Security: all user-controlled inputs (comment body, labels, usernames) # are passed via env: variables, not interpolated in run: blocks. +# The route and harness-dispatch jobs need OIDC for mint-backed identity +# lookup. Callers must grant id-token: write; keep the token within each job +# and never write it to workflow outputs, logs, or matrix data. name: Dispatch on: @@ -118,6 +121,7 @@ jobs: contents: read issues: read pull-requests: read + id-token: write outputs: stage: ${{ steps.agent-check.outputs.skipped != 'true' && steps.route.outputs.stage || '' }} trigger_source: ${{ steps.route.outputs.trigger_source }} @@ -703,6 +707,7 @@ jobs: GITHUB_EVENT_NAME: ${{ github.event_name }} EVENT_ACTION: ${{ inputs.event_action }} ROUTE_AGENT: ${{ steps.cel-opt-in.outputs.agent }} + FULLSEND_MINT_URL: ${{ inputs.mint_url }} run: | set -euo pipefail # gha_text makes a value safe inside a ::notice::/::warning::/::error:: @@ -1850,6 +1855,7 @@ jobs: actions: write contents: read pull-requests: read + id-token: write outputs: matrix: ${{ steps.dispatch.outputs.matrix }} steps: @@ -1984,6 +1990,7 @@ jobs: GH_TOKEN: ${{ github.token }} GITHUB_EVENT_NAME: ${{ github.event_name }} EVENT_ACTION: ${{ inputs.event_action }} + FULLSEND_MINT_URL: ${{ inputs.mint_url }} run: | set -euo pipefail if [[ "${{ steps.triggers.outputs.has_triggers }}" != "true" ]]; then diff --git a/docs/guides/user/custom-poller-example.md b/docs/guides/user/custom-poller-example.md index fdf2d9e5c2..b25d3883c3 100644 --- a/docs/guides/user/custom-poller-example.md +++ b/docs/guides/user/custom-poller-example.md @@ -146,6 +146,12 @@ Required permissions: - `packages: read` - needed by code/fix agents - `actions: write`, `id-token: write`, `issues: write`, `pull-requests: write` - needed by all agents +`id-token: write` is needed for dispatch-time identity lookup and agent token +minting. Grant it in the caller workflow or on the job that calls +`reusable-dispatch.yml`; the reusable workflow cannot add permissions that the +caller did not grant. Keep the OIDC token inside the job. Do not copy it into +workflow outputs, the dispatch matrix, or logs. + ## Authorization When using a pre-computed matrix, the `.fullsend/config.yaml` agent-enablement checks are bypassed. The token mint service acts as the authorization boundary (see [mint-administration.md](../infrastructure/mint-administration.md)) - ensure your mint service is properly configured to control which agents external callers can invoke. diff --git a/internal/scaffold/workflow_call_alignment_test.go b/internal/scaffold/workflow_call_alignment_test.go index b20c6a17e8..8af39f7945 100644 --- a/internal/scaffold/workflow_call_alignment_test.go +++ b/internal/scaffold/workflow_call_alignment_test.go @@ -847,6 +847,65 @@ func TestReusableDispatchWorkflowContent(t *testing.T) { assert.Regexp(t, `(?s)ready-for-review"\s*\]\];\s*then\s*\n\s+if \[\[ "\$\{ISSUE_IS_PR\}"`, s) } +// TestReusableDispatchJobsReceiveMintOIDC validates permissions and mint URL +// wiring for both gha-event dispatch steps (#8814). The OIDC token remains +// job-local and is not copied into outputs, logs, or matrix data. +func TestReusableDispatchJobsReceiveMintOIDC(t *testing.T) { + type workflowStep struct { + Name string `yaml:"name"` + Run string `yaml:"run"` + Env map[string]string `yaml:"env"` + } + type workflowJob struct { + Permissions map[string]string `yaml:"permissions"` + Outputs map[string]string `yaml:"outputs"` + Steps []workflowStep `yaml:"steps"` + } + var workflow struct { + Jobs map[string]workflowJob `yaml:"jobs"` + } + + content, err := os.ReadFile(filepath.Join("..", "..", ".github", "workflows", "reusable-dispatch.yml")) + require.NoError(t, err) + require.NoError(t, yaml.Unmarshal(content, &workflow)) + + for _, tc := range []struct { + jobName string + stepName string + }{ + {jobName: "route", stepName: "Evaluate CEL route"}, + {jobName: "harness-dispatch", stepName: "Run fullsend dispatch"}, + } { + t.Run(tc.jobName, func(t *testing.T) { + job, ok := workflow.Jobs[tc.jobName] + require.True(t, ok, "job %q must exist", tc.jobName) + assert.Equal(t, "write", job.Permissions["id-token"], + "job %q must be able to request an OIDC token", tc.jobName) + + var dispatch workflowStep + for _, step := range job.Steps { + if step.Name == tc.stepName { + dispatch = step + break + } + } + require.NotEmpty(t, dispatch.Name, "job %q must include step %q", tc.jobName, tc.stepName) + assert.Contains(t, dispatch.Run, "--input-driver gha-event", + "step %q must use the GitHub event driver", tc.stepName) + assert.Equal(t, "${{ inputs.mint_url }}", dispatch.Env["FULLSEND_MINT_URL"], + "step %q must receive the configured mint URL", tc.stepName) + for name, value := range job.Outputs { + assert.NotContains(t, name, "ACTIONS_ID_TOKEN_REQUEST_TOKEN", + "job %q output names must not expose the OIDC request token", tc.jobName) + assert.NotContains(t, value, "ACTIONS_ID_TOKEN_REQUEST_TOKEN", + "job %q outputs must not expose the OIDC request token", tc.jobName) + } + }) + } + assert.NotContains(t, string(content), "ACTIONS_ID_TOKEN_REQUEST_TOKEN", + "the workflow must not copy the OIDC request token into logs or matrix data") +} + // TestCustomAppSetReviewBotWiring ensures every GitHub review/fix dispatch // path receives the configured app-set prefix and recognizes its exact review // bot identity. From 9f041f88e5e4c81c56ea5f7fc2ae7dc13ad835db Mon Sep 17 00:00:00 2001 From: Barak Korren Date: Mon, 26 Oct 2026 10:55:53 +0200 Subject: [PATCH 2/2] ci(dispatch): clarify caller OIDC permissions Signed-off-by: Barak Korren Assisted-by: Codex (gpt-6) --- .github/workflows/reusable-dispatch.yml | 4 ++-- docs/guides/user/custom-poller-example.md | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/reusable-dispatch.yml b/.github/workflows/reusable-dispatch.yml index 55c69f70dc..d34d76ff86 100644 --- a/.github/workflows/reusable-dispatch.yml +++ b/.github/workflows/reusable-dispatch.yml @@ -119,9 +119,9 @@ jobs: runs-on: ${{ inputs.runner_image }} permissions: contents: read + id-token: write issues: read pull-requests: read - id-token: write outputs: stage: ${{ steps.agent-check.outputs.skipped != 'true' && steps.route.outputs.stage || '' }} trigger_source: ${{ steps.route.outputs.trigger_source }} @@ -1854,8 +1854,8 @@ jobs: permissions: actions: write contents: read - pull-requests: read id-token: write + pull-requests: read outputs: matrix: ${{ steps.dispatch.outputs.matrix }} steps: diff --git a/docs/guides/user/custom-poller-example.md b/docs/guides/user/custom-poller-example.md index b25d3883c3..cf6f7ee2bf 100644 --- a/docs/guides/user/custom-poller-example.md +++ b/docs/guides/user/custom-poller-example.md @@ -146,8 +146,12 @@ Required permissions: - `packages: read` - needed by code/fix agents - `actions: write`, `id-token: write`, `issues: write`, `pull-requests: write` - needed by all agents -`id-token: write` is needed for dispatch-time identity lookup and agent token -minting. Grant it in the caller workflow or on the job that calls +`id-token: write` lets GitHub Actions issue the job a short-lived [OpenID +Connect (OIDC) token](how-fullsend-authenticates.md). Fullsend uses this token +to identify the calling workflow during dispatch and to mint short-lived +[GitHub App installation tokens](../../glossary.md#installation-token) for +agents. +Grant it in the caller workflow or on the job that calls `reusable-dispatch.yml`; the reusable workflow cannot add permissions that the caller did not grant. Keep the OIDC token inside the job. Do not copy it into workflow outputs, the dispatch matrix, or logs.