Security News
38% of CISOs Fear They’re Not Moving Fast Enough on AI
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
com.navercorp.lucy:lucy-xss
Advanced tools
Lucy-XSS is an open source library of two defense modules to protect Web applications from XSS attacks. It supports the white-list rule based security policy. The current default rule is Naver's standard. You can change the default rule if you want.
< → <
> → >
" → "
' → '
The latest stable release of lucy-xss is 1.6.3. You can pull it from the central Maven repositories.
<dependency>
<groupId>com.navercorp.lucy</groupId>
<artifactId>lucy-xss</artifactId>
<version>1.6.3</version>
</dependency>
@Test
public void testXssPreventer() {
String dirty = "\"><script>alert('xss');</script>";
String clean = XssPreventer.escape(dirty);
assertEquals(clean, ""><script>alert('xss');</script>");
assertEquals(dirty, XssPreventer.unescape(clean));
}
@Test
public void testSuperSetFix() {
XssSaxFilter filter = XssSaxFilter.getInstance("lucy-xss-superset-sax.xml");
String expected = "<TABLE class=\"Naver_Layout_Main\" style=\"TABLE-LAYOUT: fixed\" cellSpacing=\"0\" cellPadding=\"0\" width=\"743\">" + "</TABLE>" + "<SPAN style=\"COLOR: #66cc99\"></SPAN>";
String actual = filter.doFilter(clean);
assertEquals(expected, actual);
}
@Test
public void pairQuoteCheckOtherCase() {
XssFilter filter = XssFilter.getInstance("lucy-xss-superset.xml");
String dirty = "<img src=\"<img src=1\\ onerror=alert(1234)>\" onerror=\"alert('XSS')\">";
String expected = "<img src=\"\"><!-- Not Allowed Attribute Filtered ( onerror=alert(1234)) --><img src=1\\>\" onerror=\"alert('XSS')\">";
String actual = filter.doFilter(dirty);
assertEquals(expected, actual);
dirty = "<img src='<img src=1\\ onerror=alert(1234)>\" onerror=\"alert('XSS')\">";
expected = "<img src=''><!-- Not Allowed Attribute Filtered ( onerror=alert(1234)) --><img src=1\\>\" onerror=\"alert('XSS')\">";
actual = filter.doFilter(dirty);
assertEquals(expected, actual);
}
For more information, please see User guide
Want to hack on Lucy-XSS? Awesome! There are instructions to get you started here. They are probably not perfect, please let us know if anything feels wrong or incomplete. (Please wait. We are preparing for contribution guide.)
Lucy is licensed under the Apache License, Version 2.0. See LICENSE for full license text.
FAQs
XSS Filter for Web Service
We found that com.navercorp.lucy:lucy-xss demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers 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.
Security News
CISOs are racing to adopt AI for cybersecurity, but hurdles in budgets and governance may leave some falling behind in the fight against cyber threats.
Research
Security News
Socket researchers uncovered a backdoored typosquat of BoltDB in the Go ecosystem, exploiting Go Module Proxy caching to persist undetected for years.
Security News
Company News
Socket is joining TC54 to help develop standards for software supply chain security, contributing to the evolution of SBOMs, CycloneDX, and Package URL specifications.