views:

16

answers:

1

I would like users of my Rails application to be able to submit their Facebook Badge as input in a form, but I absolutely want to to verify that what they provide is a valid Badge, not something that may compromise the security of my system (Javascript ...).

Is there a good way to validate a form field that contains a Facebook Badge?

+1  A: 

I'm not sure if you could safely develop something that would validate badges. By "safely" I mean something that wouldn't generate false negatives (or false positives) if/when Facebook happens to change their implementation of badges (as they are wont to do with many parts of their platform).

What you can do is use something like HTML Purifier to ensure that the input doesn't contain malicious tags.

Peter Bailey
-1 Tidy doesn't prevent XSS... http://htmlpurifier.org/comparison
Basiclife
Woah, no need to be a vote nazi about it - a simple comment is all it takes. Updated my link.
Peter Bailey
:D Removed my -1 - And you get a +1 for the sense of humour :)
Basiclife
Thanks Peter for both your suggestions. I will go for using their API
Christer Fernstrom