You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ternary and binary operations are evaluated in both sides separately and will throw errors if any of the sides is not safe, even their condition never gets hit at runtime.
I'm finding the XSS plugin exceedingly aggressive, finding errors where there shouldn't be. I'm hoping you can suggest some workarounds. Consider the following code:
Each of these gets flagged as xss-prone content as in the screenshot (whether I use short-circuiting above or switch to ? : syntax makes no difference.) This doesn't feel like the intention behind the plugin at all.
I don't want to pass the safe attribute to the enclosing <div>, because <Badge /> is a custom component comprising more JSX.
a) Is there a way to mark a component as "safe", like a string primitive?
b) Wouldn't it be more sensible to skip XSS warnings for custom JSX components? Maybe I'm missing something but I only care about that warning on standard HTML tags like <div>, <span>, <p>, etc...
Thanks very much.
Steps to Reproduce
use above code snippet
Expected Behavior
No response
The text was updated successfully, but these errors were encountered:
coindegen
changed the title
[question]
[question] How do I ignore XSS errors on custom JSX components?
Mar 13, 2024
Prerequisites
Versions
"@kitajs/ts-html-plugin": "^1.3.4",
Description
Hi there,
first off, love the project. Has been absolutely flawless so far.
I read the following in your docs (https://kitajs.github.io/ts-html-plugin/#special-cases) :
I'm finding the XSS plugin exceedingly aggressive, finding errors where there shouldn't be. I'm hoping you can suggest some workarounds. Consider the following code:
Each of these gets flagged as xss-prone content as in the screenshot (whether I use short-circuiting above or switch to
? :
syntax makes no difference.) This doesn't feel like the intention behind the plugin at all.I tried escaping the content like this:
But it's still flagged as xss prone.
I don't want to pass the
safe
attribute to the enclosing<div>
, because<Badge />
is a custom component comprising more JSX.a) Is there a way to mark a component
as "safe"
, like a string primitive?b) Wouldn't it be more sensible to skip XSS warnings for custom JSX components? Maybe I'm missing something but I only care about that warning on standard HTML tags like
<div>
,<span>
,<p>
, etc...Thanks very much.
Steps to Reproduce
use above code snippet
Expected Behavior
No response
The text was updated successfully, but these errors were encountered: