-
Notifications
You must be signed in to change notification settings - Fork 22
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
fix(frontend): security XSS / image tag #4030
Merged
Merged
Changes from 11 commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
1ded610
fix: html and security
maxgfr 146e208
fix: add jsdom
maxgfr c898b28
fix: jsdom
maxgfr 3d61b9c
fix: dynamic import
maxgfr 08931b5
fix: jsdom
maxgfr 1287dc9
fix: html and security
maxgfr 595d73c
fix: lib
maxgfr 3b962bf
fix: snapshot
maxgfr 5905abb
fix: image
maxgfr cdd43d4
fix: pb
maxgfr 1490fc4
fix: image
maxgfr a7cc140
Merge branch 'master' into maxgfr/image-affichage
maxgfr 72b247e
fix: codedutravail
maxgfr e7af0eb
fix: codedutravail
maxgfr 2906e98
fix: test
maxgfr 2dcd5b1
fix: test
maxgfr 8e0b13e
fix: image
maxgfr 048629c
Merge branch 'master' into maxgfr/image-affichage
maxgfr 5624b67
fix: rel
maxgfr ee4f64c
fix
maxgfr 0a992d6
Merge branch 'master' into maxgfr/image-affichage
maxgfr 0bdc026
fix: value
maxgfr 932b31a
remove unsued code
maxgfr d7d39e9
Merge branch 'master' into maxgfr/image-affichage
m-maillot 35b53d9
fix: add webcomponent-tooltip-cc to whitelist tag
m-maillot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import React from "react"; | ||
import styled from "styled-components"; | ||
import xss from "xss"; | ||
|
||
import { htmlParser } from "../lib"; | ||
|
||
type Props = { | ||
children: string; | ||
inline?: boolean; | ||
}; | ||
|
||
const Html = ({ children, inline = false, ...props }: Props): JSX.Element => { | ||
return ( | ||
<Div | ||
{...props} | ||
isInline={inline} | ||
dangerouslySetInnerHTML={{ | ||
__html: xss(htmlParser(children)), | ||
}} | ||
/> | ||
); | ||
}; | ||
|
||
export default Html; | ||
|
||
const Div = styled.div` | ||
${({ isInline }: { isInline: boolean }) => | ||
isInline && "display: inline-block;"}; | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,9 @@ | |
|
||
exports[`<Html /> should render 1`] = ` | ||
<div> | ||
<div> | ||
<div | ||
class="" | ||
> | ||
<b> | ||
Hello | ||
</b> | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
c'est bizarre que ça rajoute une class vide
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oui, c'est vrai, bonne question
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
En vrai, c'est dû au parsing fait par le xss, qui essaye de retirer le plus de choses externes. Mais en soit, relou si ça génère des
<div class="" ..
dans la prodThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dans la prod, il me semble que ça ne génère pas cela, donc pour moi c'est ok j'ai l'impression
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
c'est juste qu'avant on l'ajoutait pas et maintenant oui