fix: jwt-aud config not failing when set to invalid URI (#4140)

The `jwt-aud` config was not validated when containing ':'
character according to RFC 3986. This fix validates it and
fails at startup if it is invalid.
This commit is contained in:
Taimoor Zaeem
2025-06-18 00:11:30 +00:00
committed by Laurence Isla
parent 733a896113
commit 5b45113565
4 changed files with 34 additions and 8 deletions
+12
View File
@@ -278,3 +278,15 @@ def test_schema_cache_snapshot(baseenv, key, snapshot_yaml):
Dumper=yaml.SafeDumper if key == "dbTimezones" else ExtraNewLinesDumper,
)
assert formatted == snapshot_yaml
def test_jwt_aud_config_set_to_invalid_uri(defaultenv):
"PostgREST should exit with an error message in output if jwt-aud config is set to an invalid URI"
env = {
**defaultenv,
"PGRST_JWT_AUD": "foo://%%$$^^.com",
}
with pytest.raises(PostgrestError):
dump = cli(["--dump-config"], env=env).split("\n")
assert "jwt-aud should be a string or a valid URI" in dump