Skip to content

Commit

Permalink
fix: drop the MFA_ENABLED config (supabase#1701)
Browse files Browse the repository at this point in the history
## What kind of change does this PR introduce?

The `MFA_ENABLED` config is deprecated and not in active use.
  • Loading branch information
J0 authored Aug 4, 2024
1 parent 575e88a commit 078c3a8
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 15 deletions.
12 changes: 2 additions & 10 deletions internal/api/mfa.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,11 +256,7 @@ func (a *API) EnrollFactor(w http.ResponseWriter, r *http.Request) error {
}
return a.enrollPhoneFactor(w, r, params)
case models.TOTP:
// Prior to the introduction of MFA.TOTP.EnrollEnabled,
// MFA.Enabled was used to configure whether TOTP was on. So
// both have to be set to false to regard the feature as
// disabled.
if !config.MFA.Enabled && !config.MFA.TOTP.EnrollEnabled {
if !config.MFA.TOTP.EnrollEnabled {
return unprocessableEntityError(ErrorCodeMFATOTPEnrollDisabled, "MFA enroll is disabled for TOTP")
}
return a.enrollTOTPFactor(w, r, params)
Expand Down Expand Up @@ -395,11 +391,7 @@ func (a *API) ChallengeFactor(w http.ResponseWriter, r *http.Request) error {
return a.challengePhoneFactor(w, r)

case models.TOTP:
// Prior to the introduction of MFA.TOTP.VerifyEnabled,
// MFA.Enabled was used to configure whether TOTP was on. So
// both have to be set to false to regard the feature as
// disabled.
if !config.MFA.Enabled && !config.MFA.TOTP.VerifyEnabled {
if !config.MFA.TOTP.VerifyEnabled {
return unprocessableEntityError(ErrorCodeMFATOTPEnrollDisabled, "MFA verification is disabled for TOTP")
}
return a.challengeTOTPFactor(w, r)
Expand Down
2 changes: 0 additions & 2 deletions internal/api/settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ type Settings struct {
MailerAutoconfirm bool `json:"mailer_autoconfirm"`
PhoneAutoconfirm bool `json:"phone_autoconfirm"`
SmsProvider string `json:"sms_provider"`
MFAEnabled bool `json:"mfa_enabled"`
SAMLEnabled bool `json:"saml_enabled"`
}

Expand Down Expand Up @@ -75,7 +74,6 @@ func (a *API) Settings(w http.ResponseWriter, r *http.Request) error {
MailerAutoconfirm: config.Mailer.Autoconfirm,
PhoneAutoconfirm: config.Sms.Autoconfirm,
SmsProvider: config.Sms.Provider,
MFAEnabled: config.MFA.Enabled,
SAMLEnabled: config.SAML.Enabled,
})
}
3 changes: 0 additions & 3 deletions internal/conf/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,6 @@ type PhoneFactorTypeConfiguration struct {

// MFAConfiguration holds all the MFA related Configuration
type MFAConfiguration struct {
// Enabled is deprecated, but still used to signal TOTP.EnrollEnabled and TOTP.VerifyEnabled.
Enabled bool `default:"false"`

ChallengeExpiryDuration float64 `json:"challenge_expiry_duration" default:"300" split_words:"true"`
FactorExpiryDuration time.Duration `json:"factor_expiry_duration" default:"300s" split_words:"true"`
RateLimitChallengeAndVerify float64 `split_words:"true" default:"15"`
Expand Down

0 comments on commit 078c3a8

Please sign in to comment.