fix(core): App should not crash with a custom rest endpoint (#5911)

fixes #5880
This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2023-04-06 11:35:05 +02:00
committed by GitHub
parent 6689451e8c
commit 2881ee9ecc
6 changed files with 18 additions and 13 deletions

View File

@@ -10,7 +10,7 @@
/* eslint-disable @typescript-eslint/no-unused-vars */
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
import assert from 'assert';
import { exec as callbackExec } from 'child_process';
import { access as fsAccess } from 'fs/promises';
import os from 'os';
@@ -452,6 +452,11 @@ class Server extends AbstractServer {
...excludeEndpoints.split(':'),
].filter((u) => !!u);
assert(
!ignoredEndpoints.includes(this.restEndpoint),
`REST endpoint cannot be set to any of these values: ${ignoredEndpoints.join()} `,
);
// eslint-disable-next-line no-useless-escape
const authIgnoreRegex = new RegExp(`^\/(${ignoredEndpoints.join('|')})\/?.*$`);