Skip to content

Do not log sensitive data#1380

Merged
julien-nc merged 1 commit intomainfrom
enh/noid/sensitive-logs
Mar 20, 2026
Merged

Do not log sensitive data#1380
julien-nc merged 1 commit intomainfrom
enh/noid/sensitive-logs

Conversation

@julien-nc
Copy link
Member

We can log ID token (or userinfo) keys but not the values.

Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Reduces exposure of sensitive OIDC data by removing or sanitizing logging of token/userinfo contents during the login code flow.

Changes:

  • Avoid logging full token endpoint responses and parsed JWT payload contents.
  • Replace error logging of full response data with logging of response keys only.
  • Remove logging of full userinfo values and log userinfo keys instead.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

}

$this->logger->debug('Received code response: ' . json_encode($data, JSON_THROW_ON_ERROR));
$this->logger->debug('Received code response');
}

$this->logger->debug('Parsed the JWT payload: ' . json_encode($idTokenPayload, JSON_THROW_ON_ERROR));
$this->logger->debug('Parsed the JWT payload');
if (isset($oidcSystemConfig['enrich_login_id_token_with_userinfo']) && $oidcSystemConfig['enrich_login_id_token_with_userinfo']) {
$userInfo = $this->oidcService->userInfo($provider, $data['access_token']);
$this->logger->debug('[UserInfoEnrich] Enriching the JWT payload with userinfo values', ['userinfo' => $userInfo]);
$this->logger->debug('[UserInfoEnrich] Enriching the JWT payload with userinfo values');
if (!isset($idTokenPayload->{$key})) {
$idTokenPayload->{$key} = $value;
$this->logger->debug('[UserInfoEnrich] Using userinfo value: ' . $key . ' => ' . $value);
$this->logger->debug('[UserInfoEnrich] Using userinfo key: ' . $key);
@julien-nc julien-nc force-pushed the enh/noid/sensitive-logs branch 2 times, most recently from 8db7eae to 38092ef Compare March 19, 2026 12:34
@julien-nc
Copy link
Member Author

Psalm checks are flaky for some reason. Unrelated.

@julien-nc julien-nc merged commit d83fb47 into main Mar 20, 2026
128 of 147 checks passed
@julien-nc julien-nc deleted the enh/noid/sensitive-logs branch March 20, 2026 00:56
@julien-nc julien-nc mentioned this pull request Mar 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants