Files
Eric FennisandClaude Opus 5.5 9ea275fb1f fix(site): resolve CodeQL ReDoS and incomplete escaping alerts (#5369)
* fix(scripts): remove ambiguous regex in co-author parsing (ReDoS)

The co-author trailer regex used \s+([^<]+)\s+< where both \s+ overlap
with [^<]+, giving polynomial backtracking on long whitespace runs.
\s([^<]+)\s< matches exactly the same strings and the same email group.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G9u8FhTjfkTLPkCeVkHN6p

* fix: escape all occurrences when sanitizing strings

- base64SVG: replace every newline, not just the first one
- createOGImage: escape & before < and > so tags aren't double-escaped

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01G9u8FhTjfkTLPkCeVkHN6p

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-12-02 16:57:51 +01:00

12 lines
287 B
TypeScript

const base64SVG = (svgContents: string) =>
Buffer.from(
svgContents
.replaceAll('\n', '')
.replace(
'stroke="currentColor"',
'stroke="#000" style="background-color: #fff; border-radius: 2px"',
),
).toString('base64');
export default base64SVG;