How to fix: Import map resolves a module over plain HTTP
An import map on an HTTPS page maps a module specifier to a cleartext http:// URL on a host other than localhost.
Why it matters
A module fetched over plain HTTP can be replaced in transit by anyone on the network path, and the replacement runs as first-party script on your origin: full access to the DOM, to same-origin storage, and to any session the user has. Browsers block this as active mixed content, so in practice the import fails and the feature breaks, but the map is a standing instruction to load executable code insecurely.
Distinct from an http:// script tag in that the URL is in a JSON policy rather than in markup, so it survives reviews that only look at tags and does not appear in most mixed-content audits. Localhost is excluded here because a development import map pointing at a local dev server is normal and harmless.
How to fix it
- 1Change every import map URL to https, or to a same-origin path.
- 2Add upgrade-insecure-requests to the CSP so any remaining cleartext subresource is upgraded rather than silently failing.
- 3Confirm the target actually serves HTTPS before switching, so the module does not simply stop loading.
Code examples
HTTPS in every entry
<script type="importmap">
{
"imports": {
"app/": "/modules/",
"lit": "https://cdn.jsdelivr.net/npm/[email protected]/index.js"
}
}
</script>References
Detected automatically by VulnRadar. The check id is supply-chain-importmap-insecure-source, 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 a module over plain HTTP?
- VulnRadar rates this high 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-insecure-source, which stays the same between runs so you can filter, diff, or gate CI on it.
- Which standards does Import map resolves a module over plain HTTP map to?
- It maps to CWE-319. In the OWASP Top 10 it falls under A02: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.