gitlab verification under services

This commit is contained in:
William Harrison committed 2025-05-28 12:26:09 +08:00
1 parent 74a1356d34
commit 160da3896f
13 files changed
+60 -67

No files matched your search

+10
View File
@@ -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 + "\""));
}
}
}
}
@@ -1,9 +0,0 @@
{
"owner": {
"username": "Karan-Frost",
"email": "frost.github@gmail.com"
},
"records": {
"TXT": "gitlab-pages-verification-code=57f76737bb8badd568b055bc4ff9d405"
}
}
@@ -1,9 +0,0 @@
{
"owner": {
"username": "SHays24",
"email": "SHays24@student.sacs.nsw.edu.au"
},
"records": {
"TXT": "gitlab-pages-verification-code=621b768139e0bfaf6eb43d60db03cabf"
}
}
@@ -1,9 +0,0 @@
{
"owner": {
"username": "pinage404",
"email": "pinage404+is-a.dev@gmail.com"
},
"records": {
"TXT": "gitlab-pages-verification-code=d43eb39124dec340bdbb11a4d6aa6b52"
}
}
@@ -1,9 +0,0 @@
{
"owner": {
"username": "tobaiscrowley",
"discord": "gus_polinksi"
},
"records": {
"TXT": "gitlab-pages-verification-code=d1d70cb094c2f16f83caed76145fc105"
}
}
@@ -1,9 +0,0 @@
{
"owner": {
"username": "MohammedKHC0",
"email": "mohammedkhc@outlook.com"
},
"records": {
"TXT": "gitlab-pages-verification-code=478e4a7c8445704809ba0fa31e003df3"
}
}
+4 -1
View File
@@ -5,5 +5,8 @@
},
"records": {
"CNAME": "wiki-frost-me-f3415d.gitlab.io"
},
"services": {
"gitlab": "gitlab-pages-verification-code=57f76737bb8badd568b055bc4ff9d405"
}
}
}
+4 -1
View File
@@ -5,5 +5,8 @@
},
"records": {
"CNAME": "the-meerkats-projects-shays24-90484013ec4c0067187cd3a154c706ad6.gitlab.io"
},
"services": {
"gitlab": "gitlab-pages-verification-code=621b768139e0bfaf6eb43d60db03cabf"
}
}
}
+4 -1
View File
@@ -5,5 +5,8 @@
},
"records": {
"CNAME": "pinage404.gitlab.io"
},
"services": {
"gitlab": "gitlab-pages-verification-code=d43eb39124dec340bdbb11a4d6aa6b52"
}
}
}
+11 -8
View File
@@ -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"
}
}
+4 -1
View File
@@ -5,5 +5,8 @@
},
"records": {
"CNAME": "sadkon.gitlab.io"
},
"services": {
"gitlab": "gitlab-pages-verification-code=478e4a7c8445704809ba0fa31e003df3"
}
}
}
+7
View File
@@ -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();
+16 -10
View File
@@ -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();