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:
committed by
Laurence Isla
parent
733a896113
commit
5b45113565
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user