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

Question about grype results #177

Open
phyzical opened this issue Sep 26, 2023 · 0 comments
Open

Question about grype results #177

phyzical opened this issue Sep 26, 2023 · 0 comments

Comments

@phyzical
Copy link

Hey cool idea.

i was giving it a go and am trying to run it before pushing to oci and i was able to get this going via

#!/bin/bash
IMAGE_TAG=$1
SNYK_TOKEN=$2

echo "Started scanning images"

echo "Running snyk image scan"
SNYK_TOKEN=${SNYK_TOKEN} snyk container test --app-vulns --json-file-output=${TMPDIR}/${IMAGE_TAG}-report_snyk.json  ${IMAGE_TAG}

echo "Running trivy image scan"
trivy image --scanners vuln --format json --output ${TMPDIR}/${IMAGE_TAG}-report_trivy.json ${IMAGE_TAG}

echo "Running grype image scan"
grype --add-cpes-if-none -s AllLayers -o json --file ${TMPDIR}/${IMAGE_TAG}-report_grype.json ${IMAGE_TAG} 

echo "importing"
IMAGE_SHA=$(docker images --no-trunc --quiet ${IMAGE_TAG})
vimp import --source ${IMAGE_TAG}@${IMAGE_SHA} --file ${TMPDIR}/${IMAGE_TAG}-report_snyk.json
vimp import --source ${IMAGE_TAG}@${IMAGE_SHA} --file ${TMPDIR}/${IMAGE_TAG}-report_grype.json 
vimp import --source ${IMAGE_TAG}@${IMAGE_SHA} --file ${TMPDIR}/${IMAGE_TAG}-report_trivy.json 

vimp query --image ${IMAGE_TAG}@${IMAGE_SHA} 

echo "Finished scanning images"
vulnerabilities=$(vimp query --image ${IMAGE_TAG}@${IMAGE_SHA} | jq '.exposures|length')
if [[ $vulnerabilities -gt 0 ]]; then
    echo "Found $vulnerabilities vulnerabilities"
    exit 1;
fi

my question is when i see the output of grype i see it detects issues but these dont see to end up in the combined dump?
image
image

Is it just that there is additional filtering occurring somewhere and most of these are things we probably dont care about? or is this a bug.

Looking at the source i see it should scream at me aslong as the items have the keys "vulnerabilities" and "artifacts". which the first couple i checked did.

I tried the example image (redis) and i do see results for grype in the combined result.

I also tried an image on my registry (a simple vimp import --image) and grype behaved the same as my force local attempt which makes me think there's just some sort of filtering going on i'm not understanding

Thanks!

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

No branches or pull requests

1 participant