pybind / pybind11

Seamless operability between C++11 and Python
https://pybind11.readthedocs.io/
Other
15.73k stars 2.11k forks source link

[BUG]: Hash pin github workflow dependencies #4710

Open joycebrum opened 1 year ago

joycebrum commented 1 year ago

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:

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:

Regarding the attacks package managers are exposed to:

A dependency-confusion attack occurs when an attacker:

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

Reproducible example code

No response

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

Not a regression

diogoteles08 commented 1 year ago

Hi! I'm Diogo and I work along with Joyce in Google’s Open Source Security Team.

I'm following up this issue because it's been idle for a while, and also because our approaches around pinned dependencies changed a bit since she opened this issue. Now we won't suggest that you hash-pin all of your workflows dependencies, but only the dependencies that have access to privileged permissions, secrets or produce sensible artifacts.

That said, we'd change the scope of this issue to suggest the hash pinning of the workflows:

Hope this comment helps to explain our motivation here =)

Cheers,