项目
在 GitHub 查看
theSmaw/Caja-HTML-Sanitizer
关于
将 Google Caja 的 HTML Sanitizer 打包为可通过 npm 安装的 Node.js 模块。
网站与应用开发实测星标增长
- 24小时
- 0
- 7天
- 0
- 15天
- -1
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文Maintainers wanted
I don't have time to maintain this repo, and have long forgotten how any of it works.
If anyone would like to take on ownership, please let me know.
Installation
npm install sanitizer
Require
var sanitizer = require('sanitizer');
Use
See /test/test-sanitzer.js for full documentation.
sanitizer.escape('your dirty string'); // Escapes HTML special characters in attribute values as HTML entities
var yourParser = sanitizer.makeSaxParser(yourHandler); // Given a SAX-like event handler, produce a function that feeds those events and a parameter to the event handler.
sanitizer.normalizeRCData('your dirty string'); // Escape entities in RCDATA that can be escaped without changing the meaning.
sanitizer.sanitize('your dirty string'); // Strips unsafe tags and attributes from html.
exports.unescapeEntities('your string'); // The plain text of a chunk of HTML CDATA which possibly containing.
Caveats
It's use this at your own risk really - Caja HTML Sanitizer was written by people far cleverer than me. I have just repackaged it to solve a problem I had (sanitization on a Node server). It seems to work, and it passes all its tests in re-packaged form - however I don't fully understand its internals so cannot guarantee its security.
More information
探索相关项目
加载中…