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

Remove Java artifacts scanning from vulnerability scans [DI-50] #778

Merged

Conversation

JackPGreen
Copy link
Collaborator

@JackPGreen JackPGreen commented Jul 4, 2024

The vulnerability scan workflow is regularly failing because of false-positive vulnerabilities inside the Hazelcast distribution JAR.

We already scan, manage and catalogue vulnerabilities upstream for the wider Hazelcast product, so this additional layer is not properly managed and ends up failing.

Reworked these checks to only focus on the Docker image, not the Hazelcast distribution, by replacing the Hazelcast distribution with a dummy empty ZIP.

Having got the scanners working, it became apparent we are also affected by goodwithtech/dockle-action#7 - so until my fix is merged upstream, I've moved this action onto using my fixed branch in a fork, instead.

Also refactored duplicated OS + EE job to use a centralised matrix.

Fixes: DI-50

@JackPGreen JackPGreen changed the title DI-50 - Remove java artifacts scanning from hazelcast-docker Remove Java artifacts scanning from vulnerability scans [DI-50] Jul 4, 2024
@JackPGreen JackPGreen self-assigned this Jul 4, 2024
@JackPGreen JackPGreen requested review from ldziedziul and nishaatr July 4, 2024 13:50
@JackPGreen JackPGreen marked this pull request as ready for review July 4, 2024 13:50
@JackPGreen JackPGreen requested a review from a team as a code owner July 4, 2024 13:50
@JackPGreen JackPGreen requested a review from nishaatr July 4, 2024 15:41
Copy link
Contributor

@ldziedziul ldziedziul left a comment

Choose a reason for hiding this comment

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

Have you compared scan results from this PR branch and master?

HZ_VERSION=$(awk -F '=' '/^ARG HZ_VERSION=/ {print $2}' hazelcast-enterprise/Dockerfile)
HAZELCAST_EE_ZIP_URL=$(get_hz_dist_zip "" "${HZ_VERSION}")
curl --fail --silent --show-error --location "$HAZELCAST_EE_ZIP_URL" --output hazelcast-enterprise/hazelcast-enterprise-distribution.zip;
# Make a dummy empty ZIP file to avoid scanning Java dependencies, as managed downstream
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we use the real zip but remove all *.jar files from it? This way we would be a bit closer to the docker image we actually push.

I have concerns about executable scripts from the distribution zips, if they're used in a safe manner, although I'm not sure if they're scanned.

WDYT @kwart ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Could we use the real zip but remove all *.jar files from it? This way we would be a bit closer to the docker image we actually push.

I have concerns about executable scripts from the distribution zips, if they're used in a safe manner, although I'm not sure if they're scanned.

WDYT @kwart ?

I'm assuming that the distribution ZIPs are already scanned and considered safe, so further tests are redundant/duplicated.

Copy link
Contributor

Choose a reason for hiding this comment

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

Jars are scanned for sure, not sure about shell scripts. I don't have strong opinion here.
Don't know if it makes any difference, if you compare the scan results it might be an indicator it it makes sense

@ldziedziul
Copy link
Contributor

Have you compared scan results from this PR branch and master?

@JackPGreen any comment on that?

@JackPGreen
Copy link
Collaborator Author

JackPGreen commented Jul 10, 2024

Have you compared scan results from this PR branch and master?

@JackPGreen any comment on that?

Yes, it's fine. Before we were only failing because of Java dependencies, now were passing.

master DI-50---Remove-java-artifacts-scanning-from-hazelcast-docker
Trivy Scans base image, no vulnerabilities Scans JAR contents, finds vulnerabilities Scans base image, no vulnerabilities
Dockle Fails with: unable to initialize a image struct: failed to initialize source: {...}: requested access to the resource is denied Scans base image, finds some (ignored) vulnerabilities
Synk Scans base image, no vulnerabilities Scans JAR contents, finds vulnerabilities Scans base image, no vulnerabilities

@JackPGreen JackPGreen enabled auto-merge (squash) July 10, 2024 13:11
@JackPGreen JackPGreen merged commit 4da2ca0 into master Jul 10, 2024
8 checks passed
@JackPGreen JackPGreen deleted the DI-50---Remove-java-artifacts-scanning-from-hazelcast-docker branch July 10, 2024 13:14
JackPGreen added a commit that referenced this pull request Jan 7, 2025
In #778 we swapped our usage of `dockle-action` to our forked version to workaround goodwithtech/dockle-action#7 - now thhis has been fixed upstream we can use it again.
JackPGreen added a commit that referenced this pull request Jan 8, 2025
In #778 we swapped our
usage of `dockle-action` to our forked version to workaround
goodwithtech/dockle-action#7 - now thhis has
been fixed upstream we can use it again.
JackPGreen added a commit that referenced this pull request Jan 9, 2025
In #778 we swapped our
usage of `dockle-action` to our forked version to workaround
goodwithtech/dockle-action#7 - now thhis has
been fixed upstream we can use it again.
JackPGreen added a commit that referenced this pull request Jan 9, 2025
In #778 we swapped our
usage of `dockle-action` to our forked version to workaround
goodwithtech/dockle-action#7 - now thhis has
been fixed upstream we can use it again.
JackPGreen added a commit that referenced this pull request Jan 9, 2025
In #778 we swapped our
usage of `dockle-action` to our forked version to workaround
goodwithtech/dockle-action#7 - now thhis has
been fixed upstream we can use it again.
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