XRAY: Maven client prints incorrect message when a dependency is blocked by JFrog Xray
JFrog Xray Block download feature:
Block Download: When set, Artifactory will block the download of artifacts that meet the Artifact Filter and Severity Filter specifications for this watch.
With download blocking, your systems are protected against vulnerabilities so you can trust them to perform at their best and do what they’re supposed to do. And, once configured, it all happens automatically and in the background without any manual intervention.
Watch configured with block download feature and Maven client prints incorrect message:
If your watch configuration matches the criteria to block downloads of dependencies Xray will not allow clients to download those dependencies.
Maven client is hiding the message returned by Artifactory that they were blocked due to Xray block policy and in place of the actual message, it returns “403” Forbidden error.
For eg: I am trying to resolve a dependency ( jackson-databind-2.9.7.jar) which is blocked by Xray:
Maven build returns below 403 Forbidden error.
[main] INFO org.apache.maven.cli.event.ExecutionEventLogger - ------------------------------------------------------------------------ [main] ERROR org.apache.maven.cli.MavenCli - Failed to execute goal on project testing: Could not resolve dependencies for project com.testing.jfrog:testing:war:2.0.8-SNAPSHOT: Could not transfer artifact com.fasterxml.jackson.core:jackson-databind:jar:2.9.7 from/to artifactory-release (https://saas.jfrog.io/artifactory/ad-libs-release): authorization failed for https://saas.jfrog.io/artifactory/ad-libs-release/com/fasterxml/jackson/core/jackson-databind/2.9.7/jackson-databind-2.9.7.jar, status: 403 Forbidden -> [Help 1]
How to identify if the package is blocked by Xray:
Via REST API: Try to download the package with curl and it should print the message returned by Artifactory that they were blocked due to Xray block policy.
bandih-mac Xray-Assessment % curl -uadmin:Password -XGET https://saas.jfrog.io/artifactory/ad-libs-release/com/fasterxml/jackson/core/jackson-databind/2.9.7/jackson-databind-2.9.7.jar
{
“errors” : [ {
“status” : 403,
“message” : “Artifact download request rejected: com/fasterxml/jackson/core/jackson-databind/2.9.7/jackson-databind-2.9.7.jar was not downloaded due to the download blocking policy configured in Xray for ad-maven-remote-cache.”
UI: Navigate to the package location | Xray tab, you should see the message notifying the dependency is blocked by Xray due to Block download policy.