-
Notifications
You must be signed in to change notification settings - Fork 2.1k
[Browser MFA] Rename browser mfa config name #64980
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
Changes from all commits
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 |
|---|---|---|
|
|
@@ -132,10 +132,10 @@ type AuthPreference interface { | |
| // SetAllowHeadless sets the value of the allow headless setting. | ||
| SetAllowHeadless(b bool) | ||
|
|
||
| // GetAllowBrowserAuthentication returns if browser authentication is allowed by cluster settings. | ||
| GetAllowBrowserAuthentication() bool | ||
| // SetAllowBrowserAuthentication sets the value of the allow browser authentication setting. | ||
| SetAllowBrowserAuthentication(b bool) | ||
| // GetAllowCLIAuthViaBrowser returns if cli auth via browser is allowed by cluster settings. | ||
| GetAllowCLIAuthViaBrowser() bool | ||
| // SetAllowCLIAuthViaBrowser sets the value of the allow cli auth via browser setting. | ||
| SetAllowCLIAuthViaBrowser(b bool) | ||
|
|
||
| // SetRequireMFAType sets the type of MFA requirement enforced for this cluster. | ||
| SetRequireMFAType(RequireMFAType) | ||
|
|
@@ -472,20 +472,20 @@ func (c *AuthPreferenceV2) SetAllowHeadless(b bool) { | |
| c.Spec.AllowHeadless = NewBoolOption(b) | ||
| } | ||
|
|
||
| // GetAllowBrowserAuthentication returns whether browser authentication is | ||
| // GetAllowCLIAuthViaBrowser returns whether cli auth via browser is | ||
| // allowed. If it's not explicitly configured, it defaults to true when | ||
| // WebAuthn is enabled as a second factor. | ||
| func (c *AuthPreferenceV2) GetAllowBrowserAuthentication() bool { | ||
| if c.Spec.AllowBrowserAuthentication != nil { | ||
| return c.Spec.AllowBrowserAuthentication.Value | ||
| func (c *AuthPreferenceV2) GetAllowCLIAuthViaBrowser() bool { | ||
| if c.Spec.AllowCLIAuthViaBrowser != nil { | ||
| return c.Spec.AllowCLIAuthViaBrowser.Value | ||
|
Comment on lines
+479
to
+480
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.
Useful? React with 👍 / 👎.
Contributor
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. ^ Do we want to deprecate
Contributor
Author
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. Ideally, I would've fully replaced
Contributor
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. If this wasn't part of an active release we can delete the old field and "replace" it with the new one. If it were part of an active release then it's a different conversation. |
||
| } | ||
|
|
||
| // Default to enabled when WebAuthn is enabled. | ||
| return c.IsSecondFactorWebauthnAllowed() | ||
| } | ||
|
|
||
| func (c *AuthPreferenceV2) SetAllowBrowserAuthentication(b bool) { | ||
| c.Spec.AllowBrowserAuthentication = NewBoolOption(b) | ||
| func (c *AuthPreferenceV2) SetAllowCLIAuthViaBrowser(b bool) { | ||
| c.Spec.AllowCLIAuthViaBrowser = NewBoolOption(b) | ||
| } | ||
|
|
||
| // SetRequireMFAType sets the type of MFA requirement enforced for this cluster. | ||
|
|
@@ -830,9 +830,9 @@ func (c *AuthPreferenceV2) CheckAndSetDefaults() error { | |
| return trace.BadParameter("missing required Webauthn configuration for headless=true") | ||
| } | ||
|
|
||
| // Validate AllowBrowserAuthentication. WebAuthn is required for browser authentication. | ||
| if !hasWebauthn && c.Spec.AllowBrowserAuthentication != nil && c.Spec.AllowBrowserAuthentication.Value { | ||
| return trace.BadParameter("missing required Webauthn configuration for allow_browser_authentication=true") | ||
| // Validate AllowCLIAuthViaBrowser. WebAuthn is required for cli auth via browser. | ||
| if !hasWebauthn && c.Spec.AllowCLIAuthViaBrowser != nil && c.Spec.AllowCLIAuthViaBrowser.Value { | ||
| return trace.BadParameter("missing required Webauthn configuration for allow_cli_auth_via_browser=true") | ||
|
danielashare marked this conversation as resolved.
|
||
| } | ||
|
|
||
| // Prevent local lockout by disabling local second factor methods. | ||
|
|
||
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.
Changing
AllowCLIAuthViaBrowserto protobuf field24(while reserving23) breaks binary compatibility for mixed-version clients and servers that still sendAllowBrowserAuthenticationon tag 23 throughclusterconfigv1gRPC (Get/Update/UpsertAuthPreferenceusetypes.AuthPreferenceV2). Fresh evidence: this commit now reserves tag 23, so legacy values can no longer populate a known field andGetAllowCLIAuthViaBrowser()falls back to the WebAuthn-derived default, which can silently re-enable browser-based CLI auth after upgrade.Useful? React with 👍 / 👎.