Skip to content

Security

assay looks for security flaws in two places:

  • Ten rules of security judge your Dart source. They run wherever rules run: in the editor, in dart analyze, in assay check and in the gate.
  • Five project-file checks judge the files your app ships or is built with that are not Dart: the pubspec and the declared assets, the Android manifest, the Info.plist. They run in the command-line program only.

Each of the fifteen has a security class, so that code scanning lists its results as security alerts.

Rule Tier Scope Reports Security class
certificate_check_switched_off blocking Dart A callback that accepts every certificate the TLS check refused: anyone who intercepts the connection reads and changes it. CWE-295 · M5 · 8.1
cleartext_request blocking Dart A request or a page over plain HTTP to a host the code writes and that is not a local host. CWE-319 · M5 · 7.4
hard_coded_credential blocking Dart A credential written into the source: whoever has the app has it. CWE-798, CWE-321 · M1 · 7.8
deterministic_encryption blocking Dart AES in ECB mode, or a fixed initialization vector: equal texts encrypt alike. CWE-327, CWE-1204 · M10 · 7.0
weak_random_for_secret advisory Dart Random() of dart:math, which is predictable, making a token, a password, a nonce or the like. Its fix writes Random.secure(). CWE-338 · M10 · 5.9
weak_hash_for_secret advisory Dart MD5 or SHA-1 protecting a password, a token or a signature. CWE-328, CWE-916 · M10 · 5.3
secret_in_log advisory Dart A secret written to the log, where other apps, crash reports and support tools read it. CWE-532 · M9 · 4.3
javascript_channel_open_to_any_page advisory Flutter A web view’s JavaScript channel that runs any script and loads pages from the network, with nothing that decides which pages load. CWE-749 · M8 · 6.1
link_parameter_opened_unchecked advisory Flutter An address that a link from outside the app gives, opened with no check of where it leads. CWE-601, CWE-939 · M4 · 6.1
secret_in_plain_preferences advisory Flutter A secret kept by shared_preferences, which stores it as plain text in the app’s files. CWE-312, CWE-922 · M9 · 5.5
  • The four blocking rules report definite flaws. Each is a defect wherever it is, and its fix is known.
  • The six advisory rules report findings to review. Each can be right in its place (a token kept in the preferences of a kiosk app, a link the app opens on purpose), so a person decides.

A rule that follows a value, such as a secret on its way to the log or a link on its way to the page it opens, follows it within one function: through final locals, interpolation, +, !, ??, casts, toString() and Uri.parse.

Check Reports Security class
secret_in_shipped_file A secret in the pubspec or in a declared asset, the dot files of a declared directory among them (a .env): whoever has the app has it. 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 network security configuration, App Transport Security on iOS and macOS. CWE-319 · M5 · 5.9
debuggable_app A release build of the Android app that a debugger can attach to. 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 component any app on the device can start, with no permission. CWE-926 · M8 · 5.3

All five are advisory. So a credential written in Dart blocks, and the same credential in a shipped .env does not. The rule meets the value at the line an agent writes it. The check meets a file whose secrets the project may have shipped for years, and has to clear first.

Terminal window
assay check # the ten rules, with every other rule
assay project-files # the five project-file checks

The rules also show in the editor and in dart analyze, and the gate runs them as it runs every rule. The project-file checks never show there: assay project-files and the gate run them. See Project-file checks.

assay:
rules:
cleartext_request:
allowed_hosts: [printer.lan]
  • The rules judge a changed file at turn end as every rule does: a violation of a blocking one in a file the session changed fails the gate, and an advisory one is handed to the agent once.
  • The project-file checks run at every turn end, whatever the session changed. They never fail the gate: a result the session made is handed to the agent once. See Project-file checks for what counts as made.
  • Tests and debug-only code. Every rule of security is silent on the test side and in code that no release build holds: under kDebugMode or !kReleaseMode, a conditional on one of them, the statements after if (kReleaseMode) return;, and the inside of an assert. kProfileMode is not debug-only.

  • Keys that are public by design. These are never a credential, by their providers’ own documentation, which the rule pages cite:

    • the Google API key a Firebase app carries, a Stripe publishable key, a public key of RevenueCat’s SDK, a Mapbox public token, a PostHog project token (phc_…);
    • the pin of a certificate (sha256/ and the base64 digest of its public key);
    • a JSON web token that bears no service role, such as Supabase’s anonymous key;
    • under a name that says what it is: a Mixpanel project token (mixpanelToken), a search-only API key (algoliaSearchApiKey), a certificate pin (certificatePin, sslPin).

    Such a key under a name that does not say so is reported, such as Algolia’s search-only key as the apiKey: of its client, whose Admin key has the same form. Keep it with a justified suppression.

  • Names and labels. The name of a key in camelCase (userAccessTokenKey) and a one-word label in a natural language (Passwortbestätigung) are not credentials.

Each rule and check of security has a security class, given in the tables above:

  • the weaknesses it reports, from the common weakness list (CWE);
  • its risk in the mobile list of 2024 (M1 to M10);
  • a severity from 0.1 to 10.0, assay’s own, per rule: 7.0 to 8.1 for the definite flaws, 3.9 to 6.5 for the findings to review and the platform settings.

Only SARIF carries the class. The SARIF reporter writes it into the rule’s descriptor, after its tier and its source: the tags security, external/cwe/cwe-<n> and external/owasp-mobile-2024/m<n>, and the property security-severity with one decimal ("8.1"). GitHub code scanning reads them, lists these violations as security alerts and ranks them by severity. A result’s level stays its tier’s: error for a blocking rule, note for an advisory one. The console, JSON, GitHub, GitLab and Markdown forms are as for any rule.

You keep a finding you have reviewed and found safe as you keep any other:

  • a rule’s violation: a justified suppression, with the reason on the line above;
  • a project-file check’s result: the baseline, or the check’s exclude.
// The demo account's password, printed on the store page of the app.
// ignore: assay/hard_coded_credential
const demoPassword = 'Demo-2026-shop';

A suppression without a reason is a violation of suppression_requires_justification. A new suppression is listed at the gate, and blocks an agent’s turn end until a person accepts it (see Suppressions). There is no separate “reviewed” state and no list of reviews to keep.