How to fix: HTTP Script Loaded on HTTPS Page
An HTTPS page loads a JavaScript file over HTTP. This is a mixed-content violation that allows network attackers to replace the HTTP script with malicious code, compromising the entire HTTPS page.
Why it matters
An attacker on the same network (Wi-Fi, ISP-level) can intercept the HTTP script request and replace it with arbitrary JavaScript. This completely compromises the HTTPS page's security guarantees despite TLS protecting the main page.
HTTPS protects the main page load. But if the page loads any resource over HTTP, that resource can be intercepted and modified by a network attacker. A compromised HTTP script can exfiltrate all cookies, form data, and user interactions.
How to fix it
- 1Change all http:// script URLs to https://.
- 2Add Content-Security-Policy: upgrade-insecure-requests to automatically upgrade HTTP to HTTPS.
- 3Add a CSP that blocks all HTTP sources: default-src https:.
- 4Serve all scripts from your own domain over HTTPS.
Code examples
CSP upgrade-insecure-requests
// Next.js middleware
response.headers.set(
'Content-Security-Policy',
'upgrade-insecure-requests; default-src https: \'self\';'
);References
Detected automatically by VulnRadar. The check id is supply-chain-http-script-on-https, 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
- MediumPHP composer.json or composer.lock Exposed
- HighDockerfile or docker-compose.yml Exposed
- Critical.env File Exposed at Public URL
- MediumCDN Script With No Version Pin and No Integrity Hash
Questions
- How severe is HTTP Script Loaded on HTTPS Page?
- 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-http-script-on-https, which stays the same between runs so you can filter, diff, or gate CI on it.
- Which standards does HTTP Script Loaded on HTTPS Page 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.