mirror of
https://github.com/lucide-icons/lucide.git
synced 2026-12-03 16:59:42 +00:00
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>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
112d063fbd
commit
9ea275fb1f
@@ -57,7 +57,7 @@ export async function createIconOGImage(iconName: string, tags: string[]) {
|
||||
|
||||
const data = {
|
||||
name: iconName,
|
||||
tags: tags.join(' • ').replace(/</g, '<').replace(/>/g, '>').replace(/&/g, '&'),
|
||||
tags: tags.join(' • ').replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>'),
|
||||
iconSVG,
|
||||
};
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ const getContributors = async (file: string, includeCoAuthors?: boolean) => {
|
||||
}
|
||||
if (includeCoAuthors) {
|
||||
const matches = commit.body.matchAll(
|
||||
/(^Author:|^Co-authored-by:)\s+(?<author>[^<]+)\s+<(?<email>[^>]+)>/gm,
|
||||
/(^Author:|^Co-authored-by:)\s(?<author>[^<]+)\s<(?<email>[^>]+)>/gm,
|
||||
);
|
||||
|
||||
for (const match of matches) {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
const base64SVG = (svgContents: string) =>
|
||||
Buffer.from(
|
||||
svgContents
|
||||
.replace('\n', '')
|
||||
.replaceAll('\n', '')
|
||||
.replace(
|
||||
'stroke="currentColor"',
|
||||
'stroke="#000" style="background-color: #fff; border-radius: 2px"',
|
||||
|
||||
Reference in New Issue
Block a user