diff --git a/frigate/config/proxy.py b/frigate/config/proxy.py index baaa8f0304..77bb631388 100644 --- a/frigate/config/proxy.py +++ b/frigate/config/proxy.py @@ -55,10 +55,9 @@ class ProxyConfig(FrigateBaseModel): @field_validator("default_role", mode="before") @classmethod def normalize_deny_sentinel(cls, v): - # Fail closed on capitalization: an unnormalized "None" would miss the - # sentinel and fall back to viewer, granting the access it was meant to - # deny. Other role names stay case-sensitive. - if isinstance(v, str) and v.strip().lower() == "none": + # Fail closed: "none" in any casing and a null default both deny. + # Normalizing null keeps the value through /config, which drops nulls + if v is None or (isinstance(v, str) and v.strip().lower() == "none"): return "none" return v diff --git a/frigate/test/test_proxy_auth.py b/frigate/test/test_proxy_auth.py index bad7a25291..ff68489db7 100644 --- a/frigate/test/test_proxy_auth.py +++ b/frigate/test/test_proxy_auth.py @@ -226,6 +226,9 @@ class TestDefaultRoleNone(unittest.TestCase): ) self.assertEqual(role, "none") + def test_null_default_role_normalizes_to_none(self): + self.assertEqual(ProxyConfig(default_role=None).default_role, "none") + def test_other_role_names_stay_case_sensitive(self): """Only the deny sentinel is normalized; role names are untouched.""" config = ProxyConfig(default_role="Operator") diff --git a/web/src/components/config-form/theme/widgets/DefaultRoleWidget.tsx b/web/src/components/config-form/theme/widgets/DefaultRoleWidget.tsx index a539ae10f3..d79cd7d4e8 100644 --- a/web/src/components/config-form/theme/widgets/DefaultRoleWidget.tsx +++ b/web/src/components/config-form/theme/widgets/DefaultRoleWidget.tsx @@ -29,13 +29,7 @@ export function DefaultRoleWidget(props: WidgetProps) { return [...BUILT_IN_ROLES, ...custom, NONE_ROLE]; }, [formContext]); - // A null default denies access, so it displays as none - const selectedValue = - value === null - ? NONE_ROLE - : typeof value === "string" && value - ? value - : "viewer"; + const selectedValue = typeof value === "string" && value ? value : "viewer"; const getLabel = (role: string) => BUILT_IN_ROLES.includes(role) || role === NONE_ROLE