mozilla / eslint-plugin-no-unsanitized

Custom ESLint rule to disallows unsafe innerHTML, outerHTML, insertAdjacentHTML and alike
Mozilla Public License 2.0
223 stars 34 forks source link

native code check #32

Closed mozfreddyb closed 7 years ago

mozfreddyb commented 7 years ago

@jonathankingston said

Handle native methods when making configurable just as a reminder. The toString of the config object itself then gets checked as appears it's part of the array/objects etc.

Can you explain more @jonathankingston? I'm not sure I understand.

jonathanKingston commented 7 years ago

This is for when we add configuration for custom checks. Objects in JS have native methods which end up being counted for linting. So I ignore any config that doesn't look like the right object shape. This certainly needs a test as could be a failure point depending on implementation.

On Mon, 20 Mar 2017, 14:20 Frederik, notifications@github.com wrote:

@jonathankingston https://github.com/jonathankingston said

Handle native methods when making configurable https://github.com/jonathanKingston/eslint-plugin-no-unescaped/blob/426e601ebe2fdceb4e5a4970f9cc2aefbfa158da/lib/rules/enforce.js#L191 just as a reminder. The toString of the config object itself then gets checked as appears it's part of the array/objects etc.

Can you explain more @jonathankingston https://github.com/jonathankingston? I'm not sure I understand.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mozfreddyb/eslint-plugin-no-unsafe-innerhtml/issues/32, or mute the thread https://github.com/notifications/unsubscribe-auth/AAUsLH52GergpYOw6M2HPleHLaiZA_y9ks5rnotEgaJpZM4Miflf .

jonathanKingston commented 7 years ago

Used hadOwnProperty in latest PR to prevent these issues, I added a test to make sure. https://github.com/mozilla/eslint-plugin-no-unsanitized/pull/51/files#diff-e843fd7c9a343089a8800912923bc0bbR61

jonathanKingston commented 7 years ago

@mozfreddyb please close this. and/or give me the powers ;)

mozfreddyb commented 7 years ago

I can't give you the powers, this isnt my repo since I moved it to @mozilla :/