-
Notifications
You must be signed in to change notification settings - Fork 391
Filter subject tokens (from token exchange) from logs #1522
Copy link
Copy link
Closed
Milestone
Description
Which version of Duende IdentityServer are you using?
6.3.6
Which version of .NET are you using?
.Net 8.0.100
Describe the bug
Not sure if this is actually a bug, but it does seem strange that the list of sensitive filter values for TokenRequests does not include the Subject Token.
To Reproduce
Perform a token exchange and observe that the original token (ex. an access token) is logged in the Subject Token field.
Current log output:
{
"ClientId": "whatever",
"ClientName": "whatever",
"GrantType": "urn:ietf:params:oauth:grant-type:token-exchange",
"Scopes": "whatever",
"AuthorizationCode": "********",
"RefreshToken": "********",
"Raw": {
"token_exchange_source_hint": "whatever",
"grant_type": "urn:ietf:params:oauth:grant-type:token-exchange",
"subject_token": "!!!!!!!!TOKEN!!!!!!!!!!",
"subject_token_type": "urn:ietf:params:oauth:token-type:access_token",
"scope": "whatever",
"client_id": "whatever",
"client_secret": "***REDACTED***"
}
}
Expected behavior
I think it might be safer to include the OidcConstants.TokenRequest.SubjectToken constant in the default list of TokenRequestSensitiveValuesFilter in the LoggerOptions.
Suggested log output:
{
"ClientId": "whatever",
"ClientName": "whatever",
"GrantType": "urn:ietf:params:oauth:grant-type:token-exchange",
"Scopes": "whatever",
"AuthorizationCode": "********",
"RefreshToken": "********",
"Raw": {
"token_exchange_source_hint": "whatever",
"grant_type": "urn:ietf:params:oauth:grant-type:token-exchange",
"subject_token": "***REDACTED**",
"subject_token_type": "urn:ietf:params:oauth:token-type:access_token",
"scope": "whatever",
"client_id": "whatever",
"client_secret": "***REDACTED***"
}
}
Additional context
If this suggestion sounds good, I can go ahead and open a PR.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels