-
Notifications
You must be signed in to change notification settings - Fork 46
Validate URL to prevent XSS #727
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -26,7 +26,12 @@ const StyledHeader = styled(Box)` | |||||||||||||||||
| `} | ||||||||||||||||||
| `; | ||||||||||||||||||
|
|
||||||||||||||||||
| const Header = ({ link, logo, children, ...props }) => { | ||||||||||||||||||
| const Header = ({ link, logo, children, allowJavaScriptUrls = True, ...props }) => { | ||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Codacy has a fix for the issue: Replace
Suggested change
|
||||||||||||||||||
| const isJavaScriptProtocol = /^[\u0000-\u001F ]*j[\r\n\t]*a[\r\n\t]*v[\r\n\t]*a[\r\n\t]*s[\r\n\t]*c[\r\n\t]*r[\r\n\t]*i[\r\n\t]*p[\r\n\t]*t[\r\n\t]*\:/i | ||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Codacy has a fix for the issue: Unnecessary escape character: :.
Suggested change
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Codacy has a fix for the issue: Unnecessary escape character: :.
Suggested change
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Codacy has a fix for the issue: Replace
Suggested change
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Codacy has a fix for the issue: Replace
Suggested change
|
||||||||||||||||||
| if (isJavaScriptProtocol.test(link) && !allowJavaScriptUrls) { | ||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Codacy has a fix for the issue: Replace
Suggested change
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Codacy has a fix for the issue: Replace
Suggested change
|
||||||||||||||||||
| console.warn(`Header has blocked a javascript: URL as a security precaution`); | ||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Codacy has a fix for the issue: Replace
Suggested change
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Codacy has a fix for the issue: Unexpected console statement.
Suggested change
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Codacy has a fix for the issue: Replace
Suggested change
|
||||||||||||||||||
| return null; | ||||||||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Codacy has a fix for the issue: Replace
Suggested change
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Codacy has a fix for the issue: Replace
Suggested change
|
||||||||||||||||||
| } | ||||||||||||||||||
| return ( | ||||||||||||||||||
| <StyledHeader | ||||||||||||||||||
| as="header" | ||||||||||||||||||
|
|
||||||||||||||||||
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.
Codacy has a fix for the issue: Replace
·link,·logo,·children,·allowJavaScriptUrls·=·True,·...props·with⏎··link,⏎··logo,⏎··children,⏎··allowJavaScriptUrls·=·True,⏎··...props⏎