Session impersonation, for example. In JWT approach, token is basically your session and can be used until expired. If you make it available to sites code, it becomes a target of any malicious script, browser extension etc. And if developer sets long expiration date, it becomes basically open door to your account if anyone intercepts it.
Where would that malicious script come from, assuming that the dev has done some research on the libs he/she is using and also that a modern framework is used. I'd say the same caution should be taken in the case of browsers extensions.
The second problem can be mitigated by setting a short expiring date and adding a refresh token, which should last longer.
Supply chain attacks are getting more and more popular. It is not only about your project dependencies, their dependencies dependencies and so on. Even popular libraries can (and are) compromised.
Anyway, among security professionals there is a strong movement to restrict JWT to authentication and not as session tokens.
Session impersonation, for example. In JWT approach, token is basically your session and can be used until expired. If you make it available to sites code, it becomes a target of any malicious script, browser extension etc. And if developer sets long expiration date, it becomes basically open door to your account if anyone intercepts it.
Where would that
malicious script
come from, assuming that the dev has done some research on the libs he/she is using and also that a modern framework is used. I'd say the same caution should be taken in the case of browsers extensions.The second problem can be mitigated by setting a short expiring date and adding a refresh token, which should last longer.
Supply chain attacks are getting more and more popular. It is not only about your project dependencies, their dependencies dependencies and so on. Even popular libraries can (and are) compromised.
Anyway, among security professionals there is a strong movement to restrict JWT to authentication and not as session tokens.
You may want to look at curity.io/resources/architect/api-... or other articles about JWT (in)security.
Makes sense. Thank you for sharing!