Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jslint flagging "dangerous comment"

Given this JavaScript code (which is just a comment referring to a url):

// see http://enterprisejquery.com/2010/10/how-good-c-habits-can-encourage-bad-javascript-habits-part-1/

JSLint with "Safe Subset" turned on will say

Dangerous comment.
// http://enterprisejquery.com/2010/10/how-good-c-habits-can-encourage-bad-javascript-habits-part-1/

How can a comment be dangerous? Comments, by definition, aren't parsed! Or are they?

Edit: Using a different url isn't necessarily dangerous. For example this:

// http://enterprisejquery.com

doesn't trigger the flag. How can one URL in a comment be 'dangerous', but another isn't?

like image 453
paleozogt Avatar asked Jun 14 '12 17:06

paleozogt


1 Answers

"Dangerous" comments match the regular expression:

/@cc|<\/?|script|\]\s*\]|<\s*!|&lt/i

In this case, your comment is "dangerous" because it contains the string "script".

I think this is probably a false positive.

like image 154
Samuel Edwin Ward Avatar answered Oct 15 '22 00:10

Samuel Edwin Ward