跳到正文
Skillpedia
安全75k · #2939

mixed-content

它能做什么

这项技能检查 HTTPS 网站中是否有通过纯 HTTP 加载的脚本、图片、样式表和框架。适用于希望安全页面保持安全的网站所有者和开发者。

适用场景

  • ✓当你请智能体检查安全网站中的不安全资源链接的时候。
  • ✓当浏览器就 HTTPS 页面的混合内容发出警告,或拦截了某个脚本的时候。
  • ✓当你把网站迁移到 HTTPS,并想找出仍然残留的 http 地址的时候。

技能链接

https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/mixed-content/SKILL.md

复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。

使用方法

最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。

可直接粘贴的消息

请用这个技能帮我:https://github.com/thedaviddias/Front-End-Checklist/blob/main/skills/mixed-content/SKILL.md 阅读该链接中的 SKILL.md 文件,并在我的任务中按照它的说明来做。
想让你的 AI 自己找到这样的技能吗?安装免费的 Skillpedia MCP:只需一行,每次任务前它都会在 15,000+ 个技能中搜索。1 分钟完成安装 →

可以这样问 AI

“我的浏览器提示 HTTPS 网站上有部分内容不安全。请帮我找出并修复这些链接。”

每周 5 个新技能,1 分钟读完。

工作原理

智能体会扫描页面源代码、网络请求和 CSS 中的纯 HTTP 地址,并将其替换为 HTTPS 版本。它还可以添加安全策略,把仍然残留的地址升级为 HTTPS。

技术内容(原始 SKILL.md)

作者在 GitHub 上的英文原文。

Avoid mixed content on HTTPS pages

Active mixed content (scripts loaded over HTTP into an HTTPS page) gives network attackers the ability to execute arbitrary JavaScript on your page — the same power as XSS, despite the page itself being served over HTTPS.

Quick Reference

  • Active mixed content (scripts, iframes, stylesheets) is blocked outright by all modern browsers
  • Passive mixed content (images, audio, video) triggers a security warning and may be upgraded or blocked
  • Use upgrade-insecure-requests CSP directive to automatically upgrade HTTP sub-resources to HTTPS
  • Audit all hardcoded http:// URLs in HTML, CSS, and JavaScript
  • The Content-Security-Policy: upgrade-insecure-requests directive is the most practical fix for legacy content

Check

Scan the page source and network requests for any HTTP resources loaded on an HTTPS page. Check <script src>, <img src>, <link href>, <iframe src>, and CSS url() values for http:// URLs. Also check the Content-Security-Policy header for the upgrade-insecure-requests directive.

Fix

Replace all http:// resource URLs with https:// equivalents. If the resource provider does not support HTTPS, host the resource yourself or find an alternative. Add Content-Security-Policy: upgrade-insecure-requests as a safety net for any remaining HTTP URLs.

Explain

Explain the difference between active and passive mixed content, why active mixed content is blocked by browsers, and how the upgrade-insecure-requests CSP directive works.

Code Review

Review server config, headers, forms, and integration points related to Avoid mixed content on HTTPS pages. Flag exact responses, cookies, or browser behaviors that violate the rule, and verify them against the effective production-like response.


For full implementation details, code examples, and framework-specific guidance, see references/rule.md.

Rule page: https://frontendchecklist.io/rules/security/mixed-content

常见问题

主动混合内容和被动混合内容有什么区别?

脚本等主动内容会被浏览器拦截,而图片等被动内容可能只会触发警告。

什么是 upgrade-insecure-requests?

它是一项内容安全策略设置,告诉浏览器改用 HTTPS 加载 HTTP 资源。

如果服务提供商不支持 HTTPS 怎么办?

这项技能建议自己托管该资源,或寻找替代方案。

详情

作者的原始描述

Use when reviewing an HTTPS page for resources (scripts, images, stylesheets, iframes) that are loaded over plain HTTP.

repo: thedaviddias/Front-End-Checklist

热度

GitHub 星标
75k
排名
#2939
许可证
MIT
更新时间
2026/10/31

这个技能有用吗?

0

登录 后即可投票。

评论

  • …

同一仓库的更多技能

相似技能