mirror of
https://github.com/tiennm99/is-a-dev.git
synced 2026-10-13 22:15:57 +00:00
block render from being proxied
This commit is contained in:
1 parent
c8ee690e82
commit
74a1356d34
2 files changed
+38
-2
No files matched your search
@@ -5,6 +5,5 @@
|
||||
},
|
||||
"records": {
|
||||
"CNAME": "ziplineshockbs.onrender.com"
|
||||
},
|
||||
"proxied": true
|
||||
}
|
||||
}
|
||||
@@ -49,3 +49,40 @@ t("Domains with proxy enabled must have at least one proxy-able record", (t) =>
|
||||
validateProxiedRecords(t, data, file);
|
||||
});
|
||||
});
|
||||
|
||||
const disallowedRecords = [
|
||||
{
|
||||
type: "CNAME",
|
||||
value: "*.onrender.com"
|
||||
}
|
||||
];
|
||||
|
||||
t("Domains with specific records must not have proxy enabled", (t) => {
|
||||
files.forEach((file) => {
|
||||
const data = getDomainData(file);
|
||||
|
||||
if (data.proxied) {
|
||||
disallowedRecords.forEach((record) => {
|
||||
let recordExists = false;
|
||||
|
||||
if (!data.records[record.type]) {
|
||||
t.pass();
|
||||
return;
|
||||
} else if (Array.isArray(data.records[record.type])) {
|
||||
recordExists = data.records[record.type].some((r) =>
|
||||
record.value.startsWith("*.") ? r.endsWith(record.value.slice(2)) : r === record.value
|
||||
);
|
||||
} else {
|
||||
recordExists = record.value.startsWith("*.")
|
||||
? data.records[record.type].endsWith(record.value.slice(2))
|
||||
: data.records[record.type] === record.value;
|
||||
}
|
||||
|
||||
t.false(
|
||||
recordExists,
|
||||
`${file}: Records matching \`${record.type}: "${record.value}"\` cannot be proxied`
|
||||
);
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user