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

feat(ci): add periodic and ad hoc vulnerability scan #245

Merged
merged 1 commit into from
Oct 6, 2023

Conversation

fhrbata
Copy link
Collaborator

@fhrbata fhrbata commented Sep 26, 2023

Checklist

  • Component contains License
  • Component contains README.md
  • Component contains idf_component.yml file with url field defined
  • Component was added to upload job
  • Component was added to build job
  • Optional: Component contains unit tests
  • CI passing

Change description

esp-idf-sbom allows to scan whole repository/directory for all possible manifest files(idf_component.yml, sbom.yml and its referenced manifests, .gitmodules) and check them for possible vulnerabilities based on the cpe variable in manifest.

This adds scheduled scan at every midnight and also ad hoc(dispatch workflow) allowing to scan on demand.

@fhrbata
Copy link
Collaborator Author

fhrbata commented Sep 26, 2023

This is how the report and workflow looks like in my private fork https://github.com/fhrbata/idf-extra-components/actions/runs/6309525206/job/17129607763

@mahavirj
Copy link
Member

Thanks for adding this!

One question: how will this action notify us if it finds any vulnerabilities?

@fhrbata
Copy link
Collaborator Author

fhrbata commented Sep 26, 2023

@mahavirj The command exits with 1 if a vulnerability is found. So my expectation was that the pipeline fails and an email with info about failed pipeline will be send. But I cannot see how to customize this. Meaning I don't see this possibility in notification settings. I was hoping people will be able to set notification for this failed pipeline, but this doesn't seem possible.

https://docs.github.com/en/actions/monitoring-and-troubleshooting-workflows/notifications-for-workflow-runs

But I have very limited experience with github, so may it's somehow possible and I just don't know how.

One quick thought is that maybe we can store some email address in secrets and explicitly send the report to that address if the check fails(finds some new vulnerability)

@igrr
Copy link
Member

igrr commented Sep 26, 2023

I might also suggest that we set up a simple webhook in Mattermost, so that when the action fails, it notifies us on some channel.

@fhrbata
Copy link
Collaborator Author

fhrbata commented Sep 26, 2023

@igrr Thank you very much for the suggestion. IIUC we would set up an incoming webhhok in mattermost and use e.g. mattermost notify action in the workflow to post a message into the mattermost channel if the workflow fails or am I missing something? Thank you

@fhrbata
Copy link
Collaborator Author

fhrbata commented Sep 26, 2023

@igrr I guess we would like to use something like this in GL also, so maybe just sending the msg from the jobs with curl would be enough. Do you want this to be handled as part of this PR or can it be handled in a follow-up PR?
Thank you

@fhrbata
Copy link
Collaborator Author

fhrbata commented Sep 26, 2023

@mahavirj Would some mattermost channel work for you as a source for the notifications? Thank you

@mahavirj
Copy link
Member

@fhrbata Yeah, that sounds good to me.

@fhrbata fhrbata force-pushed the feature/cpe_check branch 2 times, most recently from 9a3764c to 933305a Compare October 5, 2023 13:11
@fhrbata
Copy link
Collaborator Author

fhrbata commented Oct 5, 2023

Hi @mahavirj I needed to update this PR, but now it should be hopefully all set. I tested both cases(ok, failed) in my private fork and the testing mattermost channel. The esp-idf-sbom changes are also published. Thank you!

esp-idf-sbom allows to scan whole repository/directory for all possible
manifest files(idf_component.yml, sbom.yml and its referenced manifests,
.gitmodules) and check them for possible vulnerabilities based on the
cpe variable in manifest.

This adds scheduled scan at every midnight and also ad hoc(dispatch
workflow) allowing to scan on demand.

Simple message with overall status and job link is sent to mattermost
channel via webhook specified with MATTERMOST_WEBHOOK secret.

Signed-off-by: Frantisek Hrbata <[email protected]>
@mahavirj mahavirj merged commit 99a949f into espressif:master Oct 6, 2023
55 checks passed
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