pybind / pybind/pybind11

[BUG]: Hash pin github workflow dependencies

Open
#4,710 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

triage
Dominant language
C++
Stars
18k
Forks
2.3k
Avg merge
5d 17h
Merged PRs (30d)
10

Description

Required prerequisites
What version (or hash if on master) of pybind11 are you using?

849322806cd4b3697ad1d35eedd6d0352c5f267a

Problem description
Description

I would like to suggest another security practice recommended by the GitHub itself and the OpenSSF Scorecard which is to hash pin the project's CI dependencies to prevent dependency-confusion, typosquatting and tag renaming attacks. This means:

  • Hash pinning GitHub Workflow actions.
  • Using --require-hashes on pip installs.

Although the actions that need to be hash pinned on pybind11 are Github Owned Actions, it is still recommended to hash pin them since they are open sourced and are exposed to the same threat vectors any open source project is. Besides, this is currently the only way of using github actions as immutable releases.

Also it might be important to notice that the dependabot, that is already enabled, is able to update both the hash and the comment version related to it.

Let me know if you are open to evaluate those changes and I'll submit the PR ASAP.

Any questions or concerns just let me know.
Thanks!

Additional Context

A tag renaming attack is a type of attack whereby an attacker:

  • Hijack an action.
  • Upload a malicious version.
  • Replace existing tags with malicious versions.

Regarding the attacks package managers are exposed to:

A dependency-confusion attack occurs when an attacker:

  • Find the name of a package that the victims wants to install
  • Create an identically named package and publish it under the public or default registry.
  • Assign the package with a higher version number to trick the package manager tool to download it from the public repo.

A typosquatting attack is a type of attack whereby an attacker:

  • Create a malicious package
  • Publish it with a similar name of a known package (example: numpi instead of numpy)
Reproducible example code

No response

Is this a regression? Put the last known working version here if it is.

Not a regression

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by inspecting the repository's GitHub workflow files and the pip installation steps referenced in the issue. Hash-pin each GitHub Actions dependency and apply --require-hashes to pip installs, then verify that the workflows still run successfully and that Dependabot can update both commit hashes and version comments.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, python
Domain
ci-cd, security
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.