Closed donaldgray closed 1 week ago
This issue has now been fixed with #916
The issue for this was that cloudfront was caching authentication requests for cookies due to the authentication request looking like the same request every time (specifically the action token response here). This caused the caller to think that the dlcs-token-*
cookie was extended, when in reality there had been no extension. This tricked applications (like the Wellcome works page) into requesting images that were forbidden due to an expired token
In order to fix this, no-store
headers were added to authentication endpoints meaning that cloudfront no longer caches them.
Raised by Wellcome, there appears to be a bug where a user can end up with a cookie that references a UserSession that is expired in the database but the cookie expiry is being extended,. This means that if another clickthrough agreement is accepted the previous cookie is not removed and all images with clickthrough role return a 401.
Steps to replicate
dlcs-token-{customer}
cookie issued and note expiry.AuthToken
in database.cache-control:private
header sent so try a different size/rotation/quality/format to ensure it's fresh) and confirm response is 401.dlcs-token-{customer}
cookie will still be present with extended expiry.AuthToken
in database expiry is in past and doesn't update.Example links for Wellcome where this was noticed (see slack for more details)
Thoughts:
AuthToken.TTL
, rather than updated to matchAuthToken.Expires
so they can end up out of sync - could this be an issue?AuthCookieManager.SetCookieInResponse()
uses cookie-value from database but do cookie headers need cleared first?