<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Web 安全 on PlumePHP</title><link>https://plumephp.com/tags/web-%E5%AE%89%E5%85%A8/</link><description>Recent content in Web 安全 on PlumePHP</description><generator>Hugo</generator><language>zh-CN</language><lastBuildDate>Fri, 16 Feb 2024 16:42:00 +0800</lastBuildDate><atom:link href="https://plumephp.com/tags/web-%E5%AE%89%E5%85%A8/index.xml" rel="self" type="application/rss+xml"/><item><title>Go HTML 模板安全入门：自动转义、模板函数和页面渲染边界</title><link>https://plumephp.com/go-template-security-html-2024/</link><pubDate>Fri, 16 Feb 2024 16:42:00 +0800</pubDate><guid>https://plumephp.com/go-template-security-html-2024/</guid><description>&lt;p&gt;很多人第一次用 Go 写 Web 页面，会在 &lt;code&gt;text/template&lt;/code&gt; 和 &lt;code&gt;html/template&lt;/code&gt; 之间犹豫。两个包 API 很像，名字也很像，但用途不一样。只要输出的是 HTML 页面，通常就应该使用 &lt;code&gt;html/template&lt;/code&gt;。它最重要的能力是自动上下文转义：用户输入出现在 HTML 文本、属性、JavaScript 或 URL 位置时，模板引擎会按位置做不同处理，降低 XSS 风险。&lt;/p&gt;</description></item></channel></rss>