fix: emit the OIDC configuration decode failure without the configuration - #4587
Draft
jasonhernandez wants to merge 1 commit into
Draft
fix: emit the OIDC configuration decode failure without the configuration#4587jasonhernandez wants to merge 1 commit into
jasonhernandez wants to merge 1 commit into
Conversation
…tion The log statement on a provider configuration decode failure had no terminal call, so it built a log entry and discarded it. Two consequences: the failure was never actually reported, and the entry it assembled carried the raw configuration, which holds every provider's client_secret. The failure is now logged at error level with the decode error alone. The configuration is not attached. Note for anyone tempted to keep the field: `conf` is a json.RawMessage, so a text-formatted log renders it as a slice of byte values rather than as readable JSON, which hides the secrets from a casual grep without keeping them out of the log. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
(*Strategy).Configlogs a provider configuration decode failure like this:logrusx.Logger.WithErrorand.WithFieldboth return a*Logger, so this statement builds a derived logger and throws it away. There is no terminal call, so nothing is ever emitted. Two problems follow:selfservice.methods.oidc.configreturns a 500 with no corresponding log line, which makes it harder to debug than it needs to be.confholds every configured provider'sclient_secret. Nothing leaks today only because the entry is discarded — so the obvious fix of appending.Error(...)would turn a dormant problem into an active one.This patch logs the failure at error level with the decode error alone, and does not attach the configuration.
One detail worth recording, because it makes the leak easy to miss in review:
confis ajson.RawMessage, so with a text formatter logrus renders it asconfig=[123 34 112 ...]— a slice of byte values rather than readable JSON. The secrets are fully present but survive a casual grep for them, which is exactly how this kind of thing stays unnoticed. The test asserts onfmt.Sprintf("%s", value)for that reason.Related issue(s)
Found while working on #4586, which lets
client_secretbe loaded from afile://orbase64://URI. The two are independent: this one is a self-contained fix and does not depend on #4586 in either direction.They touch
Config()a few lines apart, so whichever merges second may need a trivial rebase. Happy to reorder or combine them if you'd prefer.Checklist
Remaining checklist items are attestations for the PR author to confirm.
On the security-policy question: this is being raised as an ordinary bug rather than through security@ory.sh, on the grounds that the current code emits nothing and therefore leaks nothing. If you would rather treat the dormant path as a disclosure matter, say so and I will withdraw this PR and reroute it.
Testing
TestConfigDecodeFailureLoggingasserts that a decode failure produces an error-level entry and that neither the message nor any field carries the configuration.I verified the test actually discriminates, rather than just passing against the new code:
WithField("config", conf), no terminal call)the decode failure should be loggedWithField("config", conf).Error(...))log field "config" must not carry the configurationThe naive-fix case is the reason the assertion formats field values with
%s; an earlier version of the test compared the rendered entry as a string and passed against the leaking implementation, because the byte-slice rendering hid the value.TestSettingsStrategyfails in my environment because it requires a Docker-hosted Hydra; it fails identically on an unmodified tree.