Skip to content

fix(arc): read the App's id from an existing App Secret - #17

Merged
Mearman merged 1 commit into
mainfrom
fix/arc-app-id-from-secret
Sep 26, 2026
Merged

Mearman merged 1 commit into
mainfrom
fix/arc-app-id-from-secret

Conversation

@Mearman

@Mearman Mearman commented Sep 26, 2026 •

Copy link
Copy Markdown
Member

This came out of a consumer adopting v1.2.0. It keeps its App Secret outside the role (github_runner_arc_manage_secrets: false) and had to read that Secret itself, only to pass github_app_id back in as the org's app_id.

This is stacked on the fix that assembles the fleet from this host's orgs however they were supplied. Both change the same lines of validate.yml, so this PR's base is that branch. Retarget this PR to main before merging the other one with branch deletion, or merge the two as a stack.

With manage_secrets false the role never uses app_id. It writes no App Secret, resolves no installation id, and the App-sourced pull token already reads the id from the Secret. Validation still required it for every org. app_id is now required only on a host that writes the App Secret, and the error message says so and names the other source. The fleet-wide expansion used for the cross-host checks no longer asks for app_id, because only each host's own check knows whether that host writes the Secret.

Since the Secret is now the only source, the existing-Secret check does a bit more, before anything changes. Each App Secret must hold github_app_id, github_app_installation_id and github_app_private_key, and an app_id the org still sets must match the Secret's github_app_id. The messages name the Secret, the missing keys or both ids. The lookup is no_log. The checks now loop over a reduction to names, key names and the App's id, not over the raw lookup results: a failing loop prints its items, and I caught a first version of this change printing a Secret's data that way. The checks live in check_existing_secret_contents.yml, so they can be tested without a cluster.

Testing:

  • Filter unit tests cover app_id both ways.
  • tests/unit/test_existing_secrets.py drives the checks at -vvv with lookup results shaped as k8s_info returns them. It covers a complete Secret with and without a matching app_id, a mismatch, a missing key, a missing Secret and a host that writes its own Secrets, and asserts the key material never appears in the output.
  • Against a live cluster in check mode, a fleet that writes its Secrets ran the same tasks with the same result as v1.2.0.
  • With manage_secrets: false and no app_id, that fleet passes, where v1.2.0 fails with "app_id is required".
  • With a wrong app_id it fails with the mismatch message, and a scan of the run's log found no key material.

@Mearman
Mearman force-pushed the fix/arc-app-id-from-secret branch from 4906f3c to de92e4d Compare September 26, 2026 05:11
@Mearman
Mearman changed the base branch from main to fix/arc-fleet-includes-play-orgs September 26, 2026 05:11
@Mearman
Mearman force-pushed the fix/arc-app-id-from-secret branch 2 times, most recently from 0b2c011 to 3763b59 Compare September 26, 2026 05:27
@Mearman
Mearman marked this pull request as ready for review September 26, 2026 05:35
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
🔒 Security Review ✅ Completed 2026-09-26T05:38:19.637334Z 3763b59 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Base automatically changed from fix/arc-fleet-includes-play-orgs to main September 26, 2026 05:36
The role required every org's app_id even with
github_runner_arc_manage_secrets false, when it writes no App Secret
and reads the id from the existing Secret wherever it needs one, so
a consumer had to read that Secret itself just to pass the id back.
app_id is now required only on a host that writes the App Secret;
the fleet-wide expansion no longer asks for it, since only each
host's own check knows whether it writes the Secret.

With an existing App Secret the role now checks it holds
github_app_id, github_app_installation_id and
github_app_private_key, and that an app_id the org still sets
matches the Secret's github_app_id, before anything changes. The
Secret lookup is no_log, and the checks loop over a reduction to
names, key names and the App's id, so no failure or verbose output
can print a Secret's data.
@Mearman
Mearman force-pushed the fix/arc-app-id-from-secret branch from 3763b59 to 8d6ad74 Compare September 26, 2026 05:36
@Mearman
Mearman merged commit e0854d2 into main Sep 26, 2026
15 checks passed
@Mearman
Mearman deleted the fix/arc-app-id-from-secret branch September 26, 2026 05:43
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 1.2.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant