Skip to content

Conversation

@cji
Copy link
Contributor

@cji cji commented Oct 28, 2022

Hi all! I took a look at the OpenSSF Scorecard results for the containerd repo and noticed it was getting a 0/10 for the GitHub workflow token permissions check.

I followed the guidance from the scorecard tool to apply the changes in this PR. Some were automated recommendations from their linked Step Security tool, and others I applied manually based on the warnings.

The summary of the changes is adding:

  • Top level permissions for workflows that had none.
  • Least privilege Job level permissions based on the knowledgebase from Step Security for certain jobs

This is still getting a 0/10 for the check due to two remaining warnings (that I'll share) but the Aggregate score increased against my fork by 1.7 points.

The remaining 2 warnings are that the build-test-images.yml and images.yml workflows have jobLevel permissions with packages: write which causes a large reduction in points unless the job "utilizes a recognized packaging action or command". Not sure if there's a scorecard bug here or if there's another way or suggestion you all may have to clear those issues up and get full credit here.

Signed-off-by: Craig Ingram [email protected]

@k8s-ci-robot
Copy link

Hi @cji. Thanks for your PR.

I'm waiting for a containerd member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Copy link
Member

@samuelkarp samuelkarp left a comment

Choose a reason for hiding this comment

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

Would you mind testing out these workflows? You'd need to enable GitHub Actions on your fork and then trigger the on condition. (If you can't test some, like the Windows workflows that depend on Azure, just let us know.)

GO_VERSION: '1.19.2'

permissions: # added using https://github.com/step-security/secure-workflows
contents: read
Copy link
Member

Choose a reason for hiding this comment

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

This one probably needs write on the release job.

Copy link
Contributor Author

@cji cji Oct 31, 2022

Choose a reason for hiding this comment

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

@cji
Copy link
Contributor Author

cji commented Nov 1, 2022

Thank you @samuelkarp!

I've run the workflow tests on my fork (and I think the checks on this PR used the updated workflows too) and have everything working now after figuring out how to set up all the right things for Azure (the biggest pain point was my new free account didn't have the capacity limits to run them all at once).

Doing this did catch a couple of things that needed to be updated, including the permissions you caught for the Containerd Release job, and copying the Windows integration test permissions into the periodic tests.

Here are links to all the other jobs:
Containerd Release - https://github.com/cji/containerd/actions/runs/3370128628
Build Volume test images - https://github.com/cji/containerd/actions/runs/3363999950
Mirror Test Image - https://github.com/cji/containerd/actions/runs/3362713453
Nightly - https://github.com/cji/containerd/actions/runs/3366317734
Windows Integration Tests - https://github.com/cji/containerd/actions/runs/3362724674
Windows Hyper-V Integration Tests - https://github.com/cji/containerd/actions/runs/3370161014 - Failing but not sure it's related? timing out on a container delete.
Windows Periodic Tests - https://github.com/cji/containerd/actions/runs/3371519582 (currently running and takes a long time, originally failed to get past the first part due to permissions issue with the token that I fixed. But since it triggers the windows integration tests, I expect it to pass)
Windows Hyper-V Periodic Tests - https://github.com/cji/containerd/actions/runs/3371525084 (same as above - may fail due to azure limits on my account since I re-ran it the same time as the other periodic test)

(I also have passing Fuzzing, CodeQL, and CI tests but those are visible on this PR as well - though it looks like one runc test failed on my last push - not sure if it's flaky?)

@samuelkarp
Copy link
Member

I've run the workflow tests on my fork (and I think the checks on this PR used the updated workflows too) and have everything working now after figuring out how to set up all the right things for Azure (the biggest pain point was my new free account didn't have the capacity limits to run them all at once).

Wow, thanks for testing everything! (I wasn't anticipating that you'd set up the Azure jobs too.)

though it looks like one runc test failed on my last push - not sure if it's flaky?

Yes, that particular test is flaky. I've kicked it to rerun.

@cji
Copy link
Contributor Author

cji commented Nov 2, 2022

Great! thanks for your help. It was a cool learning experience setting up all the jobs.

Copy link
Member

@estesp estesp left a comment

Choose a reason for hiding this comment

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

LGTM

@estesp estesp merged commit 58587d3 into containerd:main Nov 2, 2022
@thaJeztah thaJeztah added cherry-picked/1.6.x PR commits are cherry-picked into release/1.6 branch and removed cherry-pick/1.6.x labels Jan 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cherry-picked/1.6.x PR commits are cherry-picked into release/1.6 branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants