<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Security on Commentary of Takao</title><link>https://takao.blog/zh/tags/security/</link><description>Recent content in Security on Commentary of Takao</description><generator>Hugo -- gohugo.io</generator><language>zh</language><copyright>Commentary of Takao</copyright><lastBuildDate>Thu, 16 Jul 2026 11:16:06 +0900</lastBuildDate><atom:link href="https://takao.blog/zh/tags/security/index.xml" rel="self" type="application/rss+xml"/><item><title>2026 年 OWASP ZAP：高级扫描和 CI/CD 集成</title><link>https://takao.blog/zh/web/owasp-zap-advanced-2026/</link><pubDate>Tue, 09 Jun 2026 00:00:00 +0900</pubDate><guid>https://takao.blog/zh/web/owasp-zap-advanced-2026/</guid><description>&lt;img src="https://takao.blog/img/thumbnail/owasp-zap-advanced-2026-zh.png" alt="Featured image of post 2026 年 OWASP ZAP：高级扫描和 CI/CD 集成" /&gt;&lt;h2 id="超越基本扫描"&gt;超越基本扫描
&lt;/h2&gt;&lt;p&gt;OWASP ZAP 自早期以来已经发生了显着的发展。到 2026 年，它不再只是一个点击式代理扫描器，而是一个功能齐全的安全自动化平台，具有强大的 API、可编写脚本的自动化框架和深度 CI/CD 集成。如果您首先需要基础知识，请阅读我们的 &lt;a class="link" href="https://takao.blog/web/how-to-owasp-zap/" &gt;OWASP ZAP 安装和设置指南&lt;/a&gt;。本文介绍了大规模运行安全测试的团队的高级工作流程。&lt;/p&gt;</description></item><item><title>为 Hugo 博客设计现代内容安全策略</title><link>https://takao.blog/zh/web/hugo-latest-csp-best-practices-2026/</link><pubDate>Fri, 05 Jun 2026 00:00:00 +0900</pubDate><guid>https://takao.blog/zh/web/hugo-latest-csp-best-practices-2026/</guid><description>&lt;img src="https://takao.blog/img/thumbnail/hugo-latest-csp-best-practices-2026-zh.png" alt="Featured image of post 为 Hugo 博客设计现代内容安全策略" /&gt;&lt;h2 id="为什么-csp-对于静态站点很重要"&gt;为什么 CSP 对于静态站点很重要
&lt;/h2&gt;&lt;p&gt;使用 Hugo 构建的静态站点本质上比动态应用程序更安全，但它们仍然执行用于分析、广告和嵌入的第三方脚本。 &lt;strong&gt;内容安全策略 (CSP)&lt;/strong&gt; 通过控制可以加载的资源来保护您的访问者免受 XSS、数据注入和恶意脚本执行的侵害。&lt;/p&gt;</description></item><item><title>使用 SSH 密钥代替 GPG 密钥进行 Git 提交签名</title><link>https://takao.blog/zh/web/git-signing-commits-ssh-keys/</link><pubDate>Mon, 25 May 2026 00:00:00 +0900</pubDate><guid>https://takao.blog/zh/web/git-signing-commits-ssh-keys/</guid><description>&lt;img src="https://takao.blog/img/thumbnail/git-signing-commits-ssh-keys-zh.png" alt="Featured image of post 使用 SSH 密钥代替 GPG 密钥进行 Git 提交签名" /&gt;&lt;p&gt;长期以来，GPG（GNU Privacy Guard）密钥是签署 Git 提交以证明身份并防止篡改的行业标准。然而，设置 GPG 涉及生成密钥环、管理过期日期和调试后台代理，这给开发人员带来了很大的麻烦。&lt;/p&gt;</description></item><item><title>使用仅内容安全策略报告安全地测试 CSP 规则</title><link>https://takao.blog/zh/web/security-content-security-policy-csp-report-only/</link><pubDate>Fri, 15 May 2026 00:00:00 +0900</pubDate><guid>https://takao.blog/zh/web/security-content-security-policy-csp-report-only/</guid><description>&lt;img src="https://takao.blog/img/thumbnail/security-content-security-policy-csp-report-only-zh.png" alt="Featured image of post 使用仅内容安全策略报告安全地测试 CSP 规则" /&gt;&lt;h2 id="损坏的小部件问题"&gt;损坏的小部件问题
&lt;/h2&gt;&lt;p&gt;部署内容安全策略是抵御 XSS 攻击的最强有力的防御措施之一。但是，一个错误配置的指令可能会默默地破坏内联脚本、阻止 CDN 资源或禁用分析。如果您直接通过 &lt;code&gt;Content-Security-Policy&lt;/code&gt; 标头应用 CSP，并且关键脚本被阻止，您的生产站点就会中断 - 通常没有明显的错误控制台通知。&lt;/p&gt;</description></item><item><title>网络安全中 JWT 令牌与有状态会话的比较</title><link>https://takao.blog/zh/web/security-jwt-vs-session-auth/</link><pubDate>Fri, 20 Mar 2026 00:00:00 +0900</pubDate><guid>https://takao.blog/zh/web/security-jwt-vs-session-auth/</guid><description>&lt;img src="https://takao.blog/img/thumbnail/security-jwt-vs-session-auth-zh.png" alt="Featured image of post 网络安全中 JWT 令牌与有状态会话的比较" /&gt;&lt;h2 id="介绍"&gt;介绍
&lt;/h2&gt;&lt;p&gt;身份验证是每个 Web 应用程序的支柱。出现了两种主要模式：&lt;strong&gt;无状态 JWT（JSON Web 令牌）&lt;/strong&gt; 身份验证和 &lt;strong&gt;基于状态会话&lt;/strong&gt; 身份验证。两者都解决相同的问题——在后续请求中验证用户是谁——但它们在存储、撤销和安全属性方面有根本的不同。本文提供了详细的比较，以帮助您选择适合您的应用程序的方法。&lt;/p&gt;</description></item><item><title>域安全：设置 SPF、DKIM 和 DMARC 设置</title><link>https://takao.blog/zh/web/web-security-dnssec-spf-dkim-dmarc/</link><pubDate>Sun, 15 Feb 2026 00:00:00 +0900</pubDate><guid>https://takao.blog/zh/web/web-security-dnssec-spf-dkim-dmarc/</guid><description>&lt;img src="https://takao.blog/img/thumbnail/web-security-dnssec-spf-dkim-dmarc-zh.png" alt="Featured image of post 域安全：设置 SPF、DKIM 和 DMARC 设置" /&gt;&lt;h2 id="介绍"&gt;介绍
&lt;/h2&gt;&lt;p&gt;电子邮件身份验证对于防止域欺骗、网络钓鱼和垃圾邮件文件夹拒绝至关重要。三个基于 DNS 的标准 — &lt;strong&gt;SPF&lt;/strong&gt;、&lt;strong&gt;DKIM&lt;/strong&gt; 和 &lt;strong&gt;DMARC&lt;/strong&gt; — 共同验证声称来自您的域的电子邮件是否合法。如果没有这些记录，攻击者就可以代表您发送伪造的电子邮件，而合法电子邮件可能会进入收件人的垃圾邮件文件夹。本指南解释了每个标准并展示了如何在 Cloudflare 或您的 DNS 提供商上配置它们。&lt;/p&gt;</description></item><item><title>使用 HSTS 策略安全地实施 HTTPS 连接</title><link>https://takao.blog/zh/web/web-security-http-strict-transport-hsts-hacks/</link><pubDate>Fri, 16 Jan 2026 00:00:00 +0900</pubDate><guid>https://takao.blog/zh/web/web-security-http-strict-transport-hsts-hacks/</guid><description>&lt;img src="https://takao.blog/img/thumbnail/web-security-http-strict-transport-hsts-hacks-zh.png" alt="Featured image of post 使用 HSTS 策略安全地实施 HTTPS 连接" /&gt;&lt;h2 id="第一个请求问题"&gt;第一个请求问题
&lt;/h2&gt;&lt;p&gt;HTTPS 在建立连接后对流量进行加密，但对 HTTP URL 的初始请求仍以明文形式发送。同网络上的攻击者可以拦截第一个请求，执行 &lt;strong&gt;SSL 分割&lt;/strong&gt;攻击，将用户在整个会话中降级为 HTTP。&lt;/p&gt;</description></item><item><title>CORS 的工作原理以及修复访问阻止错误</title><link>https://takao.blog/zh/web/web-security-http-headers-cors/</link><pubDate>Mon, 15 Dec 2025 00:00:00 +0900</pubDate><guid>https://takao.blog/zh/web/web-security-http-headers-cors/</guid><description>&lt;img src="https://takao.blog/img/thumbnail/web-security-http-headers-cors-zh.png" alt="Featured image of post CORS 的工作原理以及修复访问阻止错误" /&gt;&lt;h2 id="介绍"&gt;介绍
&lt;/h2&gt;&lt;p&gt;&lt;strong&gt;CORS（资源共享）&lt;strong&gt;是一种浏览器安全，用于控制来自一个源的网页如何请求来自不同源的资源。当&lt;code&gt;https://app.example.com&lt;/code&gt;处的前端尝试从&lt;code&gt;https://api.example.org&lt;/code&gt;获取数据时，浏览器默认强制执行&lt;/strong&gt;同源策略&lt;/strong&gt;。CORS提供了一种通过HTTP标头来放宽此策略的受控方法。本文介绍了完整的CORS流程、预检请求以及如何修复常见的阻止访问错误。&lt;/p&gt;</description></item><item><title>审核 NPM 依赖关系：Snyk 和自动化补丁管理</title><link>https://takao.blog/zh/web/security-dependency-vulnerabilities-npm-audit/</link><pubDate>Sat, 15 Nov 2025 00:00:00 +0900</pubDate><guid>https://takao.blog/zh/web/security-dependency-vulnerabilities-npm-audit/</guid><description>&lt;img src="https://takao.blog/img/thumbnail/security-dependency-vulnerabilities-npm-audit-zh.png" alt="Featured image of post 审核 NPM 依赖关系：Snyk 和自动化补丁管理" /&gt;&lt;h2 id="供应链问题"&gt;供应链问题
&lt;/h2&gt;&lt;p&gt;现代 JavaScript 应用程序提供了数以万计的传递依赖项。每一个都是潜在的攻击媒介。 &lt;strong&gt;event-stream&lt;/strong&gt; 事件（2018 年）将恶意程序包注入到流行的依赖项中，这表明漏洞可能来自树中的任何位置。在这种规模下，仅依靠人工审核是不可能的。&lt;/p&gt;</description></item><item><title>使用 GPG 或 SSH 和验证徽章签署 Git 提交</title><link>https://takao.blog/zh/web/git-commit-signing-gpg/</link><pubDate>Thu, 25 Sep 2025 00:00:00 +0900</pubDate><guid>https://takao.blog/zh/web/git-commit-signing-gpg/</guid><description>&lt;img src="https://takao.blog/img/thumbnail/git-commit-signing-gpg-zh.png" alt="Featured image of post 使用 GPG 或 SSH 和验证徽章签署 Git 提交" /&gt;&lt;p&gt;在 GitHub 上查看提交日志时，您可能会注意到某些提交旁边有一个绿色的“&lt;strong&gt;已验证&lt;/strong&gt;”徽章。此标签表明提交已经过加密签名并确认来自合法的、经过验证的用户。&lt;/p&gt;
&lt;p&gt;默认情况下，Git 允许开发人员使用 &lt;code&gt;git config user.email&lt;/code&gt; 等简单命令配置他们选择的任何名称和电子邮件地址。这意味着冒充是微不足道的。为了保证身份验证并防止未经授权的贡献，强烈建议&lt;strong&gt;提交签名&lt;/strong&gt;。&lt;/p&gt;</description></item><item><title>缓解 CSRF：SameSite Cookie 属性和 CSRF 令牌</title><link>https://takao.blog/zh/web/security-csrf-tokens-samesite-cookies/</link><pubDate>Mon, 25 Aug 2025 00:00:00 +0900</pubDate><guid>https://takao.blog/zh/web/security-csrf-tokens-samesite-cookies/</guid><description>&lt;img src="https://takao.blog/img/thumbnail/security-csrf-tokens-samesite-cookies-zh.png" alt="Featured image of post 缓解 CSRF：SameSite Cookie 属性和 CSRF 令牌" /&gt;&lt;h2 id="介绍"&gt;介绍
&lt;/h2&gt;&lt;p&gt;Cookie 是管理用户身份验证状态的便捷机制。当会话 ID 存储在 cookie 中时，浏览器会自动将其附加到针对该域的传出 HTTP 请求。&lt;/p&gt;
&lt;p&gt;但是，此自动附件功能会被 &lt;strong&gt;跨站点请求伪造 (CSRF)&lt;/strong&gt; 攻击所利用。&lt;/p&gt;</description></item><item><title>为什么以及如何在 CSP 中采用“严格动态”</title><link>https://takao.blog/zh/web/security-csp-strict-dynamic-implementation/</link><pubDate>Sun, 15 Jun 2025 00:00:00 +0900</pubDate><guid>https://takao.blog/zh/web/security-csp-strict-dynamic-implementation/</guid><description>&lt;img src="https://takao.blog/img/thumbnail/security-csp-strict-dynamic-implementation-zh.png" alt="Featured image of post 为什么以及如何在 CSP 中采用“严格动态”" /&gt;&lt;h2 id="介绍"&gt;介绍
&lt;/h2&gt;&lt;p&gt;实施&lt;strong&gt;内容安全策略 (CSP)&lt;/strong&gt; 是减轻跨站脚本 (XSS) 风险的高效方法。然而，配置和维护策略可能会成为一个令人头疼的问题。&lt;/p&gt;
&lt;p&gt;对于使用第三方 SDK（例如 Google 跟踪代码管理器、分析信标、支付小部件或社交共享按钮）的网站，这些脚本通常会从嵌套域动态加载（注入）其他脚本。这迫使开发人员在 &lt;code&gt;script-src&lt;/code&gt; 指令中维护一个长而脆弱的外部域白名单。&lt;/p&gt;</description></item><item><title>Web开发中XSS的防御原则</title><link>https://takao.blog/zh/web/security-basics-xss-prevention/</link><pubDate>Tue, 25 Feb 2025 00:00:00 +0900</pubDate><guid>https://takao.blog/zh/web/security-basics-xss-prevention/</guid><description>&lt;img src="https://takao.blog/img/thumbnail/security-basics-xss-prevention-zh.png" alt="Featured image of post Web开发中XSS的防御原则" /&gt;&lt;h2 id="介绍"&gt;介绍
&lt;/h2&gt;&lt;p&gt;在网络安全中，&lt;strong&gt;跨站脚本 (XSS)&lt;/strong&gt; 是最古老、最持久的漏洞之一。&lt;/p&gt;
&lt;p&gt;如果恶意脚本在受害者的浏览器上运行，它们可能会破坏整个会话、窃取会话令牌 (cookie)、劫持帐户或动态更改页面内容以获取敏感凭据。&lt;/p&gt;</description></item><item><title>子资源完整性：保护您的 CDN 依赖项</title><link>https://takao.blog/zh/web/subresource-integrity/</link><pubDate>Fri, 20 Dec 2024 00:00:00 +0900</pubDate><guid>https://takao.blog/zh/web/subresource-integrity/</guid><description>&lt;img src="https://takao.blog/img/thumbnail/subresource-integrity-zh.png" alt="Featured image of post 子资源完整性：保护您的 CDN 依赖项" /&gt;&lt;p&gt;子资源完整性 (SRI) 是一项安全功能，可让浏览器验证从 CDN 或第三方来源获取的资源是否未被篡改。在供应链攻击的时代——英国航空公司 Magecart 漏洞、Polyfill.io 泄露以及众多 CDN 事件——SRI 提供加密保证，确保您的页面加载的资源正是您想要的。&lt;/p&gt;</description></item><item><title>安全 Cookie 配置：完整的 Web 开发人员指南</title><link>https://takao.blog/zh/web/secure-cookies/</link><pubDate>Mon, 09 Dec 2024 00:00:00 +0900</pubDate><guid>https://takao.blog/zh/web/secure-cookies/</guid><description>&lt;img src="https://takao.blog/img/thumbnail/secure-cookies-zh.png" alt="Featured image of post 安全 Cookie 配置：完整的 Web 开发人员指南" /&gt;&lt;p&gt;Cookie 仍然是网络上最常配置错误的安全控制之一。单个缺失的属性可能会使您的应用程序遭受会话劫持、CSRF 或跨站点信息泄漏。现代浏览器已经推出了更严格的默认值，但了解每个属性并正确组合它们对于纵深防御至关重要。&lt;/p&gt;</description></item><item><title>SQL注入预防：现代数据库安全指南</title><link>https://takao.blog/zh/web/sql-injection-prevention/</link><pubDate>Tue, 01 Oct 2024 00:00:00 +0900</pubDate><guid>https://takao.blog/zh/web/sql-injection-prevention/</guid><description>&lt;img src="https://takao.blog/img/thumbnail/sql-injection-prevention-zh.png" alt="Featured image of post SQL注入预防：现代数据库安全指南" /&gt;&lt;p&gt;尽管人们已经意识到 SQL 注入数十年，但它仍然位居 OWASP 前 10 名之列。 2023 年至 2024 年期间，医疗保健、电子商务和政府部门发生了引人注目的涉及 SQLi 的违规事件。虽然经典的 &lt;code&gt;' OR 1=1 --&lt;/code&gt; 攻击众所周知，但现代变体包括二阶注入、盲目 SQLi（基于时间和基于布尔）和带外渗漏。预防措施很容易理解，但由于遗留代码、ORM 滥用和测试自动化不足而执行不力。&lt;/p&gt;</description></item><item><title>容器安全</title><link>https://takao.blog/zh/web/container-security/</link><pubDate>Tue, 16 Jul 2024 00:00:00 +0900</pubDate><guid>https://takao.blog/zh/web/container-security/</guid><description>&lt;img src="https://takao.blog/img/thumbnail/container-security-zh.png" alt="Featured image of post 容器安全" /&gt;&lt;p&gt;Container security is no longer optional. With supply chain attacks on the rise, securing container images from build to runtime is a fundamental requirement for any organization running containerized workloads. Runtime security alone is insufficient; supply chain security must start at the image build stage.&lt;/p&gt;
&lt;h2 id="the-container-supply-chain-threat-landscape"&gt;The Container Supply Chain Threat Landscape
&lt;/h2&gt;&lt;p&gt;Attack vectors in the container supply chain include compromised base images, vulnerable dependencies, leaked secrets, and malicious packages. Real-world incidents such as the Codecov breach exposing credentials, dependency confusion attacks, and cryptominers found in public images highlight the severity of these threats. The shared responsibility model means that while platforms like Docker provide base infrastructure, the security of your built images is your responsibility.&lt;/p&gt;</description></item><item><title>使用 Vaultwarden 和 Bitwarden SSH 代理管理 SSH 密钥</title><link>https://takao.blog/zh/web/vaultwarden-ssh-key/</link><pubDate>Thu, 20 Jun 2024 00:00:00 +0000</pubDate><guid>https://takao.blog/zh/web/vaultwarden-ssh-key/</guid><description>&lt;img src="https://takao.blog/img/thumbnail/vaultwarden-ssh-key-zh.png" alt="Featured image of post 使用 Vaultwarden 和 Bitwarden SSH 代理管理 SSH 密钥" /&gt;&lt;h2 id="为什么将-ssh-密钥存储在密码管理器中"&gt;为什么将 SSH 密钥存储在密码管理器中
&lt;/h2&gt;&lt;p&gt;SSH 密钥是对远程服务器、Git 提供商和内部基础设施进行身份验证的黄金标准。然而，大多数开发人员将它们作为普通文件存储在 &lt;code&gt;~/.ssh/&lt;/code&gt; 下 - 不受保护、未同步且未经审核。将 SSH 密钥移至 Vaultwarden（或 Bitwarden）解决了三个基本问题：&lt;/p&gt;</description></item><item><title>API速率限制</title><link>https://takao.blog/zh/web/api-rate-limiting/</link><pubDate>Tue, 07 May 2024 00:00:00 +0900</pubDate><guid>https://takao.blog/zh/web/api-rate-limiting/</guid><description>&lt;img src="https://takao.blog/img/thumbnail/api-rate-limiting-zh.png" alt="Featured image of post API速率限制" /&gt;&lt;p&gt;Rate limiting is a critical component of any production API. It protects backend services from abuse, ensures fair resource allocation, maintains performance under load, and mitigates denial-of-service attacks. This article examines the major rate limiting algorithms, their trade-offs, and best practices for designing robust systems.&lt;/p&gt;
&lt;h2 id="token-bucket-algorithm"&gt;Token Bucket Algorithm
&lt;/h2&gt;&lt;p&gt;The token bucket is one of the most widely used rate limiting algorithms. A bucket holds tokens that refill at a steady rate, and each request consumes one token. If the bucket is empty, the request is denied. This approach allows bursts up to the bucket capacity while smoothing traffic over time.&lt;/p&gt;</description></item><item><title>WebAuthn和密钥：2024年的无密码身份验证</title><link>https://takao.blog/zh/web/webauthn-passkeys/</link><pubDate>Tue, 02 Apr 2024 00:00:00 +0900</pubDate><guid>https://takao.blog/zh/web/webauthn-passkeys/</guid><description>&lt;img src="https://takao.blog/img/thumbnail/webauthn-passkeys-zh.png" alt="Featured image of post WebAuthn和密钥：2024年的无密码身份验证" /&gt;&lt;p&gt;几十年来，密码一直是主要的身份验证机制，但它们存在着可查的安全性和可用性问题。WebAuthn（Web 验证）和新兴的密钥生态系统有望用加密安全、防网络钓鱼的身份验证取代密码。到2024年，所有主要平台的密钥支持都已达到关键点，这使得现在实施无密码身份验证的理想时机。&lt;/p&gt;</description></item><item><title>Vaultwarden：自托管密码管理器安装指南</title><link>https://takao.blog/zh/web/vaultwarden-install/</link><pubDate>Fri, 15 Mar 2024 00:00:00 +0000</pubDate><guid>https://takao.blog/zh/web/vaultwarden-install/</guid><description>&lt;img src="https://takao.blog/img/thumbnail/vaultwarden-install-zh.png" alt="Featured image of post Vaultwarden：自托管密码管理器安装指南" /&gt;&lt;h2 id="避难所守护者是什么"&gt;避难所守护者是什么？
&lt;/h2&gt;&lt;p&gt;Vaultwarden 是 Bitwarden 服务器 API 的开源、自托管实现，用 Rust 编写。与需要 Microsoft SQL Server 数据库和大量系统资源的官方 Bitwarden 服务器相比，它的设计是轻量级且资源高效的。 Vaultwarden 支持所有官方 Bitwarden 客户端——桌面、浏览器扩展、移动应用程序和 CLI——无需任何修改。&lt;/p&gt;</description></item><item><title>OAuth 2.0 和 OpenID Connect：现代身份验证指南</title><link>https://takao.blog/zh/web/oauth-oidc/</link><pubDate>Mon, 29 Jan 2024 00:00:00 +0900</pubDate><guid>https://takao.blog/zh/web/oauth-oidc/</guid><description>&lt;img src="https://takao.blog/img/thumbnail/oauth-oidc-zh.png" alt="Featured image of post OAuth 2.0 和 OpenID Connect：现代身份验证指南" /&gt;&lt;p&gt;OAuth 2.0 和 OpenID Connect 构成了现代 Web 身份验证和授权的支柱。尽管它们无处不在，但这些协议经常被误解和错误配置，导致出现可预防的安全漏洞。本指南涵盖了将身份验证安全地集成到应用程序中所需的核心概念、实施模式和安全最佳实践。&lt;/p&gt;</description></item></channel></rss>