<div dir="ltr">To me, the reason to use a token is to grant a client *temporary* access on behalf of the user who authenticated to begin with.<div><br></div><div>Perpetual renewal makes the token as powerful as the username+password, and that seems wrong. Yes, you can invalidate the user's tokens, but it requires someone to notice that the token got compromised. Time (if an expiration is set) handles that for you.</div><div><br></div><div>Imagine I authenticate with username + password, I get a token, and I use it a few times. At some point, someone steals the token. If they can renew it, they will forever impersonate me, until I notice and I request the token to be invalidated.</div><div><br></div><div>If the original token and all its refreshes eventually expire, then they will have to wait for me to use the system again, in order to either steal my username + password, or the next token (arguably because if they did it once, they can do it again). If that won't happen any time soon, my account will be safe.</div><div><br></div><div>Another scenario: someone tcpdumps my traffic (yes, somehow they have the SSL cert, work with this assumption for now). They can come back 3 days from now, browse the tcpdump output, and renew the token. That would not be possible with a short-lived token and no renewal past expiration.</div><div><br></div><div>SSL will absolutely help and makes it less likely to mess up. But if you get your token via HTTPS, and somewhere way down into the API there is an (unsafe) redirect to HTTP that the client blindly obeys and sends the token (they never should), then your traffic is no longer protected so the token can be stolen. This scenario sounds like <a href="https://en.wikipedia.org/wiki/HTTP_cookie">https://en.wikipedia.org/wiki/HTTP_cookie</a> where browsers know not to send cookies over non-HTTPS if Secure is set.</div><div><br></div><div>Sorry for the long diatribe.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Nov 29, 2017 at 4:18 PM, Brian Bouterse <span dir="ltr"><<a href="mailto:bbouters@redhat.com" target="_blank">bbouters@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div>I like the ability to refresh tokens. I imagined it would be allowed forever with no limit (effectively disable JWT_REFRESH_EXPIRATION_DELTA). If an admin wants to lock out the user they easily can regardless of renewal. No one suggested this, but I believe we should not expose either of these options in the Pulp settings at least for now. If we expose this JWT plugin's feature set to Pulp users, then Pulp will have to carry that feature set if we ever switch plugins.<br></div><div><br></div><div>Allowing renewal does have an undesirable quality in that you can't issue a JWT and trust the user has a limited, known amount time on the system. The other option is to not allow renewal and instead recommend that users who want longer, or never-expiring tokens can get them like this:  <a href="http://docs.pulpproject.org/en/3.0/nightly/integration_guide/rest_api/authentication.html#offline-token-generation" target="_blank">http://docs.pulpproject.org/<wbr>en/3.0/nightly/integration_<wbr>guide/rest_api/authentication.<wbr>html#offline-token-generation</a></div><div><br></div><div>I'm slightly in favor of the "allow endless-renewal from a JWT" approach because what it lacks in desirable qualities, it ensures that during all normal usage, the user doesn't have to have to get out a Python shell.</div><div><br></div><div>What is the right behavior here?<br></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div><div class="h5">On Wed, Nov 29, 2017 at 2:57 PM, Jeremy Audet <span dir="ltr"><<a href="mailto:jaudet@redhat.com" target="_blank">jaudet@redhat.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Jeremy, I don't think I understand your comment.<div><br></div><div>You *will* have to use basic auth to refresh the token when the original one expires.</div></div></blockquote><div><br></div></span><div>Right. I understand that. I'm not arguing that we allow the user to generate a valid JWT token using an expired, invalid JWT token. I'm arguing that we allow the user to generate a valid JWT token using an unexpired, valid JWT token. This allows use cases such as a client (web browser, CLI tool, etc) being able to re-authenticate itself without re-prompting the user for a username and password. This is especially relevant if the token expiration time is set to a short value, such as 15 minutes.<br></div><span><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div> So there are limitations to a JWT, and for good reasons. A JWT is a weaker authenticator than a username+password because it expires. Because it is timestamped, it reduces the risk of compromising your account if someone sniffs the traffic.</div></div></blockquote><div><br></div></span><div>If there's security concerns here, then that's important, and they should be weighted heavily.</div><div><br></div><div>Note that there's an easy-to-use mechanism for invalidating a user's tokens.<br></div><span><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div></div><div>Refreshing the token with a JWT seems marginally useful to me.</div></div></blockquote></span></div></div></div>
<br></div></div><span class="">______________________________<wbr>_________________<br>
Pulp-dev mailing list<br>
<a href="mailto:Pulp-dev@redhat.com" target="_blank">Pulp-dev@redhat.com</a><br>
<a href="https://www.redhat.com/mailman/listinfo/pulp-dev" rel="noreferrer" target="_blank">https://www.redhat.com/mailman<wbr>/listinfo/pulp-dev</a><br>
<br></span></blockquote></div><br></div>
</blockquote></div><br></div>