Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] Improve Scorecard score #547

Closed
melba-lopez opened this issue Jul 14, 2022 · 12 comments
Closed

[bug] Improve Scorecard score #547

melba-lopez opened this issue Jul 14, 2022 · 12 comments
Labels
status:help wanted Extra attention is needed type:bug Something isn't working

Comments

@melba-lopez
Copy link

Describe the bug
Improve repository's OpenSSF Scorecard score (currently at 7.1)

To Reproduce
docker run -e GITHUB_AUTH_TOKEN gcr.io/openssf/scorecard:stable --show-details --repo=https://github.com/slsa-framework/slsa-github-generator --format=json > scorecard_slsa-framework_slsa-github-generator.json

Expected behavior

  • Branch Protections could be improved
  • CII-Best-Practices Badge could be obtained
  • Project should be Fuzzed
  • Security Policy should be created
  • Token Permissions should follow principle of least priveledge

Screenshots
image
image
image
image
image

Additional context
Attempted to upload the JSON file, but github does not allow me to. Related to recommendation of securing our repos: slsa-framework/slsa#424

@melba-lopez melba-lopez added status:triage Issue that has not been triaged type:bug Something isn't working labels Jul 14, 2022
@laurentsimon laurentsimon changed the title [bug] [bug] Improve Scorecard score Jul 14, 2022
@laurentsimon
Copy link
Collaborator

laurentsimon commented Jul 14, 2022

Thank you!

You know you can send us some PR and possibly get rewarded at sos.dev, right?

@melba-lopez
Copy link
Author

I thought PRs were mostly meant for doc/code changes?? I know I am unable to make these changes myself since I don't have repo access. So not sure how that would work?

@laurentsimon
Copy link
Collaborator

laurentsimon commented Jul 14, 2022

The permission changes could be changes you propose via a PR. If you identify some critical projects and get them to accept your PR, you can use sos.dev to be rewarded

Some config settings like branch protection cannot be changed via PR, you are correct.

@jspeed-meyers
Copy link

Would adding permissions: read-all to the GitHub action YAML files be sufficient to address the "Token Permissions should follow principle of least privilege" bullet point?

That's what my reading of the Scorecards documentation on token permissions remediation suggests.

If that's a correct interpretation, I'm glad to help out with a PR that adds this line repeatedly.

@laurentsimon
Copy link
Collaborator

I thought we already set the permissions as read-only in all our workflows. If we don't for some, please feel free to send a PR

@jspeed-meyers
Copy link

Huh, scorecard says, as of 10/19/22 for this repo, 0/10 for Token-Permissions and that non read-only tokens detected. Let me do a little digging.

@jspeed-meyers
Copy link

jspeed-meyers commented Oct 19, 2022

Could it be this line?

permissions:
id-token: write # Needed to get OIDC token for keyless signing.
actions: read # Needed to read workflow info.
packages: write # Needed to login and upload attestations to ghcr.io.

Seems like the keyless signing requires non-read permissions, so I'm not sure there's any way to get around this 0/10 Token-Permissions scorecard score. If I am misunderstanding, please correct me and I'm glad to put in a PR.

@laurentsimon
Copy link
Collaborator

You're right. Scorecard scoring is going to change in the next release to address this. See ossf/scorecard#2338

@ianlewis
Copy link
Member

ianlewis commented Nov 28, 2022

We have a score of 9 now but I think we can close once we've completed the following tasks that were written in the description.

  • Branch Protections could be improved: we have branch protections in place. scorecard can't detect it because it needs admin access. Using a PAT with scorecard is not recommended so this is what it is for now.
  • CII-Best-Practices Badge could be obtained: we have a badge and are working towards it. Tracked on [feat] Adopt OpenSSF Best Practices passing criteria #886
  • Project should be Fuzzed: I don't think fuzzing is in scope for this project but we use other dynamic analysis (unit tests and e2e tests). Coverage of unit tests is tracked in [feature] Code coverage #898
  • Security Policy should be created: tracked by [feature] Add a security policy file #541
  • Token Permissions should follow principle of least priveledge: we've made some changes and I think we are using least-privilege now.

@ianlewis
Copy link
Member

ianlewis commented Dec 1, 2022

It seems that scorecard also dings us hard for using packages: write. It's giving us a zero for the 'Token-Permissions' check.

@laurentsimon
Copy link
Collaborator

This should go away with one of the future releases of Scorecard

@ianlewis ianlewis removed this from the 2022 Stability improvements milestone Jan 12, 2023
@ianlewis
Copy link
Member

We finished the tasks I mentioned above and now have a overall scorecard score if 9+ so I think we have completed this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:help wanted Extra attention is needed type:bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants