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

[StepSecurity] ci: Harden GitHub Actions #990

Merged

Conversation

step-security-bot
Copy link
Contributor

Summary

This is an automated pull request generated by Secure Workflows at the request of @ytsarev. Please merge the Pull Request to incorporate the requested changes. Please tag @ytsarev on your message if you have any questions related to the PR. You can also engage with the StepSecurity team by tagging @step-security-bot.

Security Fixes

Least Privileged GitHub Actions Token Permissions

The least privilged token permissions were calculate using Secure WorkFlows based on the actions included in the GitHub Workflow files. This is recommended by GitHub as well as The Open Source Security Foundation (OpenSSF).

Pinned Dependencies

A pinned dependency is a dependency that is explicitly set to a specific hashed version instead of a mutable version. Pinned dependencis ensure that development and deployment are done with the same software versions which reduces deployment risks, and enables reproducibility. It can help mitigate compromised dependencies from undermining the security of the project in certain scenarios. The dependencies were pinned using Secure WorkFlows

Harden Runner

This PR adds Harden-Runner in GitHub actions workflows to improve security. It is an open-source purpose-built security monitoring agent for GitHub hosted runners. It monitors the runtime behavior of the build environment to provide security insights. Optionally, it can also lock down the build environment.

Keeping your actions up to date with Dependabot

The package ecosystem to update github-actions is added using Secure WorkFlows. This is recommended by GitHub as well as The Open Source Security Foundation (OpenSSF).

Feedback

For bug reports, feature requests, and general feedback; please create an issue in step-security/secure-workflows or contact us via our website.

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

Signed-off-by: StepSecurity Bot <bot@stepsecurity.io>
Copy link
Member

@jkremser jkremser left a comment

Choose a reason for hiding this comment

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

lgtm

- id: skip_check
uses: fkirc/skip-duplicate-actions@v5.2.0
uses: fkirc/skip-duplicate-actions@f11521568414503656a5af807dc3018c012552c4
Copy link
Member

Choose a reason for hiding this comment

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

these are good changes, but it would be nice if we still know to what version it corresponds. Going to the repo and finding the sha is too many steps. I can check how hard it would be to open PR towards https://github.com/step-security/secure-workflows to do that.. I mean to put the human readable x.y.z version to a comment

Copy link
Member

Choose a reason for hiding this comment

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

good point 👍

Copy link
Member

Choose a reason for hiding this comment

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

related stuff step-security/secure-repo#1087 (comment) tl;dr: they had it there, but dependabot removes the comment so they choose to not add it at all

@ytsarev
Copy link
Member

ytsarev commented Oct 18, 2022

Looks like go test is failing with

2022-10-18T19:08:57Z WRN providers/assistant/gslb.go:294 > can't resolve FQDN using nameservers error="exchange error: all dns servers were tried and none of them were able to resolve, err: read udp 127.0.0.1:51764->127.0.0.1:7753: read: connection refused" fqdn=127.0.0.1. 

It happened today before and was solved by rerun, now it fails consistently.

It might be related to the introduction of the hardened-runner. I will merge this PR in to introduce the overall security pattern and then we will be able to tackle the configuration of failing unit test job in isolation.

@ytsarev ytsarev merged commit 28fa330 into k8gb-io:master Oct 18, 2022
@ytsarev ytsarev mentioned this pull request Oct 18, 2022
31 tasks
ytsarev added a commit that referenced this pull request Oct 18, 2022
Follow up to #990

For some reason https://app.stepsecurity.io/ didn't manage to handle
these actions automatically.

Signed-off-by: Yury Tsarev <yury@upbound.io>
@ytsarev
Copy link
Member

ytsarev commented Oct 18, 2022

go test issue fix included in #1002

ytsarev added a commit that referenced this pull request Oct 19, 2022
* Permissions setting for the rest of the actions

Follow up to #990

For some reason https://app.stepsecurity.io/ didn't manage to handle
these actions automatically.

Signed-off-by: Yury Tsarev <yury@upbound.io>

* Disable harden runner for `go test`

Otherwise the job fails with

```
2022-10-18T22:53:03Z WRN providers/assistant/gslb.go:294 > can't resolve FQDN using nameservers error="exchange error: all dns servers were tried and none of them were able to resolve, err: read udp 127.0.0.1:47217->127.0.0.1:7753: read: connection refused" fqdn=127.0.0.1.
```

Signed-off-by: Yury Tsarev <yury@upbound.io>

* Add write permission to gh-pages

Signed-off-by: Yury Tsarev <yury@upbound.io>

* Amend permissions for release job

Signed-off-by: Yury Tsarev <yury@upbound.io>

* Disable harden runner for terratest based jobs

Signed-off-by: Yury Tsarev <yury@upbound.io>

Signed-off-by: Yury Tsarev <yury@upbound.io>
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