{"id":7922,"date":"2020-02-03T22:03:31","date_gmt":"2020-02-03T22:03:31","guid":{"rendered":"https:\/\/staging-site.42crunch.com\/?p=7922"},"modified":"2022-11-23T10:32:35","modified_gmt":"2022-11-23T10:32:35","slug":"webinar-questions-jwt","status":"publish","type":"post","link":"https:\/\/staging2022.42crunch.com\/webinar-questions-jwt\/","title":{"rendered":"Questions Answered: Are you properly using JWTs?"},"content":{"rendered":"
<\/p>\n
<\/p>\n
<\/p>\n
Yes, definitely, as long as you defined properly the JWTBearerOptions that will be used by the app.UseJwtBearerAuthentication() in the Startup call.\u00a0<\/span><\/p>\n Also retrieving dynamically the cryptographic material by dereferencing it from the value of the Issuer field of the JWT can sometimes be dangerous so instead of specifying the Authority field of the JWTBearerOptions object it can be interesting to specify the Issuer value (oftenly an URL) and a local value of the key to be used in a custom TokenValidationParameter.\u00a0<\/span><\/p>\n Please have a look at <\/span>https:\/\/devblogs.microsoft.com\/aspnet\/jwt-validation-and-authorization-in-asp-net-core\/<\/span><\/a> for more details.\u00a0<\/span><\/p>\n <\/p>\n When it comes to JWT used for OAuth2.0 and OpenIDConnect scenarios the JWT is used as a mechanism identifying on behalf of WHO is made the request (sub claim) WHAT is the target entity (the aud claim: the Resource Server -RS- in OAuth terminology, the Relying Party -RP-in OIDC terminology) and WHAT has issued the JWT (iss claim, the Authorization Server -AS- in OAuth terminology and the Provider -OP- in OpenID Connect terminology).\u00a0<\/span><\/p>\n WHAT is making the request (the Client in OAuth) is not in the JWT.<\/span><\/p>\n <\/p>\n No, this is a bad idea, as the more details you give about why is the JWT invalid the more you give info to a potential attacker so that he can now try to brute-force this or that and in the end retrieve some info that he should not be able to retrieve.<\/span><\/p>\n Use generic error messages to be sent back to your clients, keep detailed informations in your logs. One good way of being able to give detailed info to a client, using a back channel mechanism and after you verified that this info request is legitimate) is to give a transaction ID in the generic error message that you\u2019ll be able to correlate with what has been logged.<\/span><\/p>\n <\/p>\n In terms of pure security not really, as SHA-256 is not a priori to be broken for quite a few years. BUT SHA-384 and SHA-512 are slightly better in terms of security and are faster in some cases:<\/span><\/p>\n In short SHA-512 for instance has \u00bc more hashing rounds than SHA-256 but processes twice more data in each round (on 64 bits architecture).<\/span><\/p>\n So in the end, if you are on 64 bits architecture and if the data that must be hashed is bigger than 511 bits then yes, it\u2019s worth using SHA-512<\/span><\/p>\n <\/p>\n I guess you mean \u201chaving the external clients use OAuth2 OPAQUE access tokens, exchanged at an API Gateway\/Firewall level against OAuth2 JWT access tokens before being sent to internal microservices\u201d. Yes, definitely, it\u2019s what we called the \u201cPhantom Token\u201d in our presentation. As a rule of thumb it\u2019s always good to avoid having data exposed in a network zone where you don\u2019t need t!<\/span><\/p>\n<\/div>\n <\/p>\n Try our security audit<\/a> for free. If you want to see the whole platform in action, request a demo now<\/a>!<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":" You had questions, and we’ve got answers! Thank you for all the questions submitted on our “Are you properly using JWTs?” webinar. Below are all the answers to the questions that were asked. If you’d like more information please feel free to contact us. [xyz-ihs snippet=”Jwt-webinar”] Is it considered safe if the […]<\/p>\n","protected":false},"author":13,"featured_media":11341,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_seopress_robots_primary_cat":"none","_seopress_titles_title":""Are you properly using JSON Web Tokens (JWTs)", Webinar Q&A","_seopress_titles_desc":"Questions and answers from our webinar, "Are you properly using JWTs?" presented by Philippe Leothaud CTO of 42Crunch.","_seopress_robots_index":"","site-sidebar-layout":"default","site-content-layout":"default","ast-site-content-layout":"","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"disabled","ast-hfb-above-header-display":"disabled","ast-hfb-below-header-display":"disabled","ast-hfb-mobile-header-display":"disabled","site-post-title":"disabled","ast-breadcrumbs-content":"disabled","ast-featured-img":"disabled","footer-sml-layout":"disabled","theme-transparent-header-meta":"default","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[6],"tags":[16,25,15,40],"class_list":["post-7922","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-blog","tag-api-security-training","tag-api-testing","tag-api-vulnerabilities","tag-jwt"],"_links":{"self":[{"href":"https:\/\/staging2022.42crunch.com\/wp-json\/wp\/v2\/posts\/7922"}],"collection":[{"href":"https:\/\/staging2022.42crunch.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/staging2022.42crunch.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/staging2022.42crunch.com\/wp-json\/wp\/v2\/users\/13"}],"replies":[{"embeddable":true,"href":"https:\/\/staging2022.42crunch.com\/wp-json\/wp\/v2\/comments?post=7922"}],"version-history":[{"count":0,"href":"https:\/\/staging2022.42crunch.com\/wp-json\/wp\/v2\/posts\/7922\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/staging2022.42crunch.com\/wp-json\/wp\/v2\/media\/11341"}],"wp:attachment":[{"href":"https:\/\/staging2022.42crunch.com\/wp-json\/wp\/v2\/media?parent=7922"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/staging2022.42crunch.com\/wp-json\/wp\/v2\/categories?post=7922"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/staging2022.42crunch.com\/wp-json\/wp\/v2\/tags?post=7922"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}In this presentation the JWT are used as a mechanism to identify WHO is in the request, and for identifying WHAT is making the request?(WHO – The user in the request. WHAT – The thing making the request. It’s coming from Postman, an automated script or from the genuine and untampered mobile app!)
\n<\/em><\/strong><\/h5>\nIs it a good idea to expose invalid parts of the jwt? For example I could expose that the issuer is invalid.
\n<\/strong><\/h5>\nIs it worth it to use 384 or 512 over 256?
\n<\/strong><\/h5>\n\n
Is it better if I use Oauth2 to send the token to the client and JWT to send the info to my microservices?
\n<\/strong><\/h5>\n