Aller au contenu

Third-Party Dependencies

BirdNET Live ships code that other people wrote: pub packages, the native libraries they bring along, and the tools the build runs. This page is the policy for keeping a compromised or abandoned package out of a release, and the list of checks that enforce it.

Three rules cover most of it:

  1. Add little. Every dependency is something to watch for as long as the app exists.
  2. Lock everything. A build uses exactly the versions that were reviewed, and fails when it would get something else.
  3. Look every week. A scheduled build and audit report a problem before a release runs into it.

Adding a package

Prefer a small, purpose-built solution over a package that does much more than the task needs. Before proposing a new package, check and state in the pull request:

  • Why it is needed and what the in-house alternative would cost.
  • Privacy: it neither accesses private user data nor communicates with the internet (the app runs on-device).
  • Publisher: a verified publisher on pub.dev, or an author with a track record; a source repository that matches the published package.
  • Maintenance: recent releases, issues being answered, not discontinued.
  • What comes with it: the new transitive packages in the pubspec.lock diff, any native code (Gradle/CocoaPods/Swift Package/CMake), and anything its build downloads. A plugin that fetches binaries at build time needs an entry in the table under Build-time downloads.

Do not fix a bug in a third-party plugin by vendoring or forking it. Report it upstream, switch packages, or replace the plugin with a small in-house implementation.

What is locked, and how

What Locked by Enforced by
Pub packages, direct and transitive pubspec.lock (tracked; holds a SHA-256 for every hosted package) CI and the release workflow run flutter pub get --enforce-lockfile, which fails instead of resolving different versions or accepting different content
Flutter SDK flutter-version in the workflows —
GitHub Actions full commit SHA, with the version as a comment a tag can be moved to other code; a commit SHA cannot
Gradle distributionSha256Sum in android/gradle/wrapper/gradle-wrapper.properties the wrapper refuses a distribution with another hash
ONNX Runtime for Windows version and SHA-256 of the NuGet package in windows/CMakeLists.txt CMake stops on a mismatch; tools/verify_onnxruntime_signature.ps1 then requires Microsoft's signature on the bundled DLL
Python packages for the release and docs builds exact versions in tools/requirements-*.txt —
iOS Swift packages Package.resolved (tracked) Xcode

Never widen a pin, delete a hash, or drop --enforce-lockfile to get a build through. A lock that fails is reporting that the build is about to use something nobody reviewed; find out what changed.

Updating

Dependabot opens the update pull requests (.github/dependabot.yml): pub packages, GitHub Actions, and the Python requirements, once a week. A release must be public for 7 days before it is proposed; most compromised releases are found and withdrawn within that time. Security updates are not delayed.

Before merging an update:

  • Read the package's changelog for the versions in between.
  • Read the pubspec.lock diff. A new transitive package gets the same look as a new direct one.
  • If native code or a build script changed, check what it downloads.
  • CI must pass, including the Windows build.
  • flutter_onnxruntime has its own procedure: ONNX Runtime Pin.

Updating by hand follows the same rules: no release younger than 7 days unless it fixes a vulnerability that affects the app.

Build-time downloads

Besides packages, the build fetches these files. Each comes from its publisher's own distribution channel.

File Fetched by From Verified
ONNX Runtime (Windows) windows/CMakeLists.txt api.nuget.org (Microsoft) SHA-256 pin, Microsoft signature on the DLL
ONNX Runtime (Android), other Android libraries Gradle Google Maven, Maven Central HTTPS only; see Known gaps
Gradle distribution Gradle wrapper services.gradle.org SHA-256 pin
nuget.exe, Microsoft.Windows.CppWinRT geolocator_windows, permission_handler_windows dist.nuget.org, api.nuget.org HTTPS only
Inno Setup release workflow runner image / Chocolatey HTTPS only
Taxonomy export, species images tools/download_taxonomy_json.py, tools/build_species_bundle.py birdnet.tu-chemnitz.de data, not code; the bundle script checks IDs against the model labels

When a source disappears or changes

In November 2026 the microsoft/onnxruntime repository on GitHub became unavailable, and the Windows release build of 1.4.0 failed two weeks later because a plugin downloaded the runtime from there. If a download or package is gone, or a hash no longer matches:

  1. Do not work around it with a copy. No mirrors, forks, re-uploads, or "same file" links from an issue thread, however convenient.
  2. Find out what happened from the publisher's own channels.
  3. If the publisher distributes the same release through another official channel (as Microsoft does through NuGet), switch to it, verify the publisher's signature on the artifact, and pin its hash.
  4. If there is no official source, keep the last reviewed version (the lock files make that possible) and delay the release.

Staying on top of it

  • Weekly CI run (Mondays, .github/workflows/ci.yml): the Android and Windows builds run from the lock files, so a withdrawn package or a dead download fails within a week instead of on release day. tools/dependency_audit.dart fails the run when a locked pub package is discontinued, retracted, or affected by a security advisory. GitHub mails the failure to the person who last changed the workflow's schedule.
  • Dependabot alerts are on for the repository and report advisories for locked versions as they are published.
  • Every pull request builds Android and Windows with the locked versions.
  • Before a release: read git diff <previous tag> -- pubspec.lock once more as a whole, and check that the last weekly run is green. The release workflow verifies the ONNX Runtime signature on its own.

When the audit or an alert reports a package:

  • Security advisory: read it, decide whether the app uses the affected code, and update to the fixed version. This is the one case that skips the 7-day wait.
  • Retracted: the publisher withdrew that version. Move to the version they recommend.
  • Discontinued: plan the replacement (the publisher often names one), or replace the package with in-house code.

Known gaps

These are not verified beyond HTTPS to the publisher's host. They are listed so that nobody assumes otherwise:

  • Android libraries from Maven. Gradle dependency verification (verification-metadata.xml) is not enabled; with Flutter plugins adding their own dependencies it needs regenerating on most updates.
  • nuget.exe and CppWinRT, downloaded by two Windows plugins.
  • Python packages are pinned by version, not by hash, and their own dependencies are not pinned.
  • Inno Setup is whatever the runner image or Chocolatey provides.
  • GitHub-hosted runner images and the Flutter SDK download.