Skip to main content
LowSupply chainOWASP A05:2021CWE-540

How to fix: Dart pubspec.lock exposed

The response is a Dart or Flutter pubspec.lock file, served over HTTP. It is identified by its packages block and the direct main and direct dev markers pub writes.

Why it matters

The lockfile names every pub package and its resolved version, and separates direct dependencies from transitive ones. For a Flutter web build it also pins the SDK constraint, which identifies the exact Dart and Flutter versions the bundle was compiled with.

Flutter's web build output is meant to contain only build/web; a reachable pubspec.lock means the whole project directory was deployed. That matters beyond the dependency list, because Flutter projects commonly keep API base URLs and non-secret configuration in files that ship alongside it, and sometimes keys that were meant to stay in the native build.

How to fix it

  1. 1Deploy only build/web, not the project root.
  2. 2Deny pubspec.yaml, pubspec.lock and the .dart_tool directory at the web server.
  3. 3Check the resolved package versions for known advisories.

Code examples

Deploy only the built output

bash
flutter build web --release
rsync -a --delete build/web/ deploy@host:/var/www/app/

Nginx: deny project files

nginx
location ~* /(pubspec\.(yaml|lock)|\.dart_tool)/? {
    return 404;
}

References

Detected automatically by VulnRadar. The check id is supply-chain-pubspec-lock-exposed, stable across every scan so you can filter or diff on it.

See every supply chain check

Questions

How severe is Dart pubspec.lock exposed?
VulnRadar rates this low severity in the supply chain category. The severity is fixed per check, not scored per site, so the same finding is the same severity on every scan.
Does VulnRadar check for this automatically?
Yes. It runs as part of every scan under the check id supply-chain-pubspec-lock-exposed, which stays the same between runs so you can filter, diff, or gate CI on it.
Which standards does Dart pubspec.lock exposed map to?
It maps to CWE-540. In the OWASP Top 10 it falls under A05:2021.

Missing a check?

The detection set is open. If you know a misconfiguration this does not catch, propose it: the issue template asks for the threat model, how to detect it, the false-positive risk, and a test fixture, which is the same thing a maintainer would have to work out anyway.

Propose a checkHow a check is built

Scan your own site for dart pubspec.lock exposed

VulnRadar runs this check and hundreds more against a URL in seconds. No agent to install, just paste a URL.

Or scan this site as a demoRead the docs

How to fix: Dart pubspec.lock exposed | VulnRadar