fix: allow ALL ASN values in policy rule validation

This commit is contained in:
copilot-swe-agent[bot]
2026-06-16 23:44:35 +00:00
committed by Owen
parent a2882857ff
commit 3f37408dae
3 changed files with 42 additions and 5 deletions

View File

@@ -83,9 +83,19 @@ export function createPolicyRuleValueSchema(t: TranslateFn, match: string) {
{ message: t("rulesErrorInvalidCountryDescription") }
);
case "ASN":
return required.refine((value) => /^AS\d+$/i.test(value.trim()), {
message: t("rulesErrorInvalidAsnDescription")
});
return required.refine(
(value) => {
const normalizedValue = value.trim().toUpperCase();
return (
/^AS\d+$/i.test(normalizedValue) ||
normalizedValue === "ALL" ||
normalizedValue === "AS0"
);
},
{
message: t("rulesErrorInvalidAsnDescription")
}
);
default:
return required;
}