jupyter / jupyter/security

Hash-pinning pre-commit hooks

Open
#108 0 comments 3 reactions 0 assignees View on GitHub
Dominant language
Jupyter Notebook
Stars
27
Forks
12
Avg merge
3d 5h
Merged PRs (30d)
3

Description

From what I've seen, everyone only pins revisions when using pre-commit hooks.

Even though usually these hooks are run in a separate workflow, malicious code can also be run in a developer's environment without any changes to our source code (someone can push the malicious code to hook using the same revision).

To overcome this, we can pin hooks using commit hash like this: `rev: ce40a160603ab0e7d9c627ae33d7ef3906e2d2b2 # frozen: v3.19.1`.

The best part is that this can be done automatically: running `pre-commit autoupdate --freeze` does it for you. This will also update the pre-commit hooks versions, but usually that's a good thing.

I made an example in `jupyter/docker-stacks` repo: https://github.com/jupyter/docker-stacks/pull/2289

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.