Skip to content

ci: Add actionlint and zizmor workflow linting - #11

Merged
jeffjensen merged 3 commits into
mainfrom
ci/workflow-linting
Sep 10, 2026
Merged

jeffjensen merged 3 commits into
mainfrom
ci/workflow-linting

Conversation

@jeffjensen

@jeffjensen jeffjensen commented Sep 10, 2026

Copy link
Copy Markdown
Member

Adds actionlint + zizmor linting for the GitHub Actions workflows, plus the
hardening to pass them clean. Same setup as dbunit/dbunit-extension. Both
linters pass clean locally.

ci: Add actionlint and zizmor workflow linting

  • New Lint workflows workflow — actionlint (schema + shellcheck) and
    zizmor (workflow security), tool versions pinned, on .github/** PRs and a
    weekly schedule.
  • .github/zizmor.yml — tags allowed for actions/* / github/* /
    dependabot/*, commit SHA required for anything else; the new $/…
    self-repository uses: syntax deferred.

ci(dependabot): Add a cooldown before opening update PRs

  • Seven-day cooldown on Maven, three on GitHub Actions.

ci: Harden the GitHub Actions workflows

  • Least-privilege permissions: blocks and persist-credentials: false.
  • The workflow_run checkouts drop ref: …head_sha — Deploy Snapshot now builds the default branch, not the (possibly fork) triggering
    commit. dangerous-triggers suppressed with a justification comment.
  • Quoted $GITHUB_OUTPUT and $(date …); step outputs routed through env:.
  • advanced-security/maven-dependency-submission-action pinned to a commit SHA
    (the floating v5 tag has no matching release tag, so this moves to v6.0.1).
  • Dependency submission moved out of the build job into its own push-to-main
    submit-dependencies job, so a contents: write token is never present while
    mvn clean verify runs a build of pull-request code.

🤖 Generated with Claude Code

https://claude.ai/code/session_01YA7TRsrNp1TPrHn1KD6vnJ

Summary by Sourcery

Harden the repository’s GitHub Actions automation with security linting, safer permissions, and controlled dependency updates.

New Features:

  • Add scheduled and change-triggered GitHub Actions workflow linting with actionlint and zizmor.

Enhancements:

  • Harden GitHub Actions workflows with least-privilege permissions, safer credential handling, protected workflow-run deployment conditions, and safer output handling.
  • Isolate dependency submission from pull-request builds and pin its action to a commit.

CI:

  • Add Dependabot cooldown periods for Maven and GitHub Actions updates.

Summary by CodeRabbit

  • Chores
    • Added automated linting for GitHub Actions workflows on pull requests, relevant pushes, weekly schedules, and manual runs.
    • Improved workflow security through stricter permissions, credential-free checkouts, and pinned action versions.
    • Dependency updates now observe cooldown periods before proposals are created.
    • Dependency metadata submission runs separately for pushes to the main branch.
    • Snapshot deployments now run only after successful workflows from the same repository.

@sourcery-ai

sourcery-ai Bot commented Sep 10, 2026

Copy link
Copy Markdown

Reviewer's Guide

Introduces pinned actionlint and zizmor checks for workflow changes, then hardens the existing workflows to satisfy those checks through least-privilege permissions, immutable action references, safer checkout and shell-output handling, and isolated dependency submission. Dependabot updates also receive ecosystem-specific cooldown periods.

Sequence diagram for workflow linting

sequenceDiagram
    participant Trigger as Workflow change or schedule
    participant Lint as Lint workflows
    participant Checkout as actions/checkout
    participant Actionlint as actionlint
    participant Zizmor as zizmor

    Trigger->>Lint: Start lint workflow
    Lint->>Checkout: Checkout workflows
    Checkout-->>Lint: Repository files
    Lint->>Actionlint: Run actionlint
    Lint->>Zizmor: Run zizmor on .github/
    Actionlint-->>Lint: Schema and shell checks
    Zizmor-->>Lint: Security checks
Loading

Sequence diagram for hardened snapshot deployment

sequenceDiagram
    participant Build as Build any branch
    participant Deploy as Deploy Snapshot
    participant Checkout as actions/checkout
    participant Maven as Maven Central

    Build-->>Deploy: Completed run on main
    Deploy->>Checkout: Checkout default branch
    Deploy->>Deploy: Get project version
    alt Snapshot version
        Deploy->>Maven: Deploy snapshot
    else Release version
        Deploy-->>Deploy: Skip deployment
    end
Loading

File-Level Changes

Change Details Files
Adds automated linting for GitHub Actions workflow syntax, shell usage, and security posture.
  • Introduces a path-filtered, scheduled, and manually triggered lint workflow.
  • Pins the action and linter versions for reproducible checks.
  • Configures zizmor policies for permitted tag references and required SHA pins, with documented exceptions.
.github/workflows/lint-workflows.yml
.github/zizmor.yml
Reduces the delay and risk of automated dependency update pull requests.
  • Adds seven-day Maven and three-day GitHub Actions cooldowns.
  • Documents and suppresses the intentional Actions cooldown warning.
.github/dependabot.yml
Hardens workflow permissions and isolates dependency submission from pull-request builds.
  • Replaces workflow-wide write access with job-level read/write permissions.
  • Disables checkout credential persistence.
  • Moves dependency submission into a push-to-main-only job after successful testing and pins the submission action to a commit.
  • Updates workflow output handling to quote special paths and pass step-derived values through environment variables.
.github/workflows/build-any-branch.yml
.github/workflows/deploy-snapshot.yml
Makes snapshot deployment resilient to untrusted workflow_run refs while documenting the accepted trigger exception.
  • Stops deploying the triggering run's commit and checks out the default branch instead.
  • Adds a narrowly justified dangerous-triggers suppression for workflow_run.
  • Tightens shell output handling in version evaluation and release-version logging.
.github/workflows/deploy-snapshot.yml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@coderabbitai

coderabbitai Bot commented Sep 10, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 2b553775-8262-48a6-8c52-68a2e103bfbc

📥 Commits

Reviewing files that changed from the base of the PR and between 7aaf73a and d8fd155.

📒 Files selected for processing (2)
  • .github/workflows/deploy-snapshot.yml
  • .github/workflows/lint-workflows.yml

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

The pull request tightens GitHub Actions permissions, isolates dependency submission, adds Dependabot cooldowns, restricts snapshot deployments, and introduces automated workflow linting with actionlint and zizmor.

Changes

GitHub automation security controls

Layer / File(s) Summary
Dependency update cooldowns
.github/dependabot.yml
Dependabot waits 7 days for Maven updates and 3 days for GitHub Actions updates.
Scoped dependency submission
.github/workflows/build-any-branch.yml
The workflow uses no default permissions. Dependency submission runs in a separate job after the build, only on pushes to main, with scoped write access and a pinned action. Checkouts disable credential persistence.
Workflow hardening and linting
.github/workflows/deploy-snapshot.yml, .github/workflows/lint-workflows.yml, .github/zizmor.yml
Snapshot deployment requires a successful same-repository run and improves output handling. A new workflow runs pinned actionlint and zizmor checks. Zizmor rules define approved tag references and self-repository exceptions.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to d8fd1

The workflow hardening and linting changes do not leave an identified merge-blocking risk.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the primary change: adding GitHub Actions workflow linting with actionlint and zizmor.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch ci/workflow-linting

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@sourcery-ai sourcery-ai 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.

Hey - I've reviewed your changes and they look great!

Sourcery assessment

Needs a human reviewer. The deployment workflow now checks out the default branch instead of the SHA that triggered the completed build, and the shown workflow_run trigger has no branch filter. A successful run from another branch could therefore publish the default branch's snapshot; reverting prevents future occurrences but cannot retract an artifact already published to Maven Central.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7aaf73a7ed

ℹ️ 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/deploy-snapshot.yml Outdated
# zizmor: ignore[dangerous-triggers]
# workflow_run is safe here: the branches filter only matches runs on main
# (a fork PR's build runs under its own branch name), the job checks out the
# default branch rather than any attacker-controlled ref, and it consumes no

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Check out the successfully built commit before deployment

When the project version is a -SNAPSHOT, a main push at A can finish its build and a later commit B can land before this workflow starts; this default-branch checkout then resolves B even though only A passed compile-and-unit-test. The subsequent mvn deploy -DskipTests can therefore publish B to Maven Central without its build/test gate (including when B later fails CI); retain github.event.workflow_run.head_sha or otherwise pin checkout to the triggering run's SHA.

Useful? React with 👍 / 👎.

jeffjensen and others added 3 commits September 10, 2026 14:16
Reduce the token exposure and shell-injection surface of the workflows
without changing what they do:

* Move dependency submission out of the build job into its own
  `submit-dependencies` job (as core and spring-boot already do), so the
  `contents: write` token is never present while `mvn clean verify` runs
  a build of pull-request code. Drop the workflow-level permissions to
  `{}` and scope each job.
* Set `persist-credentials: false` on the checkouts that never reuse the
  token for a `git` operation.
* Drop the `workflow_run` checkout's `ref:` so Deploy Snapshot builds the
  default branch rather than the triggering commit, which on a
  `workflow_run` can be a fork's.
* Quote `$GITHUB_OUTPUT`, and pass the resolved version through `env:`
  into the run step.
* Pin `advanced-security/maven-dependency-submission-action` to a commit
  SHA; the floating `v5` tag has no matching release tag to name, so this
  moves to `v6.0.1`.
* Record why the `workflow_run` trigger is not exploitable: the branch
  filter excludes fork PRs, the job checks out the default branch, and it
  reuses no artifact from the triggering run.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YA7TRsrNp1TPrHn1KD6vnJ
Give a bad or compromised release time to be yanked before Dependabot
opens a PR for it: seven days for Maven dependencies, and a shorter
three days for GitHub Actions so security-relevant pin bumps still land
quickly.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YA7TRsrNp1TPrHn1KD6vnJ
Add a "Lint workflows" workflow that runs actionlint (workflow schema
plus shellcheck on `run:` scripts) and zizmor (workflow security) on
every change under `.github/` and weekly on a schedule. Both tool
versions are pinned.

`.github/zizmor.yml` accepts tag pins for actions from GitHub's own orgs
(`actions/*`, `github/*`, `dependabot/*`) and requires a commit SHA for
anything else, and keeps the workspace-relative `./...` action syntax
rather than the very recent `$/...` form.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YA7TRsrNp1TPrHn1KD6vnJ
@jeffjensen

Copy link
Copy Markdown
Member Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Sep 10, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@jeffjensen
jeffjensen merged commit f9bf085 into main Sep 10, 2026
8 checks passed
@jeffjensen
jeffjensen deleted the ci/workflow-linting branch September 10, 2026 21:52
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.

1 participant