Skip to content

ci: turn off persist-credentials where no job pushes and add actions.lock - #8999

Closed
Totara-thib wants to merge 2 commits into
floci-io:mainfrom
Totara-thib:ci/checkout-without-stored-token
Closed

Totara-thib wants to merge 2 commits into
floci-io:mainfrom
Totara-thib:ci/checkout-without-stored-token

Conversation

@Totara-thib

Copy link
Copy Markdown

Summary

Hello some CI hardening contribution:

build-images.yml already checks out with persist-credentials: false. This does the same for the 34 other checkouts that keep the job token in jobs that never push. A job like push-native in release.yml and nightly.yml holds the Docker Hub token and the AWS role: after tj-actions (CVE-2025-30066), the less it carries on disk the better.

  • Two checkouts keep the token because their job pushes with git: docs.yml (mkdocs gh-deploy) and release-cut.yml (semantic-release).
  • The second commit adds actions.lock, GitHub's workflow dependency lockfile, from gh actions-lock --no-narrow: your commit pins stay, it records what those actions call in turn (setup-uv, actions/attest), and Dependabot regenerates it with each update.
  • The tool cannot follow a ./ action, so the zstd image action becomes $/ in three workflows (same action, at the workflow's commit). Say so and I drop that commit.

No test added, only workflow files change. Release, nightly and docs workflows do not run here.

Found and fixed with Plumber (C 64/100 before, up to A 90/100 after), reviewed and submitted by me.

Type of change

  • Bug fix (fix:)
  • New feature (feat:)
  • Breaking change (feat!: or fix!:)
  • Docs / chore

AWS Compatibility

No change: CI workflows only.

Checklist

  • ./mvnw test passes locally
  • New or updated integration test added
  • Commit messages follow Conventional Commits
  • I have no more than 2 open, non-draft pull requests and no more than 4 open pull requests in total (drafts included) in this repository (maintainers and dependency bots are exempt).

actions/checkout keeps the job token in the git configuration until the
job ends, so every later step of the job can use it through git.
build-images.yml already opts out on its four checkouts. This does the
same for the other jobs that only read the repository: the test shards,
the compatibility suites, the drift and docs checks, the Helm chart
jobs, the nightly and release image builds, the standalone binaries and the
Maven cache pruning job.

None of these jobs pushes or fetches with git after the checkout. What
is left is local: rev-parse, log and diff in the workflows, and the
merge-base and diff that ct lint runs on history fetch-depth: 0 already
brought in.

Two checkouts keep the token on purpose. docs.yml needs it for
mkdocs gh-deploy, which pushes the gh-pages branch, and release-cut.yml
for semantic-release, which pushes the release commit and the tag.

Signed-off-by: Thibaud Van den Berghe <thibaud@getplumber.io>
Every action is already pinned by commit and Dependabot moves the pins.
What the workflow files cannot show is what those actions call in turn:
chart-testing-action runs astral-sh/setup-uv and attest-build-provenance
runs actions/attest. actions.lock is GitHub's workflow dependency
lockfile, generated with gh actions-lock. It records the commit behind
each of the 23 actions and those two, with the numeric ids of their
repositories, so a later change in what an action calls shows up in a
diff and a repository replaced behind a name is refused at run time.

Generated with --no-narrow, so no pin in a workflow file changes.

The one edit to the workflows is the path of the zstd image action in
release.yml, nightly.yml and push-zstd-image.yml, from ./ to $/. The
tool does not follow a ./ action, and without an entry for the
docker/build-push-action it calls those jobs would fail once the
lockfile applies. $/ is the same action, taken at the commit of the
running workflow.

The lockfile does not cover calls to reusable workflows, so
pr-limit.yml is unchanged.

Signed-off-by: Thibaud Van den Berghe <thibaud@getplumber.io>
@github-actions

Copy link
Copy Markdown

🎉 Thanks for your first pull request to Floci!

Your CI checks need a maintainer to approve them before they run. That is GitHub's standard gate on first-time contributors, not a problem with your PR — so if the checks look like they are doing nothing, that is why. Once a maintainer approves, CI and the compatibility suite start automatically. Nothing is needed from you in the meantime.

While you wait, a couple of things that make review faster:

  • Link the issue this fixes with Closes #N in the description
  • Commits follow Conventional Commits (feat(s3): ..., fix(dynamodb): ...)
  • Behaviour changes come with a test — see CONTRIBUTING.md

Come join us in Slack — it is the fastest way to reach maintainers if you get stuck, or want feedback on an approach before investing more time in it.

@qodo-code-review

qodo-code-review Bot commented Nov 19, 2026 •

Copy link
Copy Markdown

PR Summary by Qodo

Harden CI checkouts and lock workflow action dependencies

⚙️ Configuration changes 🕐 20-40 Minutes

Grey Divider

AI Description

• Disable checkout credential persistence in 34 jobs that do not push with Git.
• Add a generated actions.lock to record pinned actions and their transitive dependencies.
• Use commit-relative local action references so the lockfile can resolve the image action.
Merge Risk 🟢 Low

Blast radius 🔴 High 💥 4 capabilities

  • 4 affected capabilities span independent functional scopes: container_image_publication, github_actions_workflow_execution, zstd_action_validation.
  • Both changed steps publish the nightly native and compatibility images through the same repository-local zstd image action and produce the same nightly distribution outcome; they are separate build variants within one bounded image-publication integration.
  • The three changed release steps publish related image variants through one repository-local image-building and publishing integration.
  • They are distinct outputs but share the bounded release image-publication scope and the same action contract.
  • This is a separate CI outcome from publishing nightly or release images: it builds a local registry test image and verifies layer compression, attestations, and pullability.
  • Its trigger and consumer are the validation workflow rather than the release distribution workflows.
  • The changed setting is the same checkout-to-subsequent-step integration reused across the workflows.
  • It affects credential availability at the workflow execution boundary, not an individual application feature or deployment artifact.
Behavioral complexity 🟢 Low 🧩 Straightforward

  • Before, the workflow referenced the repository-local composite action with './.github/actions/push-zstd-image'.
  • After, the same call sites use '$/.github/actions/push-zstd-image'.
  • The new correctness condition is that every local action reference must retain the repository-relative path syntax expected by the workflow runner.
  • This is a direct configuration rule with no new algorithm, state machine, concurrency protocol, or coordinated invariant.
Potential damage 🟡 Medium 🩹 Temporary loss

  • A path-resolution failure prevents the nightly image-publish steps from running, so the nightly tags are not published for that run.
  • No persistent application state is changed by the failed action invocation; recovery requires correcting the workflow and rerunning the workflow.
  • Previously published tags remain available.
  • Recoverable by reverting or correcting the local action reference and rerunning the nightly workflow.
  • This does not repair a missed publication automatically; the source supports no automatic retry or repair worker for a workflow-definition resolution failure.
Assessed commit dc30959
Diagram

graph TD
  ReadOnly["Read-only jobs"] --> NoToken["Token-free checkout"] --> Steps["Build and checks"]
  Writers["Git-writing jobs"] --> Token["Credential checkout"]
  Refs["Workflow action refs"] --> Lock["actions.lock"] --> Nested["Transitive actions"]
  ReadOnly --> Refs
  Writers --> Refs
Loading
High-Level Assessment

Keep the targeted checkout settings and generated lockfile. Reducing job permissions alone would not stop checkout from storing an available token, and the two Git-writing jobs still need authenticated checkout.

Files changed (17) +306 / -6

Other (17) +306 / -6
actions.lockRecord workflow action dependencies +245/-0

Record workflow action dependencies

• Adds a generated inventory of workflow action pins, repository identities, and transitive actions such as actions/attest and astral-sh/setup-uv.

.github/workflows/actions.lock

cfn-schema-drift.ymlAvoid stored checkout credentials in schema drift checks +2/-0

Avoid stored checkout credentials in schema drift checks

• Disables credential persistence for the schema drift job's checkout.

.github/workflows/cfn-schema-drift.yml

checkstyle.ymlAvoid stored checkout credentials in Checkstyle +2/-0

Avoid stored checkout credentials in Checkstyle

• Disables credential persistence for the Checkstyle job's checkout.

.github/workflows/checkstyle.yml

ci.ymlHarden test and Maven cache checkouts +3/-0

Harden test and Maven cache checkouts

• Disables credential persistence for the test shards and Maven cache-pruning checkout.

.github/workflows/ci.yml

compat-partitions.ymlHarden partition compatibility checkout +1/-0

Harden partition compatibility checkout

• Disables credential persistence while retaining the selected revision and sparse-checkout settings.

.github/workflows/compat-partitions.yml

compatibility.ymlHarden compatibility suite checkouts +9/-0

Harden compatibility suite checkouts

• Disables credential persistence across six compatibility jobs, including sparse checkouts.

.github/workflows/compatibility.yml

docs-actions.ymlHarden documentation action checks +2/-0

Harden documentation action checks

• Disables credential persistence for the documentation checks without changing the separate docs deployment workflow.

.github/workflows/docs-actions.yml

helm-chart.ymlHarden Helm chart checkouts +4/-0

Harden Helm chart checkouts

• Disables credential persistence in three Helm chart jobs while retaining full history where chart linting needs it.

.github/workflows/helm-chart.yml

iam-data-drift.ymlHarden IAM drift checkout +1/-0

Harden IAM drift checkout

• Disables credential persistence while retaining the two-commit fetch needed for change detection.

.github/workflows/iam-data-drift.yml

nightly-checks.ymlHarden nightly check checkout +2/-0

Harden nightly check checkout

• Disables credential persistence in the nightly checks job.

.github/workflows/nightly-checks.yml

nightly.ymlHarden nightly checkouts and local action references +5/-2

Harden nightly checkouts and local action references

• Disables credential persistence in three nightly jobs. Changes two image-publishing calls to commit-relative local action references.

.github/workflows/nightly.yml

partition-literals.ymlHarden partition literal checkouts +4/-0

Harden partition literal checkouts

• Disables credential persistence in both partition literal jobs.

.github/workflows/partition-literals.yml

pr-hygiene.ymlHarden PR hygiene checkout +1/-0

Harden PR hygiene checkout

• Disables credential persistence while retaining full history for commit checks.

.github/workflows/pr-hygiene.yml

push-zstd-image.ymlHarden image action test checkout and reference +3/-1

Harden image action test checkout and reference

• Disables credential persistence in the test job and switches its local image action call to a commit-relative reference.

.github/workflows/push-zstd-image.yml

release.ymlHarden release build checkouts and image action references +11/-3

Harden release build checkouts and image action references

• Disables credential persistence in four release jobs. Switches three image-publishing calls to commit-relative local action references.

.github/workflows/release.yml

standalone-binaries.ymlHarden standalone binary checkouts +8/-0

Harden standalone binary checkouts

• Disables credential persistence across four standalone binary jobs.

.github/workflows/standalone-binaries.yml

warm-compat-caches.ymlHarden compatibility cache checkouts +3/-0

Harden compatibility cache checkouts

• Disables credential persistence in both compatibility cache-warming jobs.

.github/workflows/warm-compat-caches.yml

@qodo-code-review

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Remediation recommended

1. Manual nightly builds can mix branch code 🐞 Bug ≡ Correctness
Description
The new $/ reference in push-native loads the image action from the running workflow's commit,
while that job still checks out main. When a maintainer dispatches the nightly workflow from
another branch, its branch-specific action and recompression script operate on the main worktree
before pushing the nightly tags.
Code

.github/workflows/nightly.yml[236]

+        uses: $/.github/actions/push-zstd-image
Relevance

●● Moderate

No close precedent on $/ action refs or branch-dispatch mixing. Nearby CI correctness findings were
mostly accepted, but the rejections found are unrelated. Semantic risk keeps this uncertain.

PR-#7749
PR-#4790

ⓘ Recommendations generated based on similar findings in past PRs

Evidence
The workflow allows manual dispatch, the publishing job explicitly checks out main, and its
changed action reference now resolves against the running commit instead of that checkout. The
composite action builds from the workspace but executes its own recompress.py from the action
path.

.github/workflows/nightly.yml[17-18]
.github/workflows/nightly.yml[187-191]
.github/workflows/nightly.yml[233-239]
.github/actions/push-zstd-image/action.yml[53-62]
🌐 GitHub documents that $/ loads a same-repository action at the running commit, independently of the workspace checkout.

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
A manual nightly run from a non-main branch now executes that branch's image action against a checkout of main, potentially changing the code used to publish nightly images.

## Fix Focus Areas
- .github/workflows/nightly.yml[17-18]
- .github/workflows/nightly.yml[28-32]
- .github/workflows/nightly.yml[233-236]

## Recommended Fix
Gate the `prepare` job to `refs/heads/main` so its dependent build and publishing jobs cannot run when the workflow is manually dispatched from another branch. Keep the `$/` references for main runs.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗


Grey Divider

Context sources
✅ Compliance rules (platform): 21 rules
✅ Web pages:
  +9 more
✅ Cross-repo context — repo relationships
  Explored: repo: floci-io/testcontainers-floci-go (sha: 8db9d48e) — View relationship
  Explored: repo: floci-io/floci-labs (sha: c6c6bb16) — View relationship
  Explored: repo: floci-io/floci-cli (sha: 2b721ae1) — View relationship
  Explored: repo: floci-io/testcontainers-floci-python (sha: e6b79f58) — View relationship
  Explored: repo: floci-io/testcontainers-floci (sha: e900a79e) — View relationship
  Explored: repo: floci-io/floci-ui (sha: 11c808ad) — View relationship
  Explored: repo: floci-io/testcontainers-floci-node (sha: 1251b1d3) — View relationship
  Explored: repo: floci-io/testcontainers-floci-dotnet (sha: a011afd5) — View relationship
✅ Context preparation
  Commit messages: summarized; full text retained for this review
Review mode: Auto: ⚖️ Balanced: Broad CI security changes need careful single-pass validation.

Grey Divider

Tip of the day
💡 Did you know, you can describe a rule in plain language on the Rules page and Qodo drafts it for you

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo


- name: Build and push native nightly image
uses: ./.github/actions/push-zstd-image
uses: $/.github/actions/push-zstd-image

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Remediation recommended

1. Manual nightly builds can mix branch code 🐞 Bug ≡ Correctness

The new $/ reference in push-native loads the image action from the running workflow's commit,
while that job still checks out main. When a maintainer dispatches the nightly workflow from
another branch, its branch-specific action and recompression script operate on the main worktree
before pushing the nightly tags.
Agent Prompt
## Issue description
A manual nightly run from a non-main branch now executes that branch's image action against a checkout of main, potentially changing the code used to publish nightly images.

## Fix Focus Areas
- .github/workflows/nightly.yml[17-18]
- .github/workflows/nightly.yml[28-32]
- .github/workflows/nightly.yml[233-236]

## Recommended Fix
Gate the `prepare` job to `refs/heads/main` so its dependent build and publishing jobs cannot run when the workflow is manually dispatched from another branch. Keep the `$/` references for main runs.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Dismiss ↗ | View ↗

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

The automated review flagged that a manual nightly from another branch now takes that branch's image action while checking out main. That run already uses the branch's nightly.yml, so the action now matches the workflow calling it. Scheduled runs are unchanged. If nightly should only publish from main, an if: github.ref == 'refs/heads/main' on prepare covers it, happy to add it.

@pgermosen

Copy link
Copy Markdown
Member

@Totara-thib thanks for taking the time, and welcome! We're going to close this one, though. Workflow lockfiles are a GitHub Enterprise Cloud feature this org isn't on, and every action here is already pinned to a full commit SHA, so actions.lock and the $/ references wouldn't change what runs. As for persist-credentials, outside the release jobs every workflow this touches already gives its token read access only, and no job uploads its checkout, so it buys very little.

If you'd like to work on Floci, opening an issue first is the best way in, so the scope is agreed before any code.

@pgermosen pgermosen closed this Nov 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants