Skip to content

Project-file checks

The project-file checks look for security flaws in the files your app ships or is built with that are not Dart source: the pubspec.yaml and the declared assets, the Android manifest with its network security configuration, and the Info.plist of iOS and macOS. assay has five.

Check Reports Security class
secret_in_shipped_file A secret in the pubspec or in a declared asset: a credential of a known shape, a secret-like value under a credential name, a password in a URL, a key store shipped as an asset. CWE-798, CWE-540 · M1 · 7.8
cleartext_traffic_allowed A platform setting that lets the app send or load plain HTTP: Android’s usesCleartextTraffic and its network security configuration, iOS’s and macOS’s App Transport Security. CWE-319 · M5 · 5.9
debuggable_app android:debuggable="true" on the application of the main or the release manifest. CWE-489 · M8 · 6.5
app_backup_allowed android:allowBackup="true" written with no rule of what the backup holds. CWE-530 · M9 · 3.9
exported_component_without_permission An Android service, receiver or provider that any app can start, with no permission, and an activity so exported with no filter of intents. CWE-926 · M8 · 5.3

All five:

  • are advisory;
  • run in the command-line program only: the editor and dart analyze show nothing of them, since the analyzer plugin judges Dart source alone;
  • carry a security class, which SARIF writes into the check’s descriptor, so that code scanning lists their results as security alerts and ranks them;
  • have no fix;
  • take no suppression comment: a manifest, a plist or a JSON file has no comment of assay’s form, and an image or a key store has no line to write one on. Keep a result with the check’s exclude or the baseline.
Terminal window
assay project-files # every check
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 runs the five in the order of the table. It exits with 0 whatever they find, 2 on a configuration or usage error, and 3 when it could not run (see assay project-files).

They are a kind of their own: assay project-files runs no cross-file check or asset check, and assay cross-file and assay assets run none of these. The gate and the baseline commands run them; assay check does not.

Each check has enabled and exclude under assay.project_files, and cleartext_traffic_allowed also has allowed_hosts. <check>: false is the short form. All five are on under every preset.

assay:
project_files:
secret_in_shipped_file:
exclude: ["assets/fixtures/**"] # no result is placed there
cleartext_traffic_allowed:
allowed_hosts: [printer.lan] # beside the local hosts; *.lan names every host below lan
debuggable_app: false # the short form of enabled: false
Key What it is Default
enabled Whether the check runs. A check switched off does not run, also when the command names it; the result says that it is off. true
exclude Path globs, from the project root, where the check places no result. []
allowed_hosts (cleartext_traffic_allowed only) Further hosts that the app may reach over plain HTTP, beside the local hosts (the device, the emulator’s computer, a private network, names reserved for examples and tests), as the rule cleartext_request’s parameter of the same name. []

A misspelt check, or a key a check does not have, is a configuration error. The message names the closest check (or else all five), or the keys the check has:

assay has no project-file check named `debugable_app`. Did you mean `debuggable_app`?
The project-file check `cleartext_traffic_allowed` has no key `allowed_host`. Its keys are `enabled`, `exclude` and `allowed_hosts`.

A change of any key is listed among the configuration changes at the gate as assay.project_files.<check>.<key>, so an agent that switches a check off is shown it at turn end. assay config prints the project-file checks after the asset checks where the project changed one of them; assay config --verbose always does, with every key and the file its value came from. The editor reads the key without an error and does nothing with it. See Configuring checks.

The gate runs the project-file checks in every judgement: the project judgement of CI and the judgement of a change. assay baseline update and assay baseline status run them too. Their results are whole-project results, as those of the cross-file checks are:

  • They never fail the gate. They are advisory. On a change they are listed beside the violations of the changed files, and their files are among the files of the result, as judged, not as changed files.
  • They run at every judgement of a change, whatever it holds, so a session that edits only the manifest or the Info.plist is judged. The cross-file checks run only where the change holds a Dart, YAML, JSON or ARB file.
  • The agent is handed only what the session made, each result once (see below).
  • They pass through the baseline. assay baseline update --add records them, and a run of the gate or of baseline update that runs a check and no longer finds one of its results removes the entry. On a change, a result the baseline knows is not handed over. A check switched off runs nowhere, and its entries are left as they are.

A change reads only the shipped files it touched. On a change, secret_in_shipped_file reads only the shipped files the change wrote or created, or every one where it touched pubspec.yaml, which says what ships. A secret in another file stood before the change: it is not in the change’s result, and keeps its baseline entry. The project judgement, baseline update and assay project-files read every shipped file. The four checks of the platform files read their few files at every judgement, since a result in one can depend on another (a manifest names a network security configuration).

Made by the change, or standing. A result counts as made by the change where the mark the change is the change since does not hold it, and the change:

  • wrote or created its file (for a result of a file as a whole, a key store shipped as an asset, only created it);
  • touched pubspec.yaml, for a result of secret_in_shipped_file in any file, a key store’s included: a directory the change newly declared ships the .env it holds;
  • touched the main or the release manifest, which says which network security configuration the app takes, for a result of cleartext_traffic_allowed in that configuration.

Every other result stood (inMark: true in the JSON result), also on a change since a commit or since a mark that holds none of them. assay mark --cross-file keeps these results in the mark, beside those of the cross-file checks. So the agent is handed only a secret or a setting the session wrote, made ship or named.

A shipped file git ignores. Git names no change of an ignored file, and the .env of a declared directory is often one. So in a repository, assay mark keeps a digest of each shipped file that git ignores and that secret_in_shipped_file reads (no image, no font, none larger than 1 MB). Such a file whose digest differs since the mark, or one git ignores that the mark does not hold (created since), counts as changed: a secret a session writes into an ignored .env is judged and handed over. A mark taken by an earlier release, or with the check off, keeps no digests, so no ignored file is a changed file then.

Not checked. The notes of the run name each file a check could not judge (see Which files are read), and the baseline keeps that file’s entries. Where the pubspec is not valid YAML, the gate and baseline update keep every entry of secret_in_shipped_file, as they do for a cross-file check that could not judge, so mending the pubspec hands nothing over as new.

Only the package at the project root, as the asset checks read it. A nested example/ app, another member of a workspace, an add-to-app module, the source set of a product flavour, Gradle files and Google services files are not read.

  • pubspec.yaml and every asset it declares under flutter: assets:, each base file and each resolution variant.
    • The dot files of a declared directory too (assets/config/.env): Flutter’s tool bundles them. The asset checks leave them out, so that none judges a .gitkeep, so secret_in_shipped_file lists them itself.

    • A directory below a declared one, or one not declared, ships nothing and is not read. A .env that a code generator reads at build time, in a directory not declared, is no shipped file.

    • An entry written as a map is read by its path, whatever its flavors: or platforms: say: a secret that one build ships is shipped.

    • Images and fonts are not read, by their extensions. A binary file is read and says nothing. A file that is no regular file, such as a named pipe, is never opened.

    • A text file larger than 1 MB, and a JSON or YAML file that has to be parsed and cannot be, are not judged and are named in the box Not checked.

    • Where pubspec.yaml is not valid YAML or holds no YAML map, it is not known which files ship: secret_in_shipped_file judges none, says so, and the baseline keeps every entry of it.

      Project-file checks: `pubspec.yaml` is not valid YAML, so it is not known which files the app ships: no check judged them, and the baseline keeps the entries of secret_in_shipped_file.
  • android/app/src/main/ and android/app/src/release/, the source sets a release build is made of: the AndroidManifest.xml of each, and the network security configuration that android:networkSecurityConfig="@xml/<name>" names (res/xml/<name>.xml of the release build type where it has one, else of the main source set). Never debug/ or profile/. An attribute of the application that both manifests write is read as a release build has it: the release one’s.
  • ios/Runner/Info.plist and macos/Runner/Info.plist, in the XML format of a property list.

A file that is there and cannot be judged, such as a binary property list or a manifest that is not well-formed XML, is not checked. The console report names it in the box Not checked, once for all the checks that read it, and it is not among the files of the result:

╭─ Not checked ──────────────────────────────────────────────────────────── 2 ─╮
│ `android/app/src/main/AndroidManifest.xml` is not well-formed XML, so no │
│ check judged it: </manifest> where </application> is expected, at line 3. │
│ │
│ `ios/Runner/Info.plist` is a binary property list, so no check judged it. │
╰──────────────────────────────────────────────────────────────────────────────╯

Only what a project writes is judged. A setting that is not written has the platform’s default, and the defaults of current apps are safe; otherwise every app would have the result.

Setting When it is not written Source
android:usesCleartextTraffic, cleartextTrafficPermitted clear text refused for apps that target Android 9 (API level 28) and later; Flutter targets API level 36 by default Android’s reference of <application> and its network security configuration
android:debuggable false; the build makes a debug build debuggable Android’s reference of <application>
android:allowBackup true, the backup copying most files: a default of every app, so no result, though writing it true with no rule is one Android’s reference of <application>
android:exported not exported for a component with no filter of intents; a component with a filter and no value is refused by the build for apps that target Android 12 and later Android’s references of the components, Android 12’s changes of behaviour
NSAppTransportSecurity App Transport Security on: plain HTTP refused Apple’s reference of the keys of App Transport Security

A setting that the platform ignores is no result either:

  • android:usesCleartextTraffic where a network security configuration is named (Android 7 and later take the configuration);
  • NSAllowsArbitraryLoads beside NSAllowsArbitraryLoadsForMedia, NSAllowsArbitraryLoadsInWebContent or NSAllowsLocalNetworking (iOS 10 and macOS 10.12 and later ignore it then);
  • <debug-overrides> of a network security configuration (ignored by a build that is not debuggable).

Every result is a violation with the source project_file, the check’s name as its rule, the advisory tier and the check’s security class (SARIF only). No result is placed in a path that assay.exclude, analyzer.exclude or the check’s own exclude covers.

Its fingerprint is of what the result is, not of the line it is on: the check’s name, the file, the result’s place and the normalised text of its range, with an ordinal among results that are alike.

  • The place is the path of the XML element it is in, with the android:name of each element that has one (manifest/application/service[.Sync]); the keys of a property list down to its key (NSAppTransportSecurity/NSExceptionDomains/shop.dev/NSExceptionAllowsInsecureHTTPLoads); the keys of a JSON or YAML document down to its value (service/apiSecret); or the key of a line of keys (API_SECRET).
  • The text of its range is the attribute, the key or the value as it is written.

So an edit of other text on its line keeps the result the one it was: a comma after the last key of a JSON file, an attribute added after android:allowBackup, a label renamed on the line of the application. A secret or a setting written anew, or moved to another element or key, is another result. A result of a file as a whole, such as a key store, is placed at line 1, column 1 and fingerprinted with the empty text.

A message names the kind of a secret and the name it is bound to, never its value, and the fingerprint is a digest: neither the report nor the baseline holds a secret.

Every reporter of check works. In SARIF a result carries the property source: project_file, and its check’s descriptor the security class. In SARIF, GitLab and GitHub a result is advisory like any other: level note, severity minor, a notice annotation. See assay project-files.