I’m going to allow users to set an image with a link on my site. e.g. a profile picture and a profile link.
I will not let them upload said image, but let them give an url that i will insert into a img src.
I want to do basic checks for the best know xss patterns someone may use my site for, but thing is, i have no list of samples to check my functions works. As it is, even if I write a full RFC compliant parser to check every aspect of the URL, i will still not know what i should guard against.
I would do the following
The first one is to make sure no javascript:, vbscript: etc. URLS are allowed. The second one is to escape any character that can cause damage (like “, ‘, <, > etc.).
Still a good resource for pattern, though a bit dated: http://ha.ckers.org/xss.html
Another great resource: http://html5sec.org