Questions tagged [antisamy]

An API for ensuring user-supplied HTML/CSS is in compliance within an application's rules.

Antisamy is an API for ensuring user-supplied HTML/CSS is in compliance within an application's rules. Another way of saying that could be: It's an API that helps you make sure that clients don't supply malicious cargo code in the HTML they supply for their profile, comments, etc., that get persisted on the server. The term "malicious code" in regards to web applications usually mean "JavaScript." Cascading Stylesheets are only considered malicious when they invoke the JavaScript engine. However, there are many situations where "normal" HTML and CSS can be used in a malicious manner. So we take care of that too.

Philosophically, AntiSamy is a departure from contemporary security mechanisms. Generally, the security mechanism and user have a communication that is virtually one way, for good reason. Letting the potential attacker know details about the validation is considered unwise as it allows the attacker to "learn" and "recon" the mechanism for weaknesses. These types of information leaks can also hurt in ways you don't expect. A login mechanism that tells the user, "Username invalid" leaks the fact that a user by that name does not exist. A user could use a dictionary or phone book or both to remotely come up with a list of valid usernames. Using this information, an attacker could launch a brute force attack or massive account lock denial-of-service. We get that.

Unfortunately, that's just not very usable in this situation. Typical Internet users are largely pretty bad when it comes to writing HTML/CSS, so where do they get their HTML from? Usually they copy it from somewhere out on the web. Simply rejecting their input without any clue as to why is jolting and annoying. Annoyed users go somewhere else to do their social networking.

53 questions
5
votes
1 answer

AntiSamy to prevent XSS in java?

Basically I have a web-app which it currently is vulnerable to XSS. Based on my research I found one of good and open library that can help would be AntiSamy. So I downloaded the library .jar file which is antisamy-1.5.1.jar and The policy file…
jaksdfjl
  • 115
  • 3
  • 9
5
votes
2 answers

Antisamy or Content Security Policy or both to prevent XSS attack

Recently I studied a lot related to XSS attacks. I was searching for prevention techniques of XSS attack. I came across a library called Antisamy, suggested by OWASP. AntiSamy is an HTML, CSS and JavaScript filter for Java that sanitizes user input…
tiger
  • 653
  • 7
  • 18
5
votes
2 answers

antisamy parser force closing tag

I use Antisamy for validating HTML. My policy allow iframes, like youtube videos. Problem is - if tag is empty(like this): than after cleaning it…
msangel
  • 9,895
  • 3
  • 50
  • 69
4
votes
1 answer

AntiSamy for TinyMce style attributes

I'm using the antisamy on text i get from tinymce editor. I'm using the "antisamy-tinymce-1.4.4.xml" file from owaspantisam. (as the policy file). My problem is that it destroys all of the style tags attributes of the string i get from the tinymce…
user590586
  • 2,960
  • 16
  • 63
  • 96
4
votes
3 answers

Can I get robust XSS protection in CF11 that I can apply to an entire site without touching every query or input?

So I'm currently using CF11 and CFWheels 1.1, the "Global Script Protection"(GSP) server feature does an awful job of covering the XSS bases. I would like to extend it to block any and all tags/vectors for JS from being inserted into the database.…
gnarbarian
  • 2,622
  • 2
  • 19
  • 25
3
votes
0 answers

Is AntiSamy policy actual

I use the following code to filter out javascript code in user-submitted html files on Android: Policy antiSamyPolicy; try { antiSamyPolicy = Policy.getInstance(AntiSamy.class.getResourceAsStream("/antisamy.xml")); } catch…
Anton Malyshev
  • 8,686
  • 2
  • 27
  • 45
3
votes
1 answer

RGBA values in styles are removed by AntiSamy

HTML Analyst Reg Exp for RGBA
ykjs121
  • 385
  • 1
  • 2
  • 16
3
votes
0 answers

How to allow all SVG elements and its attributes using Antisamy?

I want to allow all the svg elements and its attributes using Antisamy. How do I do that? I tried including all the elements and its attributes in the Antisamy policy file, and setting the regular expression to allow any string as .* . But I get the…
tiger
  • 653
  • 7
  • 18
3
votes
1 answer

How to configure antisamy in cq 5.5?

I have cq 5.5 project. I want to Prevent XSS attacks. According this link cq provides integration with AntiSamy project. Please provide concrete steps for integration with AntiSamy because I really cannot find it. update Should I write code like…
gstackoverflow
  • 36,709
  • 117
  • 359
  • 710
2
votes
1 answer

Instructions on compiling a java project from Google code

I use a tool called AntiSamy ( http://code.google.com/p/owaspantisamy/ ) to sanitize user input in a project. I don't know Java. I just create the object, call its method, and it works. Recently the project was updated on Google code, but the…
dee
  • 1,848
  • 1
  • 22
  • 34
2
votes
1 answer

ParserException Error after deploying antiSamy

I'm using antiSami with my ColdFusion project. I'm loading antiSami through onApplicationStart() like this: local.jarsArray = [ expandPath("lib/antisami/antisamy-1.4.4.jar") ]; application.antiSamiPolicyPath =…
Mohamad
  • 34,731
  • 32
  • 140
  • 219
2
votes
0 answers

Xss Config for data attributes

How to configure XSS-protection config.xml for data-* attributes. It is getting filtered. So far we are adding manually for each data-* attributes. Is there any way to have a generic fix? For eg if we have we are adding like…
2
votes
4 answers

javascript : How to prevent user from entering = in textbox?

I have a requirement where i have to prevent users from entering = in textbox in entire application to prevent vulnerability. I have been using antisamy-1.4.4.xml and XSSFilter.java which takes care of quite a few…
sTg
  • 4,313
  • 16
  • 68
  • 115
2
votes
2 answers

How to include all the elements in PolicyBuilder in OWASP Java HTML Sanitizer

Is there any way to allow everything in the policy and then I would just .disallow() couple of elements and attributes that I know are causing problems. For example instead of doing " PolicyFactory policy = new HtmlPolicyBuilder() …
2
votes
1 answer

OWASP AntiSamy are replacing line breaks to espaces (JAVA)

I'm using OWASP AntiSamy in a JAVA project but everytime I try call the method getCleanHTML() with a string that contains \n character, the method are replacing for a espace " ". I'm already tried to change the rules in XML file, but it still…
gFontaniva
  • 897
  • 11
  • 27
1
2 3 4