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/trivyignore #211

Merged
merged 17 commits into from
Nov 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/workflows/build_rocks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ jobs:
path: ${{ fromJSON(needs.get-rocks.outputs.rock-paths) }}
steps:
- uses: actions/[email protected]
with:
fetch-depth: 0
- name: Extract rock information
run: |
IMAGE_NAME=$(yq '.name' "${{ matrix.path }}/rockcraft.yaml")
Expand Down Expand Up @@ -224,3 +226,23 @@ jobs:
env:
TRIVY_USERNAME: ${{ github.actor }}
TRIVY_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
- name: Check trivyignore
jdkandersson marked this conversation as resolved.
Show resolved Hide resolved
run: |
curl -sfL https://raw.githubusercontent.com/aquasecurity/trivy/main/contrib/install.sh | sh -s -- -b /usr/local/bin v0.46.0
if [ -f ".trivyignore" ]
then
output=$(trivy image $ROCK_IMAGE --severity HIGH,CRITICAL -q -f json --ignorefile "" | jq -r '.Results[].Vulnerabilities[].VulnerabilityID' 2>/dev/null || echo "No vulnerabilities found")
merkata marked this conversation as resolved.
Show resolved Hide resolved
line=0
while read CVE;
do
line=$(( line + 1 ))
if [[ "$output" != *"$CVE"* ]] && [[ ! "$CVE" =~ ^#.* ]]
then
echo "::notice file=.trivyignore,line=${line}::$CVE not present anymore, can be safely removed."
fi
done < .trivyignore
fi
env:
TRIVY_USERNAME: ${{ github.actor }}
TRIVY_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
ROCK_IMAGE: ${{ env.IMAGE_REF }}
Loading