Skip to content

Commit

Permalink
💄
Browse files Browse the repository at this point in the history
  • Loading branch information
benibenj committed May 2, 2024
1 parent dd558a9 commit c1ced1d
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -422,12 +422,10 @@ function sanitizeCommitMessage(message?: string): string | undefined {
return undefined;
}

// Remove any unsafe characters found by the unsafeRegex
// Check for characters that might escape quotes or introduce shell commands.
// Don't allow: ', ", `, $, \ (except for \n which is allowed)
const unsafeRegex = /(?<!\\)\\(?!n)|['"`$]/g;

// Remove any unsafe characters found by the unsafeRegex
const sanitizedMessage = message.replace(unsafeRegex, '');
const sanitizedMessage = message.replace(/(?<!\\)\\(?!n)|['"`$]/g, '');

if (sanitizedMessage.length === 0) {
return undefined;
Expand Down

0 comments on commit c1ced1d

Please sign in to comment.