Loading…
Loading…
New CommentView component. A colleague gave up on react-markdown ("too heavy") and wrote their own mini markdown renderer via replace. Uses dangerouslySetInnerHTML. Your job as the security reviewer is to find XSS vectors in the diff.
React **automatically escapes** anything that lands in JSX as text or an attribute. `<div>{userInput}</div>` is safe: if `userInput = '<script>'`, it's printed as text, not executed. But there are three dangerous spots: 1. **`dangerouslySetInnerHTML`** — literally turns protection off. 2. **`href={userInput}`** — React didn't filter `javascript:` URLs before version 16. 3. **CSS-in-JS** — `style={{ background: userInput }}` can be abused via `url('javascript:...')`. Walk the code and find every such spot.