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

+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();