mlflow / mlflow

Open source platform for the machine learning lifecycle
https://mlflow.org
Apache License 2.0
18.77k stars 4.24k forks source link

[FR] Harden CI/CD workflows by hash-pinning Actions #10437

Open pnacht opened 1 year ago

pnacht commented 1 year ago

Willingness to contribute

Yes. I can contribute this feature independently.

Proposal Summary

Hi, it's Pedro (see #9629). I'm back with another security suggestion!

I suggest that MLflow hash-pin all GitHub Actions used in workflows. This will ensure the workflows always have precisely the same behavior, protecting them against broken or malicious releases.

These dependencies can be kept up-to-date with dependabot. Dependabot can be set up to send a single monthly PR updating the hashes and version comments of all updated Actions at once (see this PR for example).

I'll send a PR pinning the workflow Actions and configuring renovatebot to keep them up-to-date along with this issue.

Motivation

MLflow currently major-version-pins its Actions (i.e. actions/checkout@v4). However, version tags are mutable, so a malicious attacker could overwrite a version tag to point to a malicious or vulnerable commit instead.

Pinning workflow dependencies by hash ensures the dependency is immutable and its behavior is guaranteed.

Details

No response

What component(s) does this bug affect?

What interface(s) does this bug affect?

What language(s) does this bug affect?

What integration(s) does this bug affect?

harupy commented 12 months ago

@pnacht Any other projects using this approach?

pnacht commented 12 months ago

Hey @harupy, hash-pinning is recommended by GitHub itself.

It is also required for all Apache projects. They let GitHub-owned repos stay version-pinned, but in my experience, if you hash-pin one Action, you might as well hash-pin everything, grouped updates mean the workload is basically identical.

Here's a small sample of some other projects that hash-pin their Actions:

github-actions[bot] commented 11 months ago

@mlflow/mlflow-team Please assign a maintainer and start triaging this issue.