Skip to content

assay project-files [checks…]

Runs the project-file checks: security in the pubspec, the declared assets, the Android manifest and the Info.plist. The checks are advisory, so the command exits with 0 whatever they find.

assay project-files [checks…] [--reporter <name>[:<file>]]… [--color auto|always|never]

With no name it runs every project-file check; with names, only those, in this order:

Check Reports
secret_in_shipped_file A secret in the pubspec or a declared asset, dot files of a declared directory among them.
cleartext_traffic_allowed A platform setting that lets the app send or load plain HTTP.
debuggable_app A release build of the Android app that can be debugged.
app_backup_allowed An Android app whose data the device’s backup copies with no rule of what it holds.
exported_component_without_permission An Android component any app can start without a permission.

A name that is not one of these is a usage error, which names them. The project-file checks are a kind of their own: assay cross-file and assay assets run none of them, and this command runs no cross-file or asset check.

The command takes no paths. It reads only the files a check asks for, each once, and no Dart file. See Project-file checks for what each check reads.

Option Effect
checks… Run only these checks.
--reporter <name>[:<file>] console (the default), json, sarif, gitlab, github or markdown, to standard output or to a file. Repeatable. See Commands.
--color auto|always|never The form of the console output, as for every command.
assay project-files # every check, on the console
assay project-files debuggable_app # one check
assay project-files --reporter json # the result schema, with the projectFileChecks field
assay project-files --reporter sarif:build/project-files.sarif
╭─ assay project-files ────────────────────────────────────────────────────────╮
│ Preset strict │
│ Checks cleartext_traffic_allowed, debuggable_app │
│ Files 3 │
│ Switched off app_backup_allowed │
╰──────────────────────────────────────────────────────────────────────────────╯
╭─ Violations ────────────────────────────────────────────────── 3 in 3 files ─╮
│ Line Rule Tier │
│ ───────────────────────────────────────── │
│ android/app/src/main/AndroidManifest.xml 1 violation │
│ ! 3:5 debuggable_app advisory │
│ │
│ android/app/src/main/res/xml/network_security_config.xml 1 violation │
│ ! 3:16 cleartext_traffic_allowed advisory │
│ This network security configuration lets the app send clear text to │
│ any host, which whoever is on the network can read and change. │
│ → Set cleartextTrafficPermitted to false in base-config, or leave │
│ it out, and let each host that has no TLS have clear text alone, │
│ in a domain-config. │
│ │
│ macos/Runner/Info.plist 1 violation │
│ ! 7:5 cleartext_traffic_allowed advisory │
│ NSAllowsArbitraryLoads switches App Transport Security off: the app │
│ may load any address over plain HTTP, which whoever is on the │
│ network can read and change. │
│ → Remove NSAllowsArbitraryLoads and use HTTPS; for a host that has │
│ no TLS, add an exception domain for it alone. │
╰──────────────────────────────────────────────────────────────────────────────╯
╭─ Checks ─────────────────────────────────────────────────────────────────────╮
│ Check Tier Count │
│ ────────────────────────────────────────── │
│ debuggable_app advisory 1 │
│ android:debuggable is true in a manifest of the release build: whoever has │
│ the app on a device can attach a debugger to it and read and change what │
│ it holds. │
│ → Remove android:debuggable from the manifest: the build makes a debug │
│ build debuggable, and a release build not. │
│ │
│ cleartext_traffic_allowed advisory 2 │
╰──────────────────────────────────────────────────────────────────────────────╯
╭─ Not checked ──────────────────────────────────────────────────────────── 1 ─╮
│ `ios/Runner/Info.plist` is a binary property list, so no check judged it. │
╰──────────────────────────────────────────────────────────────────────────────╯
╭─ ✓ PASS ─────────────────────────────────────────────────────────────────────╮
│ 0 blocking · 3 advisory · 3 of 3 files │
╰──────────────────────────────────────────────────────────────────────────────╯
The project-file checks read 4 files and took 0.0 s.

From the top (the boxes are those of every result report, see The console report):

  1. The head box: the preset, the checks that ran and the number of files the checks read and judged. A row Switched off names the checks the configuration switches off.
  2. The box Violations: the results, each file a sub-heading over its rows, each row with its place (line:column), its check and its tier.
  3. The box Checks: the checks that found something, each once with its tier, its count, its message and how to fix it. Where the message or how to fix it differs from one result to another, it stands under each result instead.
  4. A box Checks that failed, for a check that threw, and a box Not checked, one sentence for each file the checks could not judge (not UTF-8 where text is needed, a binary property list, malformed XML). Such a file is not among the files of the result.
  5. The verdict box: always PASS, unless the configuration is in error. Below it, how many files were read and how long the run took.

A result of a file as a whole, such as a key store shipped as an asset, has — in the place of its line:

╭─ Violations ─────────────────────────────────────────────────── 1 in 1 file ─╮
│ Line Rule Tier │
│ ────────────────────────────────────── │
│ assets/certs/release.jks 1 violation │
│ ! — secret_in_shipped_file advisory │
╰──────────────────────────────────────────────────────────────────────────────╯
╭─ Checks ─────────────────────────────────────────────────────────────────────╮
│ Check Tier Count │
│ ─────────────────────────────────────── │
│ secret_in_shipped_file advisory 1 │
│ This is a key store, shipped as an asset: whoever has the app has the keys │
│ in it. │
│ → Take the file out of the assets and out of version control; if the app │
│ needs a key at run time, get it from your backend. │
╰──────────────────────────────────────────────────────────────────────────────╯

--reporter json writes the result schema assay.result/3 with command: project-files and scope: project.

  • violations: one per result, with source: project_file, the check’s name as rule, tier: advisory, the file, the range and a fingerprint. See Results for how the fingerprint is made.
  • summary.projectFile counts them, apart from summary.crossFile. Every result of every command has this count.
  • files: the files the checks read and judged, each judged, none in an excluded path. The files that could not be judged are not in the JSON.
  • projectFileChecks, which only this command writes:
"projectFileChecks": {
"checks": [
{"name": "secret_in_shipped_file", "status": "ran"},
{"name": "debuggable_app", "status": "off"}
],
"filesRead": 4,
"milliseconds": 12
}
Field What it is
checks The checks the run was asked for, in the order of the checks. status is ran, off (switched off by the configuration) or failed (it threw and has no result; failure says what it threw).
filesRead The files the checks read, those in excluded paths and those they could not judge among them.
milliseconds How long the reading and the checks took.

A result is advisory like any other: level note, severity minor, a notice annotation. In SARIF it carries the property source: project_file, and its check’s descriptor carries the security class: the tags security, external/cwe/cwe-<n> and external/owasp-mobile-2024/m<n>, and the security-severity with one decimal.

Code When
0 The checks ran, whatever they found, also with a check that failed.
2 A configuration error (no check runs then), or a usage error: a name that is not one of the checks, a reporter the command does not take.
3 assay could not run, or could not write a report file it was asked for.

A check that throws is reported as failed, with what it threw, and the other checks still run. That is a defect of assay.

Each check has enabled and exclude under assay.project_files; cleartext_traffic_allowed also has allowed_hosts. <check>: false is the short form.

assay:
project_files:
secret_in_shipped_file:
exclude: ["assets/fixtures/**"]
cleartext_traffic_allowed:
allowed_hosts: [printer.lan]
debuggable_app: false
  • Every check is on under every preset.
  • A check switched off does not run, even when you name it; the result says it is off.
  • No result is placed in a file that assay.exclude, analyzer.exclude or the check’s own exclude covers.
  • An unknown check name, a key a check does not have and a value a key does not take are configuration errors.
  • The gate lists a change of any of these keys among the configuration changes.

See Project-file checks.