Skip to content

Commit cc78f8c

Browse files
committed
Tell ESLint that a couple of complex regexes are okay
These regular expressions only parse data that is produced by GitGitGadget itself, not by any would-be attacker. Or at least they come in via the mailing list archive, where emails with insanely long headers would be dropped before they could enter. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
1 parent 64cee2c commit cc78f8c

File tree

5 files changed

+5
-0
lines changed

5 files changed

+5
-0
lines changed

lib/git-notes.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,7 @@ export class GitNotes {
219219
continue;
220220
}
221221

222+
// eslint-disable-next-line security/detect-unsafe-regex
222223
const removeAdd = split[i + 6].match(/^(?:-(.*)\n)?\+(.*)$/);
223224
if (!removeAdd) throw new Error(`Not a single modified line?\n${split[i + 6]}`);
224225

lib/mail-archive-helper.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ export class MailArchiveGitHelper {
240240
let counter = 0;
241241
const lineHandler = async (line: string): Promise<void> => {
242242
if (line.startsWith("@@ ")) {
243+
// eslint-disable-next-line security/detect-unsafe-regex
243244
const match = line.match(/^@@ -(\d+,)?\d+ \+(\d+,)?(\d+)?/);
244245
if (match) {
245246
if (counter) {

lib/patch-series.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable security/detect-unsafe-regex */
12
import addressparser from "nodemailer/lib/addressparser/index.js";
23
import mimeFuncs from "nodemailer/lib/mime-funcs/index.js";
34
import { commitExists, git, gitConfig, gitShortHash, revListCount, revParse } from "./git.js";

lib/send-mail.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,7 @@ export function parseMBoxMessageIDAndReferences(parsed: IParsedMBox): { messageI
125125
* using regular expressions due to its recursive nature) but seems to be
126126
* good enough for the Git mailing list.
127127
*/
128+
// eslint-disable-next-line security/detect-unsafe-regex
128129
const msgIdRegex = /^\s*<([^>]+)>(\s*|,)(\([^")]*("[^"]*")?\)\s*|\([^)]*\)$)?(<.*)?$/;
129130
for (const header of parsed.headers ?? []) {
130131
if (header.key.match(/In-Reply-To|References/i)) {

lib/sous-chef.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export class SousChef {
1818

1919
const branches = sections[i + 1].split(/\n\* ([a-z][^]+?)\n\n/m);
2020
for (let j = 1; j < branches.length; j += 2) {
21+
// eslint-disable-next-line security/detect-unsafe-regex
2122
const match = branches[j].match(/([^ ]+).*\n *(\(merged to [^)]+\))?/m);
2223
if (!match) {
2324
continue;

0 commit comments

Comments
 (0)