Repository navigation
fix(security): security batch to staging #257
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
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 |
|---|---|---|
| @@ -1,7 +1,3 @@ | ||
| import cn from 'classnames'; | ||
| import { useCallback, useMemo, useState } from 'react'; | ||
| import ReactDomServer from 'react-dom/server'; | ||
|
|
||
| import Accordion from '@uxcore/components/Accordion'; | ||
| import { | ||
| Div, | ||
|
|
@@ -12,6 +8,9 @@ import { | |
| Span, | ||
|
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. The import reorder in this file, in |
||
| } from '@uxcore/components/ContentGenerator/elements'; | ||
| import ContentParser from '@uxcore/components/ContentParser'; | ||
| import cn from 'classnames'; | ||
| import { useCallback, useMemo, useState } from 'react'; | ||
| import ReactDomServer from 'react-dom/server'; | ||
|
|
||
| import useGlobals from './useGlobals'; | ||
|
|
||
|
|
@@ -93,6 +92,8 @@ const useContentType = (styles: any, usePTag: boolean) => { | |
| li: (props: any) => <li className={styles.li}>{props.children}</li>, | ||
| ul: (props: any) => <ul className={styles.ul}>{props.children}</ul>, | ||
| img: (props: any) => { | ||
| // The sanitiser drops a source it does not trust; nothing to draw then. | ||
| if (typeof props.src !== 'string' || !props.src) return null; | ||
| return ( | ||
| <Image | ||
| styles={styles} | ||
|
|
||
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.
XSS gap:
download/trellourlis not validated.protocolsin rehype-sanitize only applies tohref,src,citeandlongDesc. Aurlkey does nothing here, sourlon<download>and<trello>passes through unchecked.useContentType.tsxrenders it as<a href={url}>(lines 117 and 133), so<trello url="javascript:alert(1)">x</trello>in persona text becomes a clickablejavascript:link. Inside accordions the string is rebuilt and sanitised again, with the same result.Add a pattern for the two tags, like the one used for
file:You can then drop the
urlentry fromprotocols, which is a no-op.