-
Notifications
You must be signed in to change notification settings - Fork 4
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 Trivy Security Scans #17
Conversation
Description: This pull request introduces two Trivy security scans running in repo mode on both <code> PUSH </code> and <code> PULL </code> requests. The first scan checks for unknown, low, and medium security vulnerabilities, returns an exit-code: 0, and formats the scan results into a template. The second scan runs in repo mode and checks for high and critical vulnerabilities, and fails with exit-code: 1 if vulnerabilities are found.
Updated YAML formatting and added additional context to outputs
Attempting to fix YAML formatting
Corrected formatting of YAML and ran through https://jsonformatter.org/yaml-validator
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @celanthe, sadly the proposed change is not possible.
An additional action can not be defined within another action.
So deleting line 68 till 78 would work in theory.
Sadly the action is a composite action, this means that currently it does not support the uses
keyword.
There is a PR in the making - actions/runner#1144 , which will support this at some point in the future, but it's not clear yet when it would be released.
So for now we would have to come up with a different strategy.
There is either the option to include it via scripts, e.g. download Trivy via script and execute it ... essentially doing what the already defined trivy action does.
Alternatively, ask contributors to include an example trivy workflow and possibly depend on it for the release action.
Hi @Langleu! Interestingly enough, it seems that the PR you linked had some movement as of earlier today! :) It looks like adding the Trivy scans on lines 68-78 might be possible to do now, if I'm reading this GitHub Actions documentation render correctly? I welcome your thoughts! |
@celanthe , great news! I didn't expect them to merge that quickly as it was stalling for a while. |
Added a missing - to line 1 column 1
Updated YAML formatting to correct test failure
Awesome @Langleu! That's great news! I ran the YAML through one last check and it's all valid! :) Unfortunately, I'm running into an issue with the pre-commit check. All my tests come back 'passed' except for 'prettier'. Which is still failing, causing the pre-commit check to fail. It looks like the workflows and actions will work, however! Validate GitHub Workflows................................................Passed The message in the logs says, "pre-commit hook(s) made changes. I've dug through google and the logs and this seems to be intentional in that prettier hooks will fail if a hook modifies a commit. It seems like I have a few options here:
I'm not quite sure how to reproduce locally and tell prettier that everything is okay. I welcome your thoughts here! |
Hey @celanthe, you can fix those errors by running |
Hi @Langleu! Awesome, I fixed this up! :) I added a bash script that should download and install Trivy, and deleted lines 68-78! Fingers crossed that should get us a bit closer to this working! And all the tests are passing now. I got pre-check working and all sorted! :D I was wondering if it's possible to make this optional? I suppose the best way to do that would be to release a new version as we'd discussed with this new code included, and people can upgrade if they so choose? Or would another path forward be potentially breaking out lines 68-98 into their own action? Or perhaps running a [dispatch action](https://github.com/marketplace/actions/dispatch-action] where this would be step one, and if an exit-code: 0 is returned it would send a message to kick off the Just thinking out loud! :) |
Hey @celanthe,
Yes, this would definitely be an option. The only downside is that it will require more "effort" from the user base to include all of it or exclude it if a different solution is introduced in the future and is, therefore, more error-prone. One way to test if your action is working would be to use our demo repository - https://github.com/camunda/infra-github-demo . Let me know what you think and whether we should have a synchronous call on the topic to iterate over it / pair programming? |
HI @Langleu! I like the idea of introducing an additional input called I would love to pair program on this part, for sure! I unfortunately am getting a 404 error when I try to access the infra-github-demo you linked. Is that a GitHub permissions issue? Would I need to open a ticket with IT to get access to that repo for testing purposes? Thank you so much! I look forward to pairing, and will try to find a time on our calendars over the next few weeks to make it work! |
Hi @Langleu! I got access to the infra-demo repository and set up a new branch/test workflow and changed L32 as you'd suggested. I can get the workflow from this PR to build successfully 🎊 , but it's failing on the Not sure if that's what's causing our issue here, but it might be a good place to start? :) I look forward to connecting! |
fc0a8e3
to
5254577
Compare
5254577
to
a2b22cb
Compare
Description: This pull request introduces two Trivy security scans running in repo mode on both
PUSH
andPULL
requests.The first scan checks for unknown, low, and medium security vulnerabilities, returns an exit-code: 0, and formats the scan results into a template.
The second scan runs in repo mode and checks for high and critical vulnerabilities, fails with exit-code: 1 if vulnerabilities are found, and formats the scan results into a template.