天天看点

Microsoft 防跨站点脚本库AntiXSS Library v4.2.1

the sanitizer has been changed to remove all css it encounters, this new behaviour means that if you were keeping css formatting from html that is no longer going to be the case.

in addition to the change necessary to correct the vulnerability there are a few new features;

minimum requirements.

you can now, once again, use the encoder libraries with .net 2.0. the installer will create directories for each framework version supported, .net 2.0, .net 3.5 and .net 4.0 which contain an optimized version of the encoders for that platform.

invalid unicode no longer throws an exception.

invalid unicode characters are now replaced with the unicode replacement character, u+fffd (�). previously, when encoding strings through htmlencode, htmlattributeencode, xmlencode, xmlattributeencode or cssencode invalid unicode characters would be detected and an exception thrown.

urlpathencode added.

the encoding library now has urlpathencode which will encode a string for use as the path part of a url.

.net 4.0 encoder support.

there’s finally an official way to swap antixss into the framework. if you are using .net 4.0 ensure you are using the .net 4.0 version of the encoding library and then edit your web.config and add the encodertype attribute to the httpruntime element; i.e.

本文来自云栖社区合作伙伴“donet跨平台”,了解相关信息可以关注“opendotnet”微信公众号

继续阅读