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

Add security audit workflow [SAME VERSION] #216

Merged
merged 2 commits into from
Jan 21, 2021
Merged

Conversation

romoh
Copy link
Contributor

@romoh romoh commented Jan 20, 2021

What this PR does / why we need it:
Add a security-audit workflow to catch security vulnerabilities. The workflow uses an existing GitHub action maintained by the cargo-audit team.
For now, I chose to trigger it on pull requests and pushes. The workflow can later be expanded to include other security auditing.

The workflow was tested by creating a pull request to a forked branch that introduces a security vulnerability (undo of #213) and the workflow failed. Upon fixing it, the workflow succeeded.

Since this is not a product related, no version update required.
Closes #212

Special notes for your reviewer:
@bfjelds - Please chime in with your experience around token permissions. Not sure if that will be problematic.
Note: The action states that in case of token permission issues, the action will output all found advisories to the stdout instead. Another option is to switch the workflow to a daily cadence instead.

If applicable:

  • this PR contains documentation
  • this PR contains unit tests
  • added code adheres to standard Rust formatting (cargo fmt)
  • code builds properly (cargo build)
  • code is free of common mistakes (cargo clippy)
  • all Akri tests succeed (cargo test)
  • inline documentation builds (cargo doc)
  • version has been updated appropriately (./version.sh)

@@ -0,0 +1,24 @@
name: Security audit
Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought to group all security audits in one workflow and later we can expand it to include other security checks too. No strong opinion thou, I can move it to check-rust.yml since they run on the same triggers.

@romoh romoh merged commit 7723217 into project-akri:main Jan 21, 2021
- uses: actions/checkout@v1
- uses: actions-rs/audit-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
Copy link
Collaborator

Choose a reason for hiding this comment

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

i'm not sure we should be adding our token here. can we do this in a way that would work from a fork PR?

Copy link
Contributor

Choose a reason for hiding this comment

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

@romoh what happens if the token is removed?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The token is only required for generating a report of the vulnerabilities and warnings as an output of the action. If the token is not found an stdout error is shown but doesn't impact the result of the audit step. I sent a test PR to confirm that this is indeed the case.

@kate-goldenring, to answer your question, We can remove the token if we don't care about the reporting part. I would keep it there just in case github figured how to get this working at some point, the reporting will light up automatically.

Copy link
Contributor

Choose a reason for hiding this comment

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

@romoh thanks for checking. That sounds like a good plan to me

Copy link
Collaborator

Choose a reason for hiding this comment

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

you are still going to add a comment here with that information, right?

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.

Automate running cargo-audit to catch dependencies with security vulnerabilities
3 participants