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

Perform actions when aqua scan detects security vulnerabilities with solutions #1147

Merged
merged 58 commits into from
Aug 14, 2024

Conversation

valituguran
Copy link
Contributor

@valituguran valituguran commented Aug 8, 2024

Actions performed:

  • Failing a pipeline when a security vulnerability with a solution is found
  • Deleting the vulnerable image
  • Checking that the scan runs correctly
  • Add a blocking entry to the code insight sent to Bitbucket

zxBCN Valeriu_Tuguran,Constantin (IT EDP) EXTERNAL added 30 commits July 29, 2024 17:12
@valituguran valituguran changed the title Security scan when creating container images Aqua security scan when creating container images Aug 8, 2024
@valituguran valituguran changed the title Aqua security scan when creating container images Perform actions when aqua scan detects security vulnerabilities with solutions Aug 8, 2024
zxBCN Valeriu_Tuguran,Constantin (IT EDP) EXTERNAL added 2 commits August 8, 2024 16:26
@hrcornejo hrcornejo self-requested a review August 8, 2024 14:30
CHANGELOG.md Outdated Show resolved Hide resolved
@tbugfinder
Copy link
Contributor

Doc should also be updated.
https://github.com/opendevstack/ods-jenkins-shared-library/blob/master/docs/modules/jenkins-shared-library/partials/odsComponentStageScanWithAqua.adoc

aquaJsonMap.resources.each { it ->
(it as Map).vulnerabilities.each { vul ->
Map vulnerability = vul as Map
if ((vulnerability?.exploit_type as String)?.equalsIgnoreCase("remote")
Copy link
Contributor

Choose a reason for hiding this comment

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

Use constant for "remote" and "critical"

@@ -199,13 +215,28 @@ class ScanWithAquaStage extends Stage {
[ title: "Messages", value: prepareMessageToBitbucket(messages), ]
])
}
if (actionableVulnerabilities?.size() > 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not add a new message per actionableVulnerabilitie like: title: "Explotable vulnerability", value: Information about the vulnerability (using prepareMessageToBitbucket)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We need this specific entry to be present in the data structure as a marker: {
"title": "Blocking",
"type": "TEXT",
"value": "Yes"
}

value: "Yes"
])
} else {
data.put("messages", [
Copy link
Contributor

Choose a reason for hiding this comment

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

Try to avoid duplicate parts. If "messages" is needed, add it and later add the information


bitbucket.createCodeInsightReport(data, context.repoName, context.gitCommit)
}

private createBitbucketCodeInsightReport(String messages) {
String title = "Aqua Security"
String details = "There was some problems with Aqua:"
String details = "There were some problems with Aqua"
Copy link
Contributor

@hrcornejo hrcornejo Aug 9, 2024

Choose a reason for hiding this comment

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

Maintain the ":" at the end (to be coherent with other messages -the fix of was is right-):
image

zxBCN Valeriu_Tuguran,Constantin (IT EDP) EXTERNAL added 4 commits August 12, 2024 09:22
@valituguran valituguran requested a review from hrcornejo August 12, 2024 13:06
@hrcornejo
Copy link
Contributor

Release Manager with a component containing security vulnerabilities with a solution:

  • Failing a pipeline when a security vulnerability with a solution is found
    image
    image
  • Deleting the vulnerable image
    image
    Non existing tag:
    image
  • Add a blocking entry to the code insight sent to Bitbucket
    image
  • Checking that the scan runs correctly
    image

Single component containing security vulnerabilities with a solution:

  • Also failing the pipeline, deleting image:
    image

@valituguran valituguran merged commit 95ab157 into master Aug 14, 2024
3 checks passed
@valituguran valituguran deleted the test-aqua branch August 14, 2024 07:27
BraisVQ pushed a commit that referenced this pull request Oct 23, 2024
…solutions (#1147)

Fail pipeline in case of remote critical with solution vulnerabilities.
BraisVQ pushed a commit that referenced this pull request Oct 23, 2024
…solutions (#1147)

Fail pipeline in case of remote critical with solution vulnerabilities.
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