-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix hash_application_secrets fallback not upgrading secret on access #1801
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
7152cba
eb94e65
c02a6fd
921428f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -27,9 +27,23 @@ def by_uid_and_secret(uid, secret) | |
| app = by_uid(uid) | ||
| return unless app | ||
| return app if secret.blank? && !app.confidential? | ||
| return unless app.secret_matches?(secret) | ||
|
|
||
| app | ||
| # Try the primary (active) secret strategy first. | ||
| if !secret.nil? && !app.secret.nil? && | ||
| secret_strategy.secret_matches?(secret.to_s, app.secret.to_s) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📝 [rubocop] <Layout/MultilineOperationIndentation> reported by reviewdog 🐶 |
||
| return app | ||
| end | ||
|
|
||
| # Fall back to the previous strategy if configured, upgrading on success | ||
| # to migrate the stored secret to the active strategy (mirrors the | ||
| # find_by_plaintext_token -> find_by_fallback_token pattern). | ||
| if fallback_secret_strategy && !secret.nil? && !app.secret.nil? && | ||
| fallback_secret_strategy.secret_matches?(secret.to_s, app.secret.to_s) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📝 [rubocop] <Layout/MultilineOperationIndentation> reported by reviewdog 🐶 |
||
| upgrade_fallback_value(app, :secret, secret) | ||
| return app | ||
| end | ||
|
|
||
| nil | ||
| end | ||
|
|
||
| # Returns an instance of the Doorkeeper::Application with specific UID. | ||
|
|
||
|
nbulaj marked this conversation as resolved.
|
Uh oh!
There was an error while loading. Please reload this page.