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
- 1Deploy only build/web, not the project root.
- 2Deny pubspec.yaml, pubspec.lock and the .dart_tool directory at the web server.
- 3Check the resolved package versions for known advisories.
Code examples
Deploy only the built output
flutter build web --release
rsync -a --delete build/web/ deploy@host:/var/www/app/Nginx: deny project files
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.
More supply chain checks
- Mediumnpm/yarn Lock File Exposed
- MediumPython Requirements File Exposed
- MediumRuby Gemfile or Gemfile.lock Exposed
- MediumExternal CDN Script Without SRI Hash
- HighHTTP Script Loaded on HTTPS Page
- MediumPHP composer.json or composer.lock Exposed
- HighDockerfile or docker-compose.yml Exposed
- Critical.env File Exposed at Public URL
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.