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

OpenSSF scorecard + openSSF best practice. #211

Open
AugustinMauroy opened this issue Apr 4, 2024 · 9 comments · May be fixed by #472
Open

OpenSSF scorecard + openSSF best practice. #211

AugustinMauroy opened this issue Apr 4, 2024 · 9 comments · May be fixed by #472
Labels
help wanted External contributions would be appreciated

Comments

@AugustinMauroy
Copy link

OpenSSF scorecard is a super tools done by the OpenSSF to give a security score of an repo.

Best practice is giving a tier for the accomplished good open source practice of the project.

@madolson
Copy link
Member

madolson commented Apr 4, 2024

Seems a bit low priority, given what it provides us and we don't have a lot of dependencies.

@AugustinMauroy
Copy link
Author

Seems a bit low priority, given what it provides us and we don't have a lot of dependencies.

I think you misunderstood what is openSSF scorecard. It's not a dependency analyser, it's a project analyser like codeQL. It's take a look if someone push commit directly on main, if there a ci, if releases is signed ...

@madolson
Copy link
Member

madolson commented Apr 4, 2024

Ok, I'll take a look at adding it then and see if we find it useful.

@madolson madolson self-assigned this Apr 4, 2024
@zuiderkwast
Copy link
Contributor

@bjosv Is this what you did in some other projects?

@bjosv
Copy link
Contributor

bjosv commented Apr 5, 2024

Yes, I'm currently looking into OpenSSFs suggestions and I see there are good suggestions that we easily can fix in valkeys CI workflows. I can fix those in a PR, but then there are other improvement like branch-protection that you maintainers need to config in the project settings.

@bjosv
Copy link
Contributor

bjosv commented Apr 5, 2024

I ran OpenSSFs tool on the project and the current scorecard is not bad: Aggregate score: 7.0 / 10
but it will be improved by the fixes.

@AugustinMauroy
Copy link
Author

I ran OpenSSFs tool on the project and the current scorecard is not bad: Aggregate score: 7.0 / 10
but it will be improved by the fixes.

there are a GitHub action to automatically get score.

@madolson madolson assigned bjosv and unassigned madolson Apr 5, 2024
zuiderkwast pushed a commit that referenced this issue Apr 12, 2024
This sets the default permission for current CI workflows to only be
able to read from the repository (scope: "contents").
When a used Github Action require additional permissions (like CodeQL)
we grant that permission on job-level instead.

This means that a compromised action will not be able to modify the repo
or even steal secrets since all other permission-scopes are implicit set
to "none", i.e. not permitted. This is recommended by
[OpenSSF](https://github.com/ossf/scorecard/blob/main/docs/checks.md#token-permissions).

This PR includes a small fix for the possibility of missing server logs
artifacts, found while verifying the permission.
The `upload-artifact@v3` action will replace artifacts which already
exists. Since both CI-jobs `test-external-standalone` and
`test-external-nodebug` uses the same artifact name, when both jobs
fail, we only get logs from the last finished job. This can be avoided
by using unique artifact names.

This PR is part of #211

More about permissions and scope can be found here:

https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions

---------

Signed-off-by: Björn Svensson <bjorn.a.svensson@est.tech>
zuiderkwast pushed a commit to zuiderkwast/placeholderkv that referenced this issue Apr 17, 2024
This sets the default permission for current CI workflows to only be
able to read from the repository (scope: "contents").
When a used Github Action require additional permissions (like CodeQL)
we grant that permission on job-level instead.

This means that a compromised action will not be able to modify the repo
or even steal secrets since all other permission-scopes are implicit set
to "none", i.e. not permitted. This is recommended by
[OpenSSF](https://github.com/ossf/scorecard/blob/main/docs/checks.md#token-permissions).

This PR includes a small fix for the possibility of missing server logs
artifacts, found while verifying the permission.
The `upload-artifact@v3` action will replace artifacts which already
exists. Since both CI-jobs `test-external-standalone` and
`test-external-nodebug` uses the same artifact name, when both jobs
fail, we only get logs from the last finished job. This can be avoided
by using unique artifact names.

This PR is part of valkey-io#211

More about permissions and scope can be found here:

https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions

---------

Signed-off-by: Björn Svensson <bjorn.a.svensson@est.tech>
PatrickJS pushed a commit to PatrickJS/placeholderkv that referenced this issue Apr 24, 2024
This sets the default permission for current CI workflows to only be
able to read from the repository (scope: "contents").
When a used Github Action require additional permissions (like CodeQL)
we grant that permission on job-level instead.

This means that a compromised action will not be able to modify the repo
or even steal secrets since all other permission-scopes are implicit set
to "none", i.e. not permitted. This is recommended by
[OpenSSF](https://github.com/ossf/scorecard/blob/main/docs/checks.md#token-permissions).

This PR includes a small fix for the possibility of missing server logs
artifacts, found while verifying the permission.
The `upload-artifact@v3` action will replace artifacts which already
exists. Since both CI-jobs `test-external-standalone` and
`test-external-nodebug` uses the same artifact name, when both jobs
fail, we only get logs from the last finished job. This can be avoided
by using unique artifact names.

This PR is part of valkey-io#211

More about permissions and scope can be found here:

https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions

---------

Signed-off-by: Björn Svensson <bjorn.a.svensson@est.tech>
@zuiderkwast
Copy link
Contributor

zuiderkwast commented May 3, 2024

Here is a bunch of compiler warnings (and more) to use specifically for C:

https://best.openssf.org/Compiler-Hardening-Guides/Compiler-Options-Hardening-Guide-for-C-and-C++

We can add the easy ones without any problem. Contributions are welcome.

@zuiderkwast zuiderkwast added the help wanted External contributions would be appreciated label May 3, 2024
zuiderkwast pushed a commit that referenced this issue May 3, 2024
Pin the Github Action dependencies to the hash according to secure
software development best practices
recommended by the Open Source Security Foundation (OpenSSF).

When developing a CI workflow, it's common to version-pin dependencies
(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.
See
https://github.com/ossf/scorecard/blob/main/docs/checks.md#pinned-dependencies

The `dependabot` supports updating a hash and the version comment so its
update will continue to work as before.

Links to used actions and theit tag/hash for review/validation:
https://github.com/actions/checkout/tags    (v4.1.2 was rolled back)
https://github.com/github/codeql-action/tags
https://github.com/maxim-lobanov/setup-xcode/tags
https://github.com/cross-platform-actions/action/releases/tag/v0.22.0
https://github.com/py-actions/py-dependency-install/tags
https://github.com/actions/upload-artifact/tags
https://github.com/actions/setup-node/tags
https://github.com/taiki-e/install-action/releases/tag/v2.32.2

This PR is part of #211.

Signed-off-by: Björn Svensson <bjorn.a.svensson@est.tech>
@AugustinMauroy
Copy link
Author

We should add CI + badge for openSSF scorecard in this repo and continue on other repo

@AugustinMauroy AugustinMauroy linked a pull request May 8, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted External contributions would be appreciated
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants