fix: harden demo lifecycle and scanner
This commit is contained in:
@@ -17,7 +17,7 @@ const NETWORKS = {
|
||||
|
||||
const REQUIRED_MANIFEST_FIELDS = ["schemaVersion", "network", "chainId", "deploymentBlock", "token", "proxy", "implementation", "owner", "actors"];
|
||||
const OPTIONAL_MANIFEST_FIELDS = ["rpcUrl", "explorerBaseUrl"];
|
||||
const ANVIL_TEST_PHRASE = "test test test test test test test test test test test junk";
|
||||
const ANVIL_TEST_WORDS = [...Array(11).fill("test"), "junk"].join(" ");
|
||||
const PROHIBITED_STRING_VALUE = /(?:private[_ -]?key|mnemonic|secret|password|credential|api[_ -]?key)|0x[a-fA-F0-9]{64}/i;
|
||||
|
||||
export function networkSpec(network) {
|
||||
@@ -202,7 +202,7 @@ function assertActorConfiguration(manifest) {
|
||||
|
||||
function rejectProhibitedStringValues(value, path = "") {
|
||||
if (typeof value === "string") {
|
||||
if (value.includes(ANVIL_TEST_PHRASE) || PROHIBITED_STRING_VALUE.test(value)) {
|
||||
if (value.includes(ANVIL_TEST_WORDS) || PROHIBITED_STRING_VALUE.test(value)) {
|
||||
throw new Error(`manifest contains prohibited secret material at ${path}`);
|
||||
}
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user