diff options
author | Elizabeth Alexander Hunt <me@liz.coffee> | 2025-05-10 22:28:04 -0700 |
---|---|---|
committer | Elizabeth Alexander Hunt <me@liz.coffee> | 2025-05-10 22:44:45 -0700 |
commit | 00ae56948227238d9180c7a46420b2929fdbf3e1 (patch) | |
tree | 9fed29caa1e635da125d262359b8ffdd5e7dd0bf | |
parent | 435c30da3f926cff5934e434824488e6c7a67ce6 (diff) | |
download | ci-00ae56948227238d9180c7a46420b2929fdbf3e1.tar.gz ci-00ae56948227238d9180c7a46420b2929fdbf3e1.zip |
fix forward slashes in identifier
-rw-r--r-- | README.md | 1 | ||||
-rwxr-xr-x | hooks/mod.ts | 5 | ||||
-rw-r--r-- | utils/validate_identifier.ts | 2 |
3 files changed, 5 insertions, 3 deletions
diff --git a/README.md b/README.md new file mode 100644 index 0000000..802ac1f --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +## TODO diff --git a/hooks/mod.ts b/hooks/mod.ts index cc29e43..bef822e 100755 --- a/hooks/mod.ts +++ b/hooks/mod.ts @@ -45,7 +45,8 @@ Deno.serve(addr, async (req) => { if (pathname === "/checkout_ci") { const { remote, rev, refname } = await req.json(); if (![remote, rev, refname].every(validateIdentifier)) { - return new Response("invalid request", { + logger.log("invalid reqwest\n"); + return new Response("invalid reqwest >:D\n", { status: 400, }); } @@ -64,7 +65,7 @@ Deno.serve(addr, async (req) => { }); } - return new Response("idk what that is bro\n", { status: 404 }); + return new Response("idk what that is bro :((\n", { status: 404 }); } catch (e) { logger.error("Uncaught exception", e); return new Response("womp womp D:\n", { status: 500 }); diff --git a/utils/validate_identifier.ts b/utils/validate_identifier.ts index c8a5213..0c9242c 100644 --- a/utils/validate_identifier.ts +++ b/utils/validate_identifier.ts @@ -1,3 +1,3 @@ export const validateIdentifier = (token: string) => { - return (/^[a-zA-Z0-9_\-:. ]+$/).test(token) && !token.includes(".."); + return (/^[a-zA-Z0-9_\-:. \/]+$/).test(token) && !token.includes(".."); }; |