server: check for valid keyId URL before parse

This commit is contained in:
Johann150 2023-04-16 19:33:28 +02:00
parent f7bd210316
commit 75fd42b070
Signed by: Johann150
GPG Key ID: 9EE6577A2A06F8F1
1 changed files with 6 additions and 6 deletions

View File

@ -29,18 +29,18 @@ export default async (job: Bull.Job<InboxJobData>): Promise<string> => {
logger.debug(JSON.stringify(info, null, 2));
//#endregion
const host = toPuny(new URL(signature.keyId).hostname);
const keyIdLower = signature.keyId.toLowerCase();
if (keyIdLower.startsWith('acct:')) {
return `Old keyId is no longer supported. ${keyIdLower}`;
}
const host = toPuny(new URL(keyIdLower).hostname);
// Stop if the host is blocked.
if (await shouldBlockInstance(host)) {
return `Blocked request: ${host}`;
}
const keyIdLower = signature.keyId.toLowerCase();
if (keyIdLower.startsWith('acct:')) {
return `Old keyId is no longer supported. ${keyIdLower}`;
}
const resolver = new Resolver();
let authUser;