Upgrading postgREST from 10 to 11, JWT 'exp' no longer working, 'intarray' extension not functioning #3115
-
I am attempting to upgrade postgREST on a FreeBSD from version 10.1.2 to 11.0.1 (This is the latest available in the FreeBSD ports tree). JWTs containing an 'exp' were previously recognized as expired when the 'exp' timestamp was passed under 10, but are being allowed to access resources in 11. If I reinstall the 10.1.2 package and restart postgREST, they start working again - the only change is the version of postgREST. I did update the postgrest/default.conf file when changing the version, and I've verified that the 'exp' is indeed present using https://jwt.io/. Has there been some change in JWT 'exp' processing that needs to be accounted for? The other problem is that operators in the postgresql intarray extension (https://www.postgresql.org/docs/current/intarray.html) are no longer recognized. The extension is creates with schema 'public', and Any hint, suggestions, or debugging help are greatly appreciated. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
That's strange, the For intarray, which operators don't work anymore? Do you have an example (e.g. using |
Beta Was this translation helpful? Give feedback.
-
Token: jwt.io decode:
Key (randomly generated): Note the current date is after the date in the "exp" field above.
I also checked that the date on the machine running postgrest and on the machine running the queries were within a second of each other. Also note that I've had several attempts at reproducing the error that appeared to work correctly, though all the automation test runs I've looked at always fail with postgrest 11 and always succeed with postgrest 10. I made several attempts, all of which provided the requested data, up to 1702853309 (17:48:29). Then, several minutes later at timestamp 1702853757 (17:55:57), I got the correct expired response:
|
Beta Was this translation helpful? Give feedback.
-
The intarray operation in question is "-", remove values present in one array from another array. It works on the test machine interactively:
But a function used by the REST api that was doing this returned a 404 error:
Here are the contents of the postgrest/default.conf file in use with both postgrest10 and 11:
|
Beta Was this translation helpful? Give feedback.
Thanks for the extra info! Now I see that it may be related to this change introduced in 11.0.1 #2772. It mentions that a skew is used to validate the JWT expiration, so the tokens now expire 30 secs after the
exp
time. It's based on the Google recommended skew of 30s. I believe your tests should pass if you generate them 30 seconds before the expectedexp
time.