From 3d95c411150b87137dede9ddf4eb6b1ecf63d512 Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Sun, 18 Feb 2024 16:48:52 +0100 Subject: [PATCH] docs: Remove note about risk of asymmetric keys for JWT auth The obviously wrong statement is, that PostgREST does not support asymmetric keys, while it does. Extending on this type of attack is not necessary, because it is in fact covered by the paragraph before - reading the algorithm from the JWT header is the problem in that case, too. We don't do that. This leaves us with the sentence about how the chosen library is the most important part. While that is correct, the hint about high quality libraries for use on the *client* side is mis- leading: The important part here is the library we choose to implement PostgREST with, not the client-side lib. Thus, removing the whole paragraph is the best thing to do here. Resolves https://github.com/PostgREST/postgrest-docs/issues/123 --- docs/references/auth.rst | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/docs/references/auth.rst b/docs/references/auth.rst index 6f4ede021..cff41806e 100644 --- a/docs/references/auth.rst +++ b/docs/references/auth.rst @@ -168,9 +168,7 @@ There are at least three types of common critiques against using JWT: 1) against The critique against the `JWT standard `_ is voiced in detail `elsewhere on the web `_. The most relevant part for PostgREST is the so-called :code:`alg=none` issue. Some servers implementing JWT allow clients to choose the algorithm used to sign the JWT. In this case, an attacker could set the algorithm to :code:`none`, remove the need for any signature at all and gain unauthorized access. The current implementation of PostgREST, however, does not allow clients to set the signature algorithm in the HTTP request, making this attack irrelevant. The critique against the standard is that it requires the implementation of the :code:`alg=none` at all. -Critiques against JWT libraries are only relevant to PostgREST via the library it uses. As mentioned above, not allowing clients to choose the signature algorithm in HTTP requests removes the greatest risk. Another more subtle attack is possible where servers use asymmetric algorithms like RSA for signatures. Once again this is not relevant to PostgREST since it is not supported. Curious readers can find more information in `this article `_. Recommendations about high quality libraries for usage in API clients can be found on `jwt.io `_. - -The last type of critique focuses on the misuse of JWT for maintaining web sessions. The basic recommendation is to `stop using JWT for sessions `_ because most, if not all, solutions to the problems that arise when you do, `do not work `_. The linked articles discuss the problems in depth but the essence of the problem is that JWT is not designed to be secure and stateful units for client-side storage and therefore not suited to session management. +Another type of critique focuses on the misuse of JWT for maintaining web sessions. The basic recommendation is to `stop using JWT for sessions `_ because most, if not all, solutions to the problems that arise when you do, `do not work `_. The linked articles discuss the problems in depth but the essence of the problem is that JWT is not designed to be secure and stateful units for client-side storage and therefore not suited to session management. PostgREST uses JWT mainly for authentication and authorization purposes and encourages users to do the same. For web sessions, using cookies over HTTPS is good enough and well catered for by standard web frameworks.