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
A binary scan examines a built Java artifact instead of a source tree.
Point the CLI at a JAR, WAR, EAR or Spring Boot fat JAR and it identifies the open-source components packaged inside it, then scans them exactly as an SCA scan of the source would.
This closes the gap between what was scanned and what was shipped.
It is the only option when you have no source at all: a vendor-supplied JAR, a legacy EAR whose build job no longer exists, or a release gate that should check the actual deployable rather than the commit that supposedly produced it.
Everything an SCA scan normally supports still applies: `--severity-threshold`, `--soft-fail`, `cycode ignore` rules, `--export`, `--cycode-report` and the usual exit codes.
> [!IMPORTANT]
> The artifact never leaves your machine.
> The CLI opens it locally and uploads only the resulting component inventory, which is typically a few tens of kilobytes regardless of how large the artifact is.
You can also extract archives encountered during an ordinary path scan, using `--include-binaries`:
| `--max-depth` | `3` | Nested-archive recursion limit. An EAR containing WARs containing JARs is depth 3. |
| `--offline` | off | Identify components from embedded metadata only. Acknowledges and silences the partial-results warning. |
| `--maven-central` | off | Look up archives that embedded metadata cannot identify on Maven Central by SHA-1. Sends only the digest, never the archive. Cannot be combined with `--offline`. |
| `--project-name` | inferred | Override the platform identity when the artifact is detached from its source repository. |
| `--keep-bom` | off | Write the generated component inventory beside each artifact, for inspection or audit. |
| `--include-binaries` | off | On `scan path` only. Extract any Java archives encountered during the walk. |
Platform identity is inferred from the Git remote when you run inside a repository, and falls back to the artifact filename otherwise.
`--monitor` is refused on a bare filename identity, because monitoring keyed on `app.jar` would merge unrelated projects into one and quietly corrupt the trend data.
Use `--project-name` or run from inside the repository the artifact was built from.
#### How Components Are Identified
Components are identified from metadata the build itself wrote into the archive:
| Source | Confidence | Notes |
|---|---|---|
| `META-INF/maven/.../pom.properties` | exact | Written by Maven. Authoritative group, artifact and version. |
| Maven Central digest lookup (`--maven-central`) | exact | The SHA-1 of the archive, matched against what Maven Central published. Opt-in, because it is the one step that sends anything about the artifact off the machine. |
| `META-INF/MANIFEST.MF` attributes | low | `Implementation-Title`, OSGi `Bundle-SymbolicName` and similar, with the group taken from `Implementation-Vendor-Id`. Used only when all three parts are shaped like Maven coordinates; a product name or a build banner is not one. |
Every finding reports which source identified its component and where inside the artifact that component sits, so a hit on a large EAR points at a specific nested JAR rather than the whole file.
> [!NOTE]
> Findings from a low-confidence match are printed and exported, but do **not** affect the exit code.
> A wrong coordinate produces a wrong vulnerability list, and a fabricated CVE breaking a release costs more trust than the extra coverage is worth.
#### Unidentified Components
Archives that carry no usable metadata are listed in their own section by path, digest and size, and appear under an `unidentified` key in `--output json` so CI can assert on coverage:
The coverage line counts manifest-only matches as identified but calls them out, and `--output json` reports the same number as `binary.low_confidence_components`.
We do not guess a component's identity from its filename.
`internal-shim.jar` is not evidence of anything, and an admitted gap is more useful than an invented coordinate.
Unidentified components do not set the exit code on their own.
#### Binary Scan Limitations
Read this before relying on a binary scan as your only check.
- **Relocated and shaded classes are not detected.**
When a build rewrites `com.google.common` into `com.acme.shaded.common` and merges it into the parent JAR, there is no separate JAR to identify and no metadata left to read.
Those components will not appear in the results at all.
Detecting them requires class-level fingerprinting, which this feature does not do.
- **Source scanning gives a truer picture.**
A source scan resolves the real dependency graph from your lockfiles.
A binary scan sees what is physically packaged, and infers relationships from archive nesting plus any embedded `pom.xml` files it finds.
Where you have source, scan the source; use binary scanning for the artifacts you cannot scan any other way.
- **Coverage is reported, not assumed.**
The coverage line is always printed and always true.
If it says components could not be identified, the scan is genuinely incomplete for those components rather than clean.
- **Java only, for now.**
.NET, npm and container artifacts are not supported yet.
### Commit History Scan
> [!NOTE]
Expand Down
Expand Up
@@ -1533,6 +1663,7 @@ The following commands are available for use with this command:
| `path` | Generate SBOM report for provided path in the command |
| `repository-url` | Generate SBOM report for provided repository URI in the command |
| `binary` | Generate SBOM report for a built Java artifact (JAR, WAR, EAR) |
### Repository
Expand All
@@ -1558,6 +1689,23 @@ The `path` subcommand supports the following additional options:
| `--gradle-all-sub-projects` | Run the Gradle restore command for all sub-projects (use from the root of a multi-project Gradle build). |
| `--maven-settings-file` | For Maven only, allows using a custom [settings.xml](https://maven.apache.org/settings.html) file when building the dependency tree. |
### Built Artifact
To create an SBOM report for a built Java artifact, without scanning it for vulnerabilities:\
This answers the compliance case directly: an SBOM of what you actually shipped, rather than of what was committed.
It uses the same extraction as [Binary Scan](#binary-scan), so the [limitations](#binary-scan-limitations) documented there apply here too — in particular, shaded and relocated components will be missing from the SBOM.
The `binary` subcommand supports the following additional option:
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 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 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 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
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.
PM-4777: Add binary scanning for Java artifacts (JAR, WAR, EAR, Spring Boot) #524
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
Are you sure you want to change the base?
Uh oh!
There was an error while loading. Please reload this page.
PM-4777: Add binary scanning for Java artifacts (JAR, WAR, EAR, Spring Boot) #524
Filter by extension
Viewed files
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There are no files selected for viewing
Uh oh!
There was an error while loading. Please reload this page.