Skip to content

chore(ci): adopt gitleaks and scorecard workflows - #48

Merged
konradmichalik merged 5 commits into
mainfrom
chore/ci-security-hardening
Jul 8, 2026
Merged

chore(ci): adopt gitleaks and scorecard workflows#48
konradmichalik merged 5 commits into
mainfrom
chore/ci-security-hardening

Conversation

@konradmichalik

@konradmichalik konradmichalik commented Jul 2, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add gitleaks secret scanning via the shared reusable workflow
  • Add OpenSSF Scorecard supply-chain scoring via the shared reusable workflow
  • Grant contents: write to the release workflow caller (required once the repo's default token is read-only)

These changes bring this repository in line with the security hardening recently added to konradmichalik/reusable-github-actions.

Summary by CodeRabbit

  • New Features
    • Added automated security and code quality checks to run on pushes, pull requests, scheduled intervals, and manual runs.
    • Added an OpenSSF Scorecard workflow for ongoing repository security assessment.
  • Chores
    • Updated release automation permissions to support publishing changes more reliably.

@coderabbitai

coderabbitai Bot commented Jul 2, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This PR modifies CI configuration by adding contents: write permission to the release workflow and introducing two new GitHub Actions workflows: an OpenSSF Scorecard workflow and a Security workflow, both delegating execution to reusable workflows from an external repository.

Changes

CI Workflow Updates

Layer / File(s) Summary
Release workflow permission update
.github/workflows/release.yml
Adds a permissions block granting contents: write to the reusable release workflow job.
OpenSSF Scorecard workflow
.github/workflows/scorecard.yml
New workflow triggered on main pushes, weekly cron, and manual dispatch; delegates to a reusable Scorecard workflow with contents/actions read, security-events write, and id-token permissions.
Security workflow
.github/workflows/security.yml
New workflow triggered on push to main and all pull_request events; delegates to a reusable Security workflow with contents: read permission.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Estimated code review effort: 1 (Trivial) | ~5 minutes

Suggested labels: ci, github-actions

Suggested reviewers: move-elevator maintainers

Poem
A rabbit hops through YAML fields so neat,
Scorecard and Security, workflows complete,
Permissions tightened, contents locked in place,
Reusable actions set the pipeline's pace,
Hop, hop, hooray — CI's secured with grace! 🐇

🚥 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 accurately reflects the main CI/security workflow additions, though it omits the release permission fix.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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 chore/ci-security-hardening

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.

@coderabbitai coderabbitai 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.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/release.yml:
- Around line 10-12: The reusable workflow reference in the release job is
pinned to a mutable branch, so update the workflow call to use a specific commit
SHA instead of main. Change the external workflow reference in the release job
while keeping the existing permissions block intact, and use the same reusable
workflow identifier so it is easy to locate and verify.

In @.github/workflows/scorecard.yml:
- Around line 10-17: The scorecard job currently references a reusable workflow
via a mutable branch ref, so update the workflow call in the scorecard job to
pin it to a full commit SHA instead of `@main`. Locate the reusable workflow
reference under the scorecard job and replace the branch selector with the
immutable commit SHA for the exact workflow version you intend to run. Keep the
existing permissions unchanged while making the reference deterministic and
security-safe.

In @.github/workflows/security.yml:
- Around line 9-12: The security job is still referencing the reusable workflow
from the moving main branch, so update the uses reference in the security
workflow to a specific commit SHA instead of `@main`. Keep the existing job name
and permissions intact, and only change the reusable workflow identifier to the
pinned SHA so the security workflow stays on a fixed version.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 58859915-c634-401f-8718-20e4cb36ece4

📥 Commits

Reviewing files that changed from the base of the PR and between 19d0f2c and c5886e1.

📒 Files selected for processing (3)
  • .github/workflows/release.yml
  • .github/workflows/scorecard.yml
  • .github/workflows/security.yml

Comment on lines +10 to +12
uses: konradmichalik/reusable-github-actions/.github/workflows/release.yml@main
permissions:
contents: write No newline at end of file

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check if other workflows in this repo already pin third-party/reusable-workflow refs to a SHA,
# to see whether `@main` is an established (if risky) convention here.
rg -n 'uses:\s*konradmichalik/reusable-github-actions' .github/workflows

Repository: move-elevator/typo3-styleguide

Length of output: 638


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n== release.yml ==\n'
cat -n .github/workflows/release.yml

printf '\n== other reusable-workflow calls ==\n'
rg -n -A2 -B1 'uses:\s*konradmichalik/reusable-github-actions' .github/workflows

Repository: move-elevator/typo3-styleguide

Length of output: 1466


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '\n== workflow files ==\n'
git ls-files .github/workflows

printf '\n== release.yml lines ==\n'
sed -n '1,40p' .github/workflows/release.yml

printf '\n== scorecard/security/cgl snippets ==\n'
for f in .github/workflows/cgl.yml .github/workflows/scorecard.yml .github/workflows/security.yml; do
  printf '\n--- %s ---\n' "$f"
  sed -n '1,30p' "$f"
done

Repository: move-elevator/typo3-styleguide

Length of output: 1375


Pin the reusable workflow reference
This job grants contents: write to konradmichalik/reusable-github-actions/.github/workflows/release.yml@main, which is mutable. Pin it to a commit SHA before merging.

🔒 Suggested fix
-    uses: konradmichalik/reusable-github-actions/.github/workflows/release.yml@main
+    uses: konradmichalik/reusable-github-actions/.github/workflows/release.yml@<full-length-commit-sha> # main
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/release.yml around lines 10 - 12, The reusable workflow
reference in the release job is pinned to a mutable branch, so update the
workflow call to use a specific commit SHA instead of main. Change the external
workflow reference in the release job while keeping the existing permissions
block intact, and use the same reusable workflow identifier so it is easy to
locate and verify.

Comment on lines +10 to +17
jobs:
scorecard:
uses: konradmichalik/reusable-github-actions/.github/workflows/scorecard.yml@main
permissions:
contents: read
security-events: write
id-token: write
actions: read

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

sed -n '1,80p' .github/workflows/scorecard.yml

Repository: move-elevator/typo3-styleguide

Length of output: 503


🌐 Web query:

GitHub Actions reusable workflow branch pinning security-events write id-token write best practices

💡 Result:

To secure GitHub Actions reusable workflows, you must address both the reference mechanism (pinning) and the execution context (permissions and secrets). PINNING BEST PRACTICES - Always pin to a full-length (40-character) commit SHA [1][2][3]. Using branch or tag references (e.g., @main, @v1) creates a supply chain risk, as these are mutable and can be silently updated by maintainers or compromised accounts [1][2][4]. - When referencing a reusable workflow, use: uses: owner/repo/.github/workflows/file.yaml@<commit-sha> [1][3]. - Automate enforcement: Use organization-level policies where available to require full-length commit SHAs, and incorporate linting tools (like actionlint) in your CI pipeline to reject non-SHA references [3]. - Conduct periodic drift audits to ensure that the referenced SHA still corresponds to the intended version, as upstream maintainers can technically re-point tags to different commits [3]. - Verify the origin: Ensure the commit SHA belongs to the expected repository to prevent dependency confusion attacks [5]. PERMISSION AND SECURITY BEST PRACTICES - Follow the principle of least privilege: Set permissions: {} at the top level of your workflow to disable all default permissions [6][5]. Grant only the specific, minimal permissions required for each job [7][8][9]. - Regarding security-events: write: This permission is required if the workflow needs to upload code scanning results (e.g., SARIF files) [10]. Only grant this to jobs specifically performing security analysis. - Regarding id-token: write: This is necessary for workflows using OpenID Connect (OIDC) to authenticate with external cloud providers (e.g., AWS, Azure, GCP). This is a best practice as it removes the need to store long-lived cloud credentials as GitHub Secrets [2]. - Use explicit secret passing: Avoid secrets: inherit [2][5]. Explicitly declare which secrets are passed to the reusable workflow to prevent accidental exposure of environment or repository secrets to components that do not require them [2][5][11]. - Validate inputs: Reusable workflows should treat all inputs as untrusted. Use choice types for fixed options or implement runtime regex validation for string inputs to prevent command injection [2][11]. - Implement caller allowlists: If possible, have the reusable workflow validate the calling repository (github.repository) to ensure only authorized workflows can execute it [2][12]. For auditing permissions, consider using tools that monitor GitHub API interactions during a workflow run to suggest the minimal set of permissions needed, rather than defaulting to "write-all" [9].

Citations:


Pin this reusable workflow to a full-length commit SHA. @main is mutable, and this job runs with security-events: write and id-token: write, so an upstream change could alter a security-sensitive workflow.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/scorecard.yml around lines 10 - 17, The scorecard job
currently references a reusable workflow via a mutable branch ref, so update the
workflow call in the scorecard job to pin it to a full commit SHA instead of
`@main`. Locate the reusable workflow reference under the scorecard job and
replace the branch selector with the immutable commit SHA for the exact workflow
version you intend to run. Keep the existing permissions unchanged while making
the reference deterministic and security-safe.

Comment on lines +9 to +12
security:
uses: konradmichalik/reusable-github-actions/.github/workflows/security.yml@main
permissions:
contents: read

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔒 Security & Privacy | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

[skip_cloning]

Repository: move-elevator/typo3-styleguide

Length of output: 220


🏁 Script executed:

#!/bin/bash
# Inspect the actual reusable "security.yml" workflow to confirm whether it uploads SARIF
# (and thus needs security-events: write) or otherwise requires more than contents: read.
curl -s https://raw.githubusercontent.com/konradmichalik/reusable-github-actions/main/.github/workflows/security.yml

Repository: move-elevator/typo3-styleguide

Length of output: 845


Pin the reusable workflow to a commit SHA .github/workflows/security.yml still references konradmichalik/reusable-github-actions/.github/workflows/security.yml@main; replace it with a full commit SHA to avoid pulling in unexpected workflow changes.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/security.yml around lines 9 - 12, The security job is
still referencing the reusable workflow from the moving main branch, so update
the uses reference in the security workflow to a specific commit SHA instead of
`@main`. Keep the existing job name and permissions intact, and only change the
reusable workflow identifier to the pinned SHA so the security workflow stays on
a fixed version.

@konradmichalik
konradmichalik merged commit 0edc4ee into main Jul 8, 2026
2 of 3 checks passed
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