NatLibFi / Annif

Annif is a multi-algorithm automated subject indexing tool for libraries, archives and museums.
https://annif.org
Other
191 stars 41 forks source link

[StepSecurity] ci: Harden GitHub Actions #739

Closed step-security-bot closed 8 months ago

step-security-bot commented 8 months ago

Summary

This pull request is created by StepSecurity at the request of @juhoinkinen. Please merge the Pull Request to incorporate the requested changes. Please tag @juhoinkinen on your message if you have any questions related to the PR.

Security Fixes

Least Privileged GitHub Actions Token Permissions

The GITHUB_TOKEN is an automatically generated secret to make authenticated calls to the GitHub API. GitHub recommends setting minimum token permissions for the GITHUB_TOKEN.

GitHub Action tags and Docker tags are mutatble. This poses a security risk. GitHub's Security Hardening guide recommends pinning actions to full length commit.

Feedback

For bug reports, feature requests, and general feedback; please email support@stepsecurity.io. To create such PRs, please visit https://app.stepsecurity.io/securerepo.

Signed-off-by: StepSecurity Bot bot@stepsecurity.io

sonarcloud[bot] commented 8 months ago

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

codecov[bot] commented 8 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (ff1d32c) 99.67% compared to head (d72d788) 99.67%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #739 +/- ## ======================================= Coverage 99.67% 99.67% ======================================= Files 89 89 Lines 6404 6404 ======================================= Hits 6383 6383 Misses 21 21 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

juhoinkinen commented 8 months ago

Found this StepSecurity tool by looking at OpenSSF Scorecard report of Annif. Before this PR it gave a score of 6.3.

The permission of GITHUB token was already set "Read repo contents" on organization level, but it does hurt to explicitly set it the workflows (and this should increase the OpenSSF score).

juhoinkinen commented 8 months ago

Found this StepSecurity tool by looking at OpenSSF Scorecard report of Annif. Before this PR it gave a score of 6.3.

The permission of GITHUB token was already set "Read repo contents" on organization level, but it does hurt to explicitly set it the workflows (and this should increase the OpenSSF score).

The tool scans repositories weekly: now the score is 7.4.

One way to increase the score would be to add SECURITY.md for vulnerabilities reporting. However, via the Security tab of the repository reporting is already possible.