-
Notifications
You must be signed in to change notification settings - Fork 344
Ensure client_id/client_secret patterns are not enforced as before #3276
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?
Ensure client_id/client_secret patterns are not enforced as before #3276
Conversation
dimas-b
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution, @rmannibucau ! Please see my comment about not performing these checks. If you agree, the other comments can be ignored.
| */ | ||
| public abstract class PolarisConfiguration<T> { | ||
|
|
||
| private static final Logger LOGGER = LoggerFactory.getLogger(PolarisConfiguration.class); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: if you find "dead code", it's generally preferable to cleanup in a dedicated PR and avoid mixing cleanup with feature changes :)
| private void validateClientId(String clientId) { | ||
| if (!clientId.matches("^[0-9a-f]{16}$")) { | ||
| if (!clientId.matches( | ||
| realmConfig.getConfig(FeatureConfiguration.CREDENTIAL_RESET_CLIENT_ID_PATTERN))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should validate the value of CREDENTIAL_RESET_CLIENT_ID_PATTERN on startup to avoid deferred RegEx syntax errors (it's an admin mistake, not the API client's mistake)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, it will be per realm so no sure it can be done at startup properly, do you have a code pointer in mind? would bootstrap realm fulfill your expectation?
default is known valid - same as before, it is hardcoded
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cf.
Line 142 in 1aa95de
| public ProductionReadinessCheck checkTokenBrokers(AuthenticationConfiguration configuration) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, not sure i'm a fan of this one, feature is quite specific and we would make the realm down for it? π€
let's drop the validation for now then
| private void validateClientSecret(String clientSecret) { | ||
| if (!clientSecret.matches("^[0-9a-f]{32}$")) { | ||
| if (!clientSecret.matches( | ||
| realmConfig.getConfig(FeatureConfiguration.CREDENTIAL_RESET_CLIENT_SECRET_PATTERN))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If validating client ID/secret format is becoming a nuisance to users, from my POV this check can just be removed completely. I do not think Polaris code relies on these values following a particular format.
If backward compatibility is a concern, I'd rather add a simple boolean flag to disable these checks (defaulting to enabled). WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine dropping the feature (the two validateClientX methods) too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 to @dimas-b suggestion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's try removing the checks completely and get some more reviews. If people raise concerns we can add an on/off flag then.
548e086 to
cd0bd7c
Compare
| } | ||
| } | ||
|
|
||
| private PolarisServiceImpl noAdminResetCredentialPolarisService() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this method still used?
cd0bd7c to
b842b06
Compare
b842b06 to
8dfbac6
Compare
dimas-b
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code change LGTM π The PR title probably needs to be adjusted now π
client_id/client_secret patterns are validated when calling reset endpoint but the pattern is hardcoded which can be too rigid.
this PR just enables to configure it.
Checklist
CHANGELOG.md(if needed)site/content/in-dev/unreleased(if needed)