Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
smarty-xssrepair
Advanced tools
npm install smarty-xssrepair
通过配置对应类型(js、event、path、xml、data)的转义插件名称,对Smarty模板进行XSS检验修复。
var xss = require('smarty-xssrepair');
/**
* xss.parse()方法参数为对象,通过key->value的方式进行配置设置
*/
var option = {}
escapeMap = {
'js' : 'f_escape_js',
'html' : 'f_escape_xml',
'data' : 'f_escape_data',
'path' : 'f_escape_path',
'event' : 'f_escape_event',
'no_escape' : 'escape:none'
};
//需要进行检测修复的内容,必须参数
option['fileContent'] = '<div class="{#$spUserInfo.userName|f_escape_xml#}">{#$spUserInfo.city|f_escape_xml#}</div>';
//不同类型对应的转义列表,默认为空
option['_check_pattern'] = escapeMap;
//是否进行修复,默认为true
option['isXssAutoFixed'] = true;
//Smarty模板变量左定界符,默认为:<&
option['leftDelimiter'] = '{#';
//Smarty模板变量右定界符,默认为:&>
option['rightDelimiter'] = '#}';
//XSS安全变量,不需要进行转义
option['xssSafeVars'] = ['fis_safe','fis_xss'];
//返回的结果,数据结构为
//error为校验信息,content为修复后内容,realcontent为原内容
//{
// 'error':[],
// 'content':'',
// 'realContent':''
//}
var result = xss.parse(option);
console.log(result['content']);
在源码目录执行命令:npm test
FAQs
XSS repair for the smarty template.
We found that smarty-xssrepair demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.