fosite.Request: Update Request ID in request.Merge() #386
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Updating
Request.Merge()
to also merge the request ID from the passed inrequest, since in all cases where
Merge()
is called, the receiver objecthas an uninitialized
ID
value. This fixes an issue whereintrospectAccessToken()
is returning the wrong request ID:Fosite.IntrospectToken()
creates a newar
object with no initialized ID:https://github.com/ory/fosite/blob/master/introspect.go#L59
Fosite.IntrospectToken
callsCoreValidator.IntrospectToken()
:https://github.com/ory/fosite/blob/master/introspect.go#L61
CoreValidator.IntrospectToken()
callsCoreValidator.introspectAccessToken()
:https://github.com/ory/fosite/blob/master/handler/oauth2/introspector.go#L58
introspectAccessToken
reads the access token session from storage. The returnedor
object has the correct RequestID:https://github.com/ory/fosite/blob/master/handler/oauth2/introspector.go#L83
introspectAccessToken
mergesaccessRequest
withor
, but the call toMerge()
does not merge the RequestID fromor.GetID()
.https://github.com/ory/fosite/blob/master/handler/oauth2/introspector.go#L112
accessRequest
object has an uninitializedID
, so the next call toGetID()
will return a random UUID.Steps to reproduce:
ar.GetID()
is not the originalrequestId
value.Related issue
Proposed changes
Set the
RequestID
from the passed inrequest
object inRequest.Merge()
:https://github.com/ory/fosite/blob/master/request.go#L168
Checklist
vulnerability, I confirm that I got green light (please contact security@ory.sh) from the maintainers to push the changes.
Further comments