-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Labels
good first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is needed
Description
Такая защита от дурака наверно недостаточна, так как тут например может быть массив или ещё какое значение приводимое к опасной строке.
Вот пример TS-компонента, при котором использование компонента в PHP может привести к небезопасной вставке строки:
@@ -4,10 +4,15 @@
const injection = `<img src=x onerror=alert()>`;
// @elephizeTarget
-export const EscapeHtmlChars = ({ children }: { children: React.ReactNode[] }) => {
+export const EscapeHtmlChars = ({
+ children,
+ // Dangerous string from input or server, received from props
+ mixedValue = [injection]
+}: { children: React.ReactNode[], mixedValue?: string[] }) => {
const arr = [1, 2, 3, 4];
return (
<div className="App">
+ <div>{mixedValue}</div>
<h1>Hello CodeSandbox</h1>
<h2>Start editing to see some magic happen!</h2>
{arr.map((v) => <span>{injection}{v}</span>)}Конкретных решений не предложу.
Может тогда вынести этот вопрос отдельным issue?
Originally posted by @fix-fix in #112 (comment)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
good first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is needed