From 160da3896fb0e88609830e34e3e72e1040d9ca79 Mon Sep 17 00:00:00 2001 From: William Harrison <87287585+wdhdev@users.noreply.github.com> Date: Wed, 28 May 2025 12:26:09 +0800 Subject: [PATCH] gitlab verification under services --- dnsconfig.js | 10 +++++++ ...-verification-code.frost-voltage-wiki.json | 9 ------- ...ages-verification-code.meerkats.shays.json | 9 ------- ...lab-pages-verification-code.pinage404.json | 9 ------- ...itlab-pages-verification-code.pretzel.json | 9 ------- ...gitlab-pages-verification-code.sadkon.json | 9 ------- domains/frost-voltage-wiki.json | 5 +++- domains/meerkats.shays.json | 5 +++- domains/pinage404.json | 5 +++- domains/pretzel.json | 19 ++++++++------ domains/sadkon.json | 5 +++- tests/domains.test.js | 7 +++++ tests/records.test.js | 26 ++++++++++++------- 13 files changed, 60 insertions(+), 67 deletions(-) delete mode 100644 domains/_gitlab-pages-verification-code.frost-voltage-wiki.json delete mode 100644 domains/_gitlab-pages-verification-code.meerkats.shays.json delete mode 100644 domains/_gitlab-pages-verification-code.pinage404.json delete mode 100644 domains/_gitlab-pages-verification-code.pretzel.json delete mode 100644 domains/_gitlab-pages-verification-code.sadkon.json diff --git a/dnsconfig.js b/dnsconfig.js index c2ee90aa03..833d3d6a58 100644 --- a/dnsconfig.js +++ b/dnsconfig.js @@ -159,6 +159,16 @@ for (var subdomain in domains) { if (data.services.bluesky) { records.push(TXT("_atproto." + subdomainName, "\"" + data.services.bluesky + "\"")); } + + if (data.services.gitlab) { + if (Array.isArray(data.services.gitlab)) { + for (var txt in data.services.gitlab) { + records.push(TXT("_gitlab-pages-verification-code." + subdomainName, "\"" + data.services.gitlab[txt] + "\"")); + } + } else { + records.push(TXT("_gitlab-pages-verification-code." + subdomainName, "\"" + data.services.gitlab + "\"")); + } + } } } diff --git a/domains/_gitlab-pages-verification-code.frost-voltage-wiki.json b/domains/_gitlab-pages-verification-code.frost-voltage-wiki.json deleted file mode 100644 index 9fa66a5e5d..0000000000 --- a/domains/_gitlab-pages-verification-code.frost-voltage-wiki.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "owner": { - "username": "Karan-Frost", - "email": "frost.github@gmail.com" - }, - "records": { - "TXT": "gitlab-pages-verification-code=57f76737bb8badd568b055bc4ff9d405" - } -} diff --git a/domains/_gitlab-pages-verification-code.meerkats.shays.json b/domains/_gitlab-pages-verification-code.meerkats.shays.json deleted file mode 100644 index 6f4ce4dacd..0000000000 --- a/domains/_gitlab-pages-verification-code.meerkats.shays.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "owner": { - "username": "SHays24", - "email": "SHays24@student.sacs.nsw.edu.au" - }, - "records": { - "TXT": "gitlab-pages-verification-code=621b768139e0bfaf6eb43d60db03cabf" - } -} diff --git a/domains/_gitlab-pages-verification-code.pinage404.json b/domains/_gitlab-pages-verification-code.pinage404.json deleted file mode 100644 index 701ef97502..0000000000 --- a/domains/_gitlab-pages-verification-code.pinage404.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "owner": { - "username": "pinage404", - "email": "pinage404+is-a.dev@gmail.com" - }, - "records": { - "TXT": "gitlab-pages-verification-code=d43eb39124dec340bdbb11a4d6aa6b52" - } -} diff --git a/domains/_gitlab-pages-verification-code.pretzel.json b/domains/_gitlab-pages-verification-code.pretzel.json deleted file mode 100644 index 81dc1f268e..0000000000 --- a/domains/_gitlab-pages-verification-code.pretzel.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "owner": { - "username": "tobaiscrowley", - "discord": "gus_polinksi" - }, - "records": { - "TXT": "gitlab-pages-verification-code=d1d70cb094c2f16f83caed76145fc105" - } -} diff --git a/domains/_gitlab-pages-verification-code.sadkon.json b/domains/_gitlab-pages-verification-code.sadkon.json deleted file mode 100644 index 28e2168831..0000000000 --- a/domains/_gitlab-pages-verification-code.sadkon.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "owner": { - "username": "MohammedKHC0", - "email": "mohammedkhc@outlook.com" - }, - "records": { - "TXT": "gitlab-pages-verification-code=478e4a7c8445704809ba0fa31e003df3" - } -} diff --git a/domains/frost-voltage-wiki.json b/domains/frost-voltage-wiki.json index 7a0bc798e3..08ca191e73 100644 --- a/domains/frost-voltage-wiki.json +++ b/domains/frost-voltage-wiki.json @@ -5,5 +5,8 @@ }, "records": { "CNAME": "wiki-frost-me-f3415d.gitlab.io" + }, + "services": { + "gitlab": "gitlab-pages-verification-code=57f76737bb8badd568b055bc4ff9d405" } -} +} \ No newline at end of file diff --git a/domains/meerkats.shays.json b/domains/meerkats.shays.json index f32a63f308..4eb9285a25 100644 --- a/domains/meerkats.shays.json +++ b/domains/meerkats.shays.json @@ -5,5 +5,8 @@ }, "records": { "CNAME": "the-meerkats-projects-shays24-90484013ec4c0067187cd3a154c706ad6.gitlab.io" + }, + "services": { + "gitlab": "gitlab-pages-verification-code=621b768139e0bfaf6eb43d60db03cabf" } -} +} \ No newline at end of file diff --git a/domains/pinage404.json b/domains/pinage404.json index c9efe6a3f8..decd81378b 100644 --- a/domains/pinage404.json +++ b/domains/pinage404.json @@ -5,5 +5,8 @@ }, "records": { "CNAME": "pinage404.gitlab.io" + }, + "services": { + "gitlab": "gitlab-pages-verification-code=d43eb39124dec340bdbb11a4d6aa6b52" } -} +} \ No newline at end of file diff --git a/domains/pretzel.json b/domains/pretzel.json index 562d5f911c..a276a0f881 100644 --- a/domains/pretzel.json +++ b/domains/pretzel.json @@ -1,9 +1,12 @@ { - "owner": { - "username": "tobaiscrowley", - "discord": "gus_polinksi" - }, - "records": { - "CNAME": "microblog-aa389f.gitlab.io" - } -} + "owner": { + "username": "tobaiscrowley", + "discord": "gus_polinksi" + }, + "records": { + "CNAME": "microblog-aa389f.gitlab.io" + }, + "services": { + "gitlab": "gitlab-pages-verification-code=d1d70cb094c2f16f83caed76145fc105" + } +} \ No newline at end of file diff --git a/domains/sadkon.json b/domains/sadkon.json index 5915410994..8842fd2697 100644 --- a/domains/sadkon.json +++ b/domains/sadkon.json @@ -5,5 +5,8 @@ }, "records": { "CNAME": "sadkon.gitlab.io" + }, + "services": { + "gitlab": "gitlab-pages-verification-code=478e4a7c8445704809ba0fa31e003df3" } -} +} \ No newline at end of file diff --git a/tests/domains.test.js b/tests/domains.test.js index 28fa2b5b6b..607f5bd0ef 100644 --- a/tests/domains.test.js +++ b/tests/domains.test.js @@ -128,6 +128,13 @@ t("Disallow nested subdomains when parent has specific service records", (t) => `${file}: Nested subdomain "_atproto.${subdomain}" should not exist when services.bluesky is present` ); } + + if (data?.services?.gitlab) { + t.false( + files.includes(`_gitlab-pages-verification-code.${file}`), + `${file}: Nested subdomain "_gitlab-pages-verification-code.${subdomain}" should not exist when services.gitlab is present` + ); + } }); t.pass(); diff --git a/tests/records.test.js b/tests/records.test.js index 7bc851397d..773de6bb61 100644 --- a/tests/records.test.js +++ b/tests/records.test.js @@ -334,27 +334,23 @@ t("All files should have valid service records", (t) => { files.forEach((file) => { const data = getDomainData(file); + const discordRegex = /^dh=[a-f0-9]{40}$/; + if (data?.services?.discord) { const discord = Array.isArray(data.services.discord) ? data.services.discord : [data.services.discord]; discord.forEach((value) => { - const token = value.split("=")[1]; - - t.true(value.startsWith("dh="), `${file}: Invalid Discord service record format`); - t.true(token.length === 40, `${file}: Discord service token should be 40 characters long`); - t.true( - isValidHexadecimal(token), - `${file}: Discord service token should be a valid hexadecimal string` - ); + t.true(discordRegex.test(value), `${file}: Invalid Discord service record format`); }); } + const vercelRegex = /^vc-domain-verify=([a-z0-9.-]+),([a-f0-9]{20})$/; + if (data?.services?.vercel) { const vercel = Array.isArray(data.services.vercel) ? data.services.vercel : [data.services.vercel]; vercel.forEach((value) => { - t.true(value.startsWith("vc-domain-verify="), `${file}: Invalid Vercel service record format`); - t.true(value.length >= 48, `${file}: Vercel service token should be 48 characters or longer`); + t.true(vercelRegex.test(value), `${file}: Invalid Vercel service record format`); }); } @@ -363,6 +359,16 @@ t("All files should have valid service records", (t) => { if (data?.services?.bluesky) { t.true(atprotoRegex.test(data.services.bluesky), `${file}: Invalid Bluesky service record format`); } + + const gitlabRegex = /^gitlab-pages-verification-code=[a-f0-9]{32}$/; + + if (data?.services?.gitlab) { + const gitlab = Array.isArray(data.services.gitlab) ? data.services.gitlab : [data.services.gitlab]; + + gitlab.forEach((value) => { + t.true(gitlabRegex.test(value), `${file}: Invalid GitLab service record format`); + }); + } }); t.pass();