Usage
Jarsight has two commands: jarsight scan analyzes an app, and
jarsight version prints the version, commit and build date.
jarsight scan
jarsight scan [flags] <app.apk|app.aab> [split.apk...]
The app can be one APK, a base APK followed by its split APKs, a file that holds them
(.apks from bundletool, .xapk or .apkm), or an Android App Bundle
(.aab).
jarsight scan app.apk # table on the terminal
jarsight scan -f json -o report.json app.apk # full machine-readable report
jarsight scan -f sarif -o jarsight.sarif app.apk # GitHub code scanning
jarsight scan -f cyclonedx -o sbom.cdx.json app.apk # SBOM for Dependency-Track
jarsight scan --offline app.apk # no network access at all
jarsight scan --severity high --exit-code 1 app.apk # fail a CI job on HIGH or CRITICAL
jarsight scan --ignore-rule JRS-MANIFEST-006 app.apk # leave out a reviewed rule
jarsight scan base.apk split_config.arm64_v8a.apk # base APK and its splits
jarsight scan app.apks # bundle file
jarsight scan app-release.aab # Android App Bundle
jarsight scan --mapping mapping.txt app-release.apk # obfuscated build with its R8 mapping
Flags
| Flag | Value | Default | Meaning |
|---|---|---|---|
--exit-code | int | 0 | exit code to return when findings at or above --severity are reported (default 0: always succeed) |
-f, --format | string | table | output format (table, json, sarif, cyclonedx) |
--ignore-rule | stringSlice | leave out findings of these rule, advisory or CVE IDs, once reviewed and accepted (repeatable or comma-separated) | |
--list-components | table format: list every detected component, not just how many there are | ||
--mapping | string | the build's R8/ProGuard mapping file (mapping.txt), to recognize classes renamed by obfuscation; it must belong to the same build | |
--offline | do not make any network requests (skips the online vulnerability lookup) | ||
-o, --output | string | write the report to this file instead of stdout | |
-s, --severity | string | UNKNOWN | minimum severity to report: findings at this level or above are shown (UNKNOWN, LOW, MEDIUM, HIGH, CRITICAL) |
--show-warnings | table format: list the scan warnings, not just how many there are |
Filtering by severity
--severity is a threshold: --severity medium reports MEDIUM, HIGH and CRITICAL
findings. With --exit-code, the scan fails only when findings at or above the threshold remain,
which is how a CI job is made to fail. See Severities.
Ignoring reviewed findings
--ignore-rule takes Jarsight rule IDs (JRS-MANIFEST-008), advisory IDs
(GHSA-…) and CVE IDs, repeated or separated by commas. Use it for findings you have reviewed and
accepted, such as a key you know has no permissions. The report always says how many findings were left
out, so nothing is hidden silently.
Split APKs and bundles
Apps installed from Google Play are usually split into a base APK and configuration splits (native libraries
per ABI, languages, screen densities). Give them all to scan the whole app: pull them from a device with
adb shell pm path <package> and adb pull, or pass the bundle file. Paths in the
report then start with the APK's name, such as
split_config.arm64_v8a.apk!lib/arm64-v8a/libcrypto.so. Manifest and signature checks run on the
base APK.
Android App Bundles (AAB)
An .aab is what a build uploads to Google Play, which turns it into the APKs users install.
Jarsight scans the bundle directly with the same checks as an APK: the base module and any dynamic feature or
asset pack modules. Paths in the report are paths in the bundle, such as base/dex/classes.dex.
What differs from an APK:
- The bundle is signed with the upload key; Google Play re-signs the APKs it delivers with the app signing key.
The upload certificate is shown, and the APK signature checks (
JRS-SIGN-*) are not run. - The Android Gradle plugin stores the Maven libraries resolved for the build, with exact versions, for Google
Play. Jarsight lists them with the evidence method
bundle-dependencies. They are what the build declared: R8 may have removed some or all of a library's code. - The bundle carries the build's R8 mapping, used as described below.
Obfuscated apps: the R8 mapping
Release builds are usually shrunk and obfuscated by R8, which renames classes (okhttp3.OkHttpClient
becomes a.b), so libraries recognized by their packages and tracker SDKs can go unnoticed. The build
writes the renaming to app/build/outputs/mapping/release/mapping.txt. Give it with
--mapping and Jarsight matches classes under their original names:
jarsight scan --mapping app/build/outputs/mapping/release/mapping.txt app-release.apk
R8 records an ID of the mapping in the DEX files it writes, and Jarsight checks that the mapping has the same
one. A mapping file of another build is refused with an error, since it would give classes wrong names. When the
ID cannot be checked (ProGuard, old R8 versions), the mapping is used with a warning. The report shows which
mapping was used and whether it was verified. App bundles carry their own mapping, used automatically
(--mapping takes precedence); a bundle mapping of another build is ignored with a warning.
The mapping only changes class names. Libraries found by their META-INF/*.version files or
version strings are found with or without it.
Exit codes
| Code | Meaning |
|---|---|
0 | The scan finished (and, with --exit-code, no findings remain at or above --severity). |
1 | Error: unreadable file, not an APK, failed vulnerability lookup… |
the value of --exit-code | Findings remain at or above --severity. |
Environment variables
| Variable | Meaning |
|---|---|
NO_COLOR | Disable colors in the table output (no-color.org). |
JARSIGHT_CACHE_DIR | Where vulnerability records are cached (default: the user cache directory, e.g. ~/.cache/jarsight). |
JARSIGHT_OSV_URL | Base URL of an OSV API mirror (default https://api.osv.dev). |
What leaves your machine
Jarsight analyzes the APK locally. The only network access is the vulnerability lookup in
OSV.dev, which receives the ecosystem, name and version of each detected Maven
library and Cordova plugin, and nothing else: never the APK, its package name, its hash or the secrets found
in it. --offline turns the lookup off.