Skip to content

Conversation

@timfish
Copy link
Collaborator

@timfish timfish commented Aug 5, 2023

The Electron SDK uses basename to get the file name without path but this returned the full path on Windows.

This PR adds Windows support to the regex and adds some tests.

// Truncate files names greater than 1024 characters to avoid regex dos
// https://github.com/getsentry/sentry-javascript/pull/8737#discussion_r1285719172
const truncated = filename.length > 1024 ? `<truncated>${filename.slice(-1024)}` : filename;
const parts = splitPathRe.exec(truncated);

Check failure

Code scanning / CodeQL

Polynomial regular expression used on uncontrolled data

This [regular expression](1) that depends on [library input](2) may run slow on strings with many repetitions of '.'. This [regular expression](1) that depends on [library input](3) may run slow on strings with many repetitions of '.'. This [regular expression](1) that depends on [library input](4) may run slow on strings with many repetitions of '.'. This [regular expression](1) that depends on [library input](5) may run slow on strings with many repetitions of '.'.
@AbhiPrasad AbhiPrasad merged commit a4ae291 into getsentry:develop Aug 8, 2023
@timfish timfish deleted the fix/dirname-basename-windows branch September 28, 2023 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants