-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat espace pro #974
base: dev
Are you sure you want to change the base?
Feat espace pro #974
Conversation
replyTo: process.env.REPLYTO_EMAIL, | ||
subject: emailDefinition.subject, | ||
html: html, | ||
text: html.replace(/<(?:.|\n)*?>/gm, ''), |
Check failure
Code scanning / CodeQL
Incomplete multi-character sanitization High
<script
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix AI about 1 hour ago
To fix the problem, we should replace the custom regular expression used for sanitization with a well-tested library that can handle HTML sanitization comprehensively. The sanitize-html
library is a popular choice for this purpose. It will ensure that all potentially unsafe HTML tags and attributes are removed, mitigating the risk of HTML injection vulnerabilities.
- Install the
sanitize-html
library. - Import the
sanitize-html
library in the file. - Replace the custom regular expression with a call to the
sanitize-html
function to sanitize thehtml
string.
-
Copy modified line R3 -
Copy modified line R48
@@ -2,2 +2,3 @@ | ||
import { type ComponentProps } from 'react'; | ||
import sanitizeHtml from 'sanitize-html'; | ||
|
||
@@ -46,3 +47,3 @@ | ||
html: html, | ||
text: html.replace(/<(?:.|\n)*?>/gm, ''), | ||
text: sanitizeHtml(html, { allowedTags: [], allowedAttributes: {} }), | ||
}); |
-
Copy modified lines R140-R141
@@ -139,3 +139,4 @@ | ||
"yup": "^1.2.0", | ||
"zod": "^3.24.1" | ||
"zod": "^3.24.1", | ||
"sanitize-html": "^2.14.0" | ||
}, |
Package | Version | Security advisories |
sanitize-html (npm) | 2.14.0 | None |
Pas encore ouf mais sera plus simple à styler que mui
Ajout des lib react-email @tanstack/form
3cef709
to
b8f7f44
Compare
WIP