-
Notifications
You must be signed in to change notification settings - Fork 949
Create security scan script #2731
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
Merged
Merged
Changes from 2 commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,63 @@ | ||
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.10' | ||
|
||
# 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 | ||
|
||
# Upload the artifact | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you comment out the upload part for now? we do not want external dependencies. |
||
- name: Upload trivy scanned_results | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: trivy_scanned_results | ||
path: docs/image_lists/ | ||
|
||
|
||
|
||
|
This file contains hidden or 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 hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Please use the latest Python available in the base image