From 583df3ec63e25a1fd34def0dac13405396b8b663 Mon Sep 17 00:00:00 2001 From: Julia Date: Tue, 29 Apr 2025 05:06:39 -0400 Subject: [PATCH] Merge commit from fork none of our endpoints will ever contain `..` (they might, maybe, at some point, contain `.`, as in `something/get.html`?), so every `Mk:api()` call to an endpoint that contains `..` can't work: let's reject it outright Co-authored-by: dakkar --- packages/frontend/src/aiscript/api.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/frontend/src/aiscript/api.ts b/packages/frontend/src/aiscript/api.ts index e7e396023d..08ba89dd9d 100644 --- a/packages/frontend/src/aiscript/api.ts +++ b/packages/frontend/src/aiscript/api.ts @@ -68,7 +68,7 @@ export function createAiScriptEnv(opts: { storageKey: string, token?: string }) }), 'Mk:api': values.FN_NATIVE(async ([ep, param, token]) => { utils.assertString(ep); - if (ep.value.includes('://')) { + if (ep.value.includes('://') || ep.value.includes('..')) { throw new errors.AiScriptRuntimeError('invalid endpoint'); } if (token) {