Skip to content

Initial multi-factor auth functionality (#1521) - #616

Merged
abeverley merged 9 commits into
devfrom
1521_mfa
Aug 18, 2026
Merged

Initial multi-factor auth functionality (#1521)#616
abeverley merged 9 commits into
devfrom
1521_mfa

Conversation

@abeverley

Copy link
Copy Markdown
Contributor

Still requires:

  • Front-end configuration of user's MFA and site-wide policy
  • Ability for an admin to reset a user's MFA (use reset_mfa())

abeverley added 4 commits May 6, 2026 10:37
Still requires:

* Front-end configuration of user's MFA and site-wide policy
* Ability for an admin to reset a user's MFA (use reset_mfa())

@pwlodarski-ctrlo pwlodarski-ctrlo left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR has been reviewed, suggestions provided outside of Github which have been actioned.

All good and ready for initial testing!

@pwlodarski-ctrlo pwlodarski-ctrlo left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR reviewed - couple comments added.

Comment thread lib/GADS/MFA.pm
{
my $mfa_cookie = cookie 'MFATOKEN';
# MFA needed before access?
redirect '/mfa' if request->uri !~ m!^/(mfa|logout)$!

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should the / delimiter have an \ escape before it?

Comment thread lib/GADS/MFA.pm
warning "The authentication token has already been used in the last 5 minutes, possibly an attacker?"
if $user->mfa_token_previous && $user->mfa_token_previous eq $token
&& $user->mfa_token_previous_used->clone->add(minutes => 5) > DateTime->now;
# Allow a token to be reused. Generate a random token and

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't believe we wish to make the tokens reusable.

Comment thread lib/GADS/MFA.pm Outdated

sub _refresh_recent_mfa_cookie
{ my $key = shift;
cookie MFATOKEN => $key, expires => '7d', secure => 1, http_only => 1;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HTTP isn't a secure means, do we need the http_only flag?

Because the MFA cookie is now renewed every page render, it is possible
that a user only using the system weekly will never need to authenticate
with MFA. Reduce the time to 2 days to ensure weekly MFA if not logging
in at the weekend.
@abeverley
abeverley merged commit 6637c87 into dev Aug 18, 2026
3 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants