Jarsight

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

FlagValueDefaultMeaning
--exit-codeint0exit code to return when findings at or above --severity are reported (default 0: always succeed)
-f, --formatstringtableoutput format (table, json, sarif, cyclonedx)
--ignore-rulestringSliceleave out findings of these rule, advisory or CVE IDs, once reviewed and accepted (repeatable or comma-separated)
--list-componentstable format: list every detected component, not just how many there are
--mappingstringthe build's R8/ProGuard mapping file (mapping.txt), to recognize classes renamed by obfuscation; it must belong to the same build
--offlinedo not make any network requests (skips the online vulnerability lookup)
-o, --outputstringwrite the report to this file instead of stdout
-s, --severitystringUNKNOWNminimum severity to report: findings at this level or above are shown (UNKNOWN, LOW, MEDIUM, HIGH, CRITICAL)
--show-warningstable 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:

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

CodeMeaning
0The scan finished (and, with --exit-code, no findings remain at or above --severity).
1Error: unreadable file, not an APK, failed vulnerability lookup…
the value of --exit-codeFindings remain at or above --severity.

Environment variables

VariableMeaning
NO_COLORDisable colors in the table output (no-color.org).
JARSIGHT_CACHE_DIRWhere vulnerability records are cached (default: the user cache directory, e.g. ~/.cache/jarsight).
JARSIGHT_OSV_URLBase 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.