Skip to content

ci: pin GitHub Actions to server SHAs and add hidden-unicode lint#2016

Merged
dirkkul merged 2 commits intomainfrom
security/pin-actions-and-linters
Apr 30, 2026
Merged

ci: pin GitHub Actions to server SHAs and add hidden-unicode lint#2016
dirkkul merged 2 commits intomainfrom
security/pin-actions-and-linters

Conversation

@mpartipilo
Copy link
Copy Markdown
Contributor

@mpartipilo mpartipilo commented Apr 16, 2026

Summary

  • Pin all uses: refs in GitHub Actions workflows to the same commit SHAs used by weaviate/weaviate, so this client stays in lockstep with the server
  • Preserve the tag (e.g. # v6) as a trailing comment for readability
  • Add .github/workflows/pr-security-lint.yaml that scans every PR diff for hidden Unicode / trojan-source characters by delegating to the reusable composite shipped in ci: delegate SHA-pinning to native policy, expose unicode scan as composite weaviate#11093 (pinned to merge commit 3e52fc80a244f4644d4facc6a4e705ea6eda9039)

Context

Two complementary layers of GitHub Actions hardening:

  1. SHA pinning — going forward, GitHub's repo-level "Require actions to be pinned to a full-length commit SHA" policy (shipped 2025-08-15) will enforce this at execution time for every workflow. This commit is the initial consolidation pass.
  2. Hidden-Unicode scan — the native policy doesn't cover trojan-source attacks. The shared composite in weaviate/weaviate is invoked here so all five Weaviate SDKs share one implementation.

Security notes for the new workflow

  • pull_request_target runs the workflow definition from the base branch, never from the PR.
  • permissions: {} at workflow level; pull-requests: read is the only grant.
  • The composite is pinned to a 40-char SHA — upstream tag retargeting can't alter what runs here.
  • No PR-controlled refs are checked out; the composite fetches the diff text via the GitHub API.

Tradeoffs of delegating to an upstream composite

Pros

  • Single source of truth for the scan logic — fixes/improvements ship to all 5 SDKs via one SHA bump per repo, not by syncing 5 copies of bash.
  • Composite is pinned to a 40-char SHA, so upstream tag retargeting can't change what runs here without a reviewable diff.
  • pull_request_target runs the workflow definition from the base branch and the composite never checks out PR-controlled refs — a malicious PR can't alter the linter that's checking it.
  • Minimal blast radius: permissions: {} at workflow level, pull-requests: read at job level, no secrets referenced.
  • Composable — adding more scanners upstream (shell-script lint, etc.) propagates to every client automatically.

Cons

  • Cross-repo runtime coupling: deleting or restructuring weaviate/weaviate/.github/actions/security-lint breaks all 5 clients until the SHA is bumped.
  • pull_request_target is a foot-gun — a future editor adding ref: pull_request.head.sha or referencing a secret would re-introduce the attack surface this design is built to avoid. The file header warns against it, but the discipline lives in the reviewer.
  • SHA-bump treadmill: upstream improvements don't propagate until each client opens a PR to bump the pinned SHA. Dependabot can automate this if we wire it up.
  • Failure logs reference a path inside weaviate/weaviate rather than this repo, so debugging a false positive requires hopping to another repo to read the script.
  • Cold-start adds a small network fetch of the composite per run.

Test plan

  • CI workflows run and pass on this branch
  • pr-security-lint job runs on this PR and passes (clean diff)

🤖 Generated with Claude Code

@mpartipilo mpartipilo requested a review from a team as a code owner April 16, 2026 12:55
Copy link
Copy Markdown

@orca-security-eu orca-security-eu Bot left a comment

Choose a reason for hiding this comment

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

Orca Security Scan Summary

Status Check Issues by priority
Passed Passed Infrastructure as Code high 0   medium 0   low 0   info 0 View in Orca
Passed Passed SAST high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Secrets high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Vulnerabilities high 0   medium 0   low 0   info 0 View in Orca

@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.92%. Comparing base (78fa5f7) to head (4ceb15b).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2016      +/-   ##
==========================================
- Coverage   87.95%   87.92%   -0.03%     
==========================================
  Files         280      280              
  Lines       21664    21666       +2     
==========================================
- Hits        19054    19050       -4     
- Misses       2610     2616       +6     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Align all uses: refs to the immutable commit SHAs used by
weaviate/weaviate. Major versions bumped where necessary:
checkout v6, docker/login v4, upload-artifact v7,
download-artifact v8, cache v5. Tags preserved as comments.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@mpartipilo mpartipilo force-pushed the security/pin-actions-and-linters branch from 4ceb15b to b00cb9a Compare April 20, 2026 12:40
@mpartipilo mpartipilo changed the title feat: pin GitHub Actions to SHA hashes and add security linters ci: pin GitHub Actions to server SHAs Apr 20, 2026
Delegates the trojan-source / hidden-unicode scan to the
weaviate/weaviate/.github/actions/security-lint composite action
shipped in weaviate/weaviate#11093, pinned to its merge commit
(3e52fc80a244f4644d4facc6a4e705ea6eda9039).

Uses pull_request_target so the workflow definition runs from the
base branch and PR-controlled refs are never executed; the composite
fetches the diff via the GitHub API.
@mpartipilo mpartipilo changed the title ci: pin GitHub Actions to server SHAs ci: pin GitHub Actions to server SHAs and add hidden-unicode lint Apr 29, 2026
@dirkkul dirkkul merged commit c307d97 into main Apr 30, 2026
122 of 124 checks passed
@dirkkul dirkkul deleted the security/pin-actions-and-linters branch April 30, 2026 04:44
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.

3 participants