feat(ci): disallowed cnames

This commit is contained in:
William Harrison committed 2025-07-08 20:48:07 +08:00
1 parent 8b843f6a96
commit d39083412b
2 files changed
+13

No files matched your search

+10
View File
@@ -88,6 +88,8 @@ function isValidHexadecimal(value) {
return /^[0-9a-fA-F]+$/.test(value);
}
const disallowedCNAMEs = require("../util/disallowed-cnames.json");
function validateRecordValues(t, data, file) {
const subdomain = file.replace(/\.json$/, "");
@@ -141,6 +143,14 @@ function validateRecordValues(t, data, file) {
t.true(isValidHostname(value), `${file}: Invalid hostname for ${key}`);
t.true(value !== `${subdomain}.is-a.dev`, `${file}: ${key} cannot point to itself`);
t.true(value !== "is-a.dev", `${file}: ${key} cannot point to is-a.dev`);
for (const disallowed of disallowedCNAMEs) {
if (disallowed.startsWith(".")) {
t.false(value.endsWith(disallowed), `${file}: ${key} cannot end with ${disallowed}`);
} else {
t.false(value === disallowed, `${file}: ${key} cannot be ${disallowed}`);
}
}
} else if (key === "URL") {
t.true(
value.startsWith("http://") || value.startsWith("https://"),
+3
View File
@@ -0,0 +1,3 @@
[
".workers.dev"
]