Skip to content
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

Okta + Duo: Allow passcodes from mobile app #1222

Merged
merged 12 commits into from
Mar 7, 2024
Merged

Conversation

wlonkly
Copy link
Contributor

@wlonkly wlonkly commented Feb 24, 2024

Any Duo mobile app registered with Duo, usually for Duo Push, also has the capability to produce HOTP passcodes:

Duo Mobile app on iOS, showing HOTP code. Yes, I burned that code.

In the case where Duo Push is administratively disabled and Yubikeys (etc) are not provided, HOTP might be the only way for a user to perform Duo MFA. This is the case for us, which is preventing our non-Yubikey users from using saml2aws at all.

This change adds Passcode to the list of MFA possibilities whenever a phone1 is registered with Duo, to support using HOTP.


I debated between adding it like this, or adding another conditional to the option[value="token"] case -- let me know if that would be preferable. I also checked the other Duo-enabled providers, but none of the others use this kind of logic to limit the MFA options presented to the user.

Any Duo mobile app registered with Duo, usually for Duo Push, also
has the capability to produce HOTP passcodes. In the case where
Duo Push is administratively disabled and Yubikeys (etc) are not
provided, HOTP might be the only way for a user to perform Duo MFA.

This change adds Passcode to the list of MFA possibilities whenever a
phone1 is registered with Duo to support that situation.
Copy link
Contributor

@mapkon mapkon left a comment

Choose a reason for hiding this comment

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

Looks fine to me. @gliptak / @wolfeidau - any thoughts?

@codecov-commenter
Copy link

codecov-commenter commented Feb 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 41.92%. Comparing base (9a4c5b6) to head (22e706d).
Report is 32 commits behind head on master.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1222      +/-   ##
==========================================
+ Coverage   40.44%   41.92%   +1.48%     
==========================================
  Files          54       54              
  Lines        8276     6373    -1903     
==========================================
- Hits         3347     2672     -675     
+ Misses       4491     3265    -1226     
+ Partials      438      436       -2     
Flag Coverage Δ
unittests 41.92% <100.00%> (+1.48%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@gliptak
Copy link
Contributor

gliptak commented Feb 26, 2024

any related unit test updates?

@wlonkly
Copy link
Contributor Author

wlonkly commented Feb 26, 2024

any related unit test updates?

There was no test coverage of the option selection/presentation today so I didn't update the tests, but happy to add coverage (I think... I don't work in Go often and the current tests in TestVerifyMfa_Duo all focus on the request flow and simulating a push, so I could use a pointer in the right direction if possible!)

@gliptak
Copy link
Contributor

gliptak commented Feb 27, 2024

@wlonky yes, there seems to be coverage the modified code https://app.codecov.io/gh/Versent/saml2aws/blob/master/pkg%2Fprovider%2Fokta%2Fokta.go#L974

consider creating a copy of

func TestVerifyMfa_Duo(t *testing.T) {
and updating for 1Passcode` path (some processing could be shared between these two flows)

@wlonkly
Copy link
Contributor Author

wlonkly commented Feb 28, 2024

Got it, I'll see what I can do! Probably won't get to this until the weekend.

@wlonkly
Copy link
Contributor Author

wlonkly commented Mar 1, 2024

Ah, something's not right. I'll comment when this is good to go, sorry.

@wlonkly
Copy link
Contributor Author

wlonkly commented Mar 1, 2024

Sorted and ready to go!

verifyCounter := 0
statusCounter := 0
ts := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {

ts := httptest.NewTLSServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
Copy link
Contributor

Choose a reason for hiding this comment

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

this seems to have wrong indent

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ty, fixed

@mapkon
Copy link
Contributor

mapkon commented Mar 3, 2024

@gliptak Is this ready to merge?

@wlonkly
Copy link
Contributor Author

wlonkly commented Mar 4, 2024

Rats, I need to make one more change -- I just used my local build on my actual work Okta account, and I see duplicate "Passcode" options (because I have both token and phone1 authenticators; my test account only had phone1).

Copy link
Contributor

@mapkon mapkon left a comment

Choose a reason for hiding this comment

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

Moving back to needs work since there is an issue with Okta

@mapkon
Copy link
Contributor

mapkon commented Mar 4, 2024

Rats, I need to make one more change -- I just used my local build on my actual work Okta account, and I see duplicate "Passcode" options (because I have both token and phone1 authenticators; my test account only had phone1).

OK - just let me know when its ready

@wlonkly
Copy link
Contributor Author

wlonkly commented Mar 4, 2024

@mapkon Should be all set now. I switched around the logic to only add Passcode once, rather than uniq-ing it at the end. Duo makes no distinction between phone passcodes or token passcodes, so no need to distinguish; any passcode is valid.

@wlonkly wlonkly requested a review from mapkon March 7, 2024 00:07
@mapkon mapkon merged commit 0c98c07 into Versent:master Mar 7, 2024
8 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.

5 participants