Skip to content

CI: audit with zizmor - #27931

Merged
seberg merged 3 commits into
numpy:mainfrom
mattip:tighten-github-action-permissions
Dec 8, 2024
Merged

CI: audit with zizmor#27931
seberg merged 3 commits into
numpy:mainfrom
mattip:tighten-github-action-permissions

Conversation

@mattip

@mattip mattip commented Dec 8, 2024

Copy link
Copy Markdown
Member

I recently discovered zizmor, a tool to audit github workflows. It exposed some things we should change to make our workflows more secure. The main one, which is really not that important apparently is adding persistant-credientials: false to the checkout step. But once that was cleared, the real problems appeared: using un-escaped user-provided variables (like the branch name) to scripts.

@seberg seberg left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Changes all seem nice. I would have hoped codeql or so find it also, but may it'll come.
Not sure what is with the macos jobs right now, but I guess it is unrelated?

@seberg seberg changed the title audit with zizmor CI: audit with zizmor Dec 8, 2024
@andyfaff

andyfaff commented Dec 8, 2024

Copy link
Copy Markdown
Member

They should be fixed by #27930


# Declare default permissions as read only.
permissions: read-all
permissions: {}

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This might cause scorecard to fail, then we should figure out what exactly is needed. See ossf/scorecard-action#1461

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hmmm, yeah. I guess we can just try and see. Thanks Matti.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Seems to work without those permisssions https://github.com/numpy/numpy/actions/workflows/scorecards.yml. I am not sure where we see the results of the scan?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Cool. The info there indicates it ran on the commit from merging this PR, so I guess the permissions are OK.

@seberg
seberg merged commit feeba7e into numpy:main Dec 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants