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
2
votes
0 answers

How to add a HTML5 tag to AntiSamy policy file?

My AntiSamy file does not seem to like the HTML5
tag. Its allowing the tag itself to exist, but nothing contained inside it. So this:
Is becoming this:
volume one
  • 6,800
  • 13
  • 67
  • 146
2
votes
1 answer

How to sanitize form values to allow text-only

I understand that if a user needs to supply HTML code as part of a form input (e.g. in a textarea) then I use an Anti-Samy policy to filter out the hazardous HTML that's not permitted. However, I have some text-fields and text-areas which should be…
volume one
  • 6,800
  • 13
  • 67
  • 146
2
votes
1 answer

How do I modify the Sakai installation's AntiSamy policy files?

I would like to modify a deployed installation of Sakai to allow iframes from several on-campus media servers. An example of an iframe is https://mediaserver.example.edu/p/player.html. What is the easiest way to edit the policy files in the deployed…
samottenhoff
  • 720
  • 4
  • 14
2
votes
1 answer

Anti-samy code will avoid the onclick in anchor link

I am using anti-samy 1.5.2 version for converting my html to safe html. Now i am giving a following code to anti-samy scan method
Naresh Kallamadi
  • 163
  • 1
  • 14
1
vote
1 answer

JBoss AS 7: Error when use xml-apis.jar

I'm using anti-samy jar in my project. The class org.w3c.dom.Element is a dependency, and I found under xml-apis jar. But I'm getting this error when using the app: org.w3c.dom.Element from [Module "deployment.xxx.ear.antisamy-1.4.4.jar:main" from…
Otávio Garcia
  • 1,372
  • 1
  • 15
  • 27
1
vote
0 answers

Scripts/tags getting removed in text when using antisamy.jar/xml

I am using antisamy.xml and antisamy.jar for preventing XSS. So when i enter a script tag in the text box it truncates it and the other text apart from the tag is stored in the database. I want to store the script/tag in the database too, but…
user942309
  • 61
  • 1
  • 1
  • 6
1
vote
1 answer

YouTube URL - regex

I have following config in my antisamy policy file: Old YouTube Object:
MatBanik
  • 26,356
  • 39
  • 116
  • 178
1
vote
1 answer

Antisamy removing string after script tag

I have a scenario where i pass a string through AntiSamy tag. The string is . String dirtyContent = "