Skip to content

ci(security): pin pip install by SHA-256 hash in cleanup-spanner-test-infra.yml - #4605

Closed
derrickaw wants to merge 3 commits into
mainfrom
codescan/actions-cleanup-spanner-test-infra-pinned-pip
Closed

derrickaw wants to merge 3 commits into
mainfrom
codescan/actions-cleanup-spanner-test-infra-pinned-pip

Conversation

@derrickaw

@derrickaw derrickaw commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Note: this PR was auto-generated by tooling. Before moving it out of draft, the author has done a full review of the PR, specifically evaluating it on the following criteria:

  • The PR remediates confirmed, live Code Scanning finding(s) (CodeQL / Scorecard / zizmor) on main that are not already covered by upcoming Apache Beam releases, without altering intended template or workflow semantics
  • The fix is minimal, idiomatic, respects Dataflow Templates release-label and lockfile policies, and avoids suppressing alerts or masking defects
  • Relevant unit tests, linters, and CI checks have been verified

If you have concerns with the PR or with the underlying methodology used to generate this, please comment below - they will be addressed by the author not the tooling :)

Summary

Resolves OpenSSF Scorecard PinnedDependenciesID Code Scanning alerts (#114, #115, #229, #230) in .github/workflows/cleanup-spanner-test-infra.yml with native Dependabot hash maintenance:

  • Replaces unpinned python -m pip install --upgrade pip and pip install -r test-infra/requirements.txt in both cleanup jobs with python -m pip install --require-hashes -r .github/workflows/requirements/cleanup-spanner-test-infra-requirements-hashes.txt.
  • Removes the now-unused unpinned test-infra/requirements.txt and places the hash-locked requirements file under /.github/workflows/requirements/ so GitHub Dependabot (package-ecosystem: pip in #4604) natively updates both package versions and --hash=sha256:... digests automatically in a weekly grouped PR.

Verification

  • Verified test-infra Python imports (google-cloud-storage, google-cloud-spanner, google-cloud-datastream) and CI checks pass.

@derrickaw derrickaw added cleanup ignore-for-release github_actions Pull requests that update GitHub Actions code labels Nov 20, 2026
@derrickaw

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request adds a new requirements-hashes.txt file containing pinned Python dependencies and their hashes for the test infrastructure. Feedback was provided to address the inclusion of absolute local paths from the author's machine within the generated file, which leaks internal directory structures and usernames. It is recommended to regenerate the file using relative paths.

Comment thread test-infra/requirements-hashes.txt Resolved
@derrickaw

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a new file test-infra/requirements-hashes.txt which lists pinned Python dependencies along with their SHA-256 hashes to ensure secure and reproducible builds for the test infrastructure. I have no feedback to provide as there are no issues identified in these changes.

@derrickaw

Copy link
Copy Markdown
Contributor Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request removes the dependencies google-cloud-storage, google-cloud-spanner, and google-cloud-datastream from the requirements file. There are no review comments, and I have no feedback to provide.

@derrickaw derrickaw removed the ready-for-human Draft PR checks passed and ready for human review label Nov 22, 2026
@codecov

codecov Bot commented Nov 22, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 59.73%. Comparing base (d187e32) to head (79c4793).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #4605      +/-   ##
============================================
- Coverage     59.74%   59.73%   -0.02%     
  Complexity     8383     8383              
============================================
  Files          1123     1123              
  Lines         72705    72705              
  Branches       8842     8842              
============================================
- Hits          43441    43429      -12     
- Misses        26363    26375      +12     
  Partials       2901     2901              
Components Coverage Δ
spanner-templates 84.02% <ø> (ø)
spanner-import-export 72.62% <ø> (-0.10%) ⬇️
spanner-live-forward-migration 87.64% <ø> (ø)
spanner-live-reverse-replication 79.93% <ø> (ø)
spanner-bulk-migration 88.28% <ø> (ø)
gcs-spanner-dv 86.56% <ø> (ø)
see 5 files with indirect coverage changes
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@derrickaw derrickaw added the ready-for-human Draft PR checks passed and ready for human review label Nov 22, 2026
@derrickaw

Copy link
Copy Markdown
Contributor Author

Closing for now to avoid introducing dedicated transitive hash lockfiles for scheduled cleanup scripts; keeping focus on surgical workflow permission and action pinning fixes.

@derrickaw derrickaw closed this Nov 22, 2026
@derrickaw
derrickaw deleted the codescan/actions-cleanup-spanner-test-infra-pinned-pip branch November 22, 2026 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cleanup github_actions Pull requests that update GitHub Actions code ignore-for-release ready-for-human Draft PR checks passed and ready for human review size/XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant