草庐IT

joel-costigliola

全部标签

html - 按照 Joel 的建议使用类型系统防止 XSS 攻击

在Podcast58(大约20分钟后),Jeff提示HTML.Encode()的问题,Joel谈到使用类型系统来处理普通字符串和HTMLStrings:AbriefpoliticalrantabouttheevilofviewenginesthatfailtoHTMLencodebydefault.Theproblemwiththisdesignchoiceisthatitisnot“safebydefault”,whichisalwaysthewrongchoiceforaframeworkorAPI.Forgettoencodesomebitofuser-entereddatain