mirror of
https://github.com/tiennm99/is-a-dev.git
synced 2026-10-11 03:13:35 +00:00
feat(ci): disallowed cnames
This commit is contained in:
1 parent
8b843f6a96
commit
d39083412b
2 files changed
+13
No files matched your search
@@ -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://"),
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
[
|
||||
".workers.dev"
|
||||
]
|
||||
Reference in new issue
Block a user