Skip to content

Support MFA validation status on auth_session #4760

@jnfrati

Description

@jnfrati

Preflight Checklist

  • I agree to follow the Code of Conduct that this project adheres to.
  • I have searched the issue tracker for an issue that matches the one I want to file, without success.

Problem Description

With the addition of auth_sessions, we can assume that the user already inserted user & pass on consecutive auth_requests, but because we do not store MFA status on the session, consecutive auth requests will keep requesting the user to solve the MFA challenge.
Although this behavior might be expected on certain scenarios, there are applications where this is not expected, as if the user authenticated once, it is assumed to be trusted as long as that session exists.

Proposed Solution

To solve this, we can start persisting the MFA state/trust on the auth_session and reuse it for subsequent auth requests.

This would involve:

  • Extending auth_session to have some sort of MFACompleted value as boolean
  • When a new auth request is initiated and we detect an existing session, instead of prompting for MFA directly, we check if the auth session got a valid MFACompleted value
  • If true, we mark the auth_request with MFA validated and keep moving

To provide a way to enforce MFA check on each auth request, we should also give some way for this to be turned on/off, similar to:

session:
  reuseMFA: true

Alternatives Considered

The proposed solution assumes that we "trust" the mfa challenge completed for the time a session exists, which is also a limiting factor if the admin wants, for example, to configure a session to live for weeks, while still asking for MFA every 24 hours.

As an alternative to provide a more "complete" solution, we could also track "when" an MFA authenticator challenge was completed by doing something like:

type AuthSession struct {
  // ...
  MFACompleted map[string]time.Time // authenticator id -> completed at
}

This way we can give a configuration parameter like mfaMaxAge where we check if any of the MFACompleted challenges is still valid or if we need to re-prompt even when a session is still valid and active.

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions