How to fix: Import map resolves to an unversioned CDN URL
An import map on this page resolves a bare module specifier to an unversioned CDN URL. The path carries no version at all, or an explicit @latest.
Why it matters
Every module the page imports through that specifier is fetched fresh from whatever the CDN currently serves, so the code running in your users' browsers changes when the package publishes, without any deploy on your side. A malicious or compromised release reaches every visitor immediately, and import maps cannot carry an integrity attribute, so there is no hash to catch it.
This is the module-graph version of an unpinned script tag, and it is worse in one specific way: a script tag can carry integrity, an import map entry cannot. That makes the version pin the only control available. Pinning is also what makes the page reproducible, since an unversioned specifier means two users loading the page a week apart can run different code.
How to fix it
- 1Put an exact version in every import map URL. Prefer a specific patch version over a range.
- 2Better still, bundle these modules and serve them from your own origin, where SRI and your own CSP apply.
- 3Restrict script-src in CSP to the specific CDN origin so an unexpected host cannot be introduced.
- 4Automate version bumps through your dependency updater rather than relying on the CDN to hand you the newest build.
Code examples
Pin every entry
<script type="importmap">
{
"imports": {
"lit": "https://cdn.jsdelivr.net/npm/[email protected]/index.js",
"preact": "https://cdn.jsdelivr.net/npm/[email protected]/dist/preact.module.js"
}
}
</script>Constrain where modules may come from
Content-Security-Policy: script-src 'self' https://cdn.jsdelivr.net; object-src 'none'; base-uri 'none'References
Detected automatically by VulnRadar. The check id is supply-chain-importmap-unpinned-cdn, 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 Import map resolves to an unversioned CDN URL?
- VulnRadar rates this medium 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-importmap-unpinned-cdn, which stays the same between runs so you can filter, diff, or gate CI on it.
- Which standards does Import map resolves to an unversioned CDN URL map to?
- It maps to CWE-1357. In the OWASP Top 10 it falls under A08: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.