-
Notifications
You must be signed in to change notification settings - Fork 893
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Automate the scanning security vulnerabilities in images of WGs Signed-off-by: Hansini Karunarathne <hansini.20@cse.mrt.ac.lk> * Fixed a issue in trivy_scan.yaml and trivy_scan.sh Signed-off-by: Hansini Karunarathne <hansini.20@cse.mrt.ac.lk> * Did requested changes in trivy.yaml Signed-off-by: Hansini Karunarathne <hansini.20@cse.mrt.ac.lk> --------- Signed-off-by: Hansini Karunarathne <hansini.20@cse.mrt.ac.lk>
- Loading branch information
1 parent
f96b8f5
commit 94c6135
Showing
5 changed files
with
365 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: Image Extracting and Security Scanning | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
image-extraction-and-security-scan: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
# Install kustomize | ||
- name: Install kustomize | ||
run: | | ||
sudo apt update | ||
sudo apt install snapd | ||
sudo snap install kustomize | ||
# Install trivy | ||
- name: Install trivy | ||
run: | | ||
sudo apt update | ||
sudo snap install trivy | ||
# Install jq | ||
- name: Install jq | ||
run: | | ||
sudo apt update | ||
sudo apt install jq | ||
# Install Python | ||
- name: Setup Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.12' | ||
|
||
# Install prettytable package | ||
- name: Install prettytable | ||
run: | | ||
pip install prettytable | ||
# Run the shell script (extract_images.sh) | ||
- name: Run image extracting and security scanning script | ||
run: | | ||
cd hack | ||
chmod +x trivy_scan.sh | ||
./trivy_scan.sh | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import json | ||
from prettytable import PrettyTable | ||
|
||
# Path to your JSON file | ||
json_file = '../docs/image_lists/summary_of_severity_counts_for_WG/severity_summary_in_json_format.json' | ||
|
||
# Load JSON content from the file | ||
with open(json_file, 'r') as file: | ||
data = json.load(file) | ||
|
||
# Define a mapping for working group names | ||
groupnames = { | ||
"Automl": "AutoML", | ||
"Pipelines": "Pipelines", | ||
"Workbenches":"Workbenches(Notebooks)", | ||
"Serving": "Kserve", | ||
"Manifests":"Manifests", | ||
"Training": "Training", | ||
"Model-registry":"Model Registry", | ||
"total": "All Images", | ||
} | ||
|
||
# Create PrettyTable | ||
table = PrettyTable() | ||
table.field_names = ["Working Group", "Images", "Critical CVE", "High CVE", "Medium CVE", "Low CVE"] | ||
|
||
# Populate the table with data | ||
for group_name in groupnames: | ||
if group_name in data: # Check if group_name exists in data | ||
value = data[group_name] | ||
table.add_row([groupnames[group_name], value["images"], value["CRITICAL"], value["HIGH"], value["MEDIUM"], value["LOW"]]) | ||
|
||
|
||
# Print the table | ||
print(table) | ||
|
||
output_folder='../docs/image_lists/summary_of_severity_counts_for_WG/' | ||
|
||
# Write the table output to a file in the specified folder | ||
output_file = output_folder + 'summary_of_severity_counts_for_WGs_in_table.txt' | ||
with open(output_file, 'w') as f: | ||
f.write(str(table)) | ||
|
||
print("Output saved to:", output_file) |
Oops, something went wrong.