# Grails 1.1 安全性 - 防止攻击 - HTML/URL注入

**URL:** <https://www.isharkfly.com/t/grails-1-1-html-url/1862>\
**Category:** 程序语言\
**Created:** [November 11, 2012, 3:43am UTC](https://www.isharkfly.com/t/grails-1-1-html-url/1862 "2012-11-11T03:43:36Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![honeymoose](https://www.isharkfly.com/user_avatar/www.isharkfly.com/honeymoose/32/20796_2.png) [@honeymoose](https://www.isharkfly.com/u/honeymoose)\
**Post date:** [November 11, 2012, 3:43am UTC](https://www.isharkfly.com/t/grails-1-1-html-url/1862/1 "2012-11-11T03:43:36Z")

</div>

HTML和URL注入提供有害的数据，之后被用来在页面生成一个链接，点击它不会产生期望的行为，可能会转向另外一个网站或更改请求参数。

Grails提供的codecs可以很容易得处理HTML/URL注入，Grails提供的标签库在适用的地方全都使用encodeAsURL。

如果你自己创建能生成链接的标签，你在做的时候要小心。
