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

Yet Another Trusted Device PR #1039

Merged
merged 20 commits into from
May 7, 2023
Merged

Conversation

lizduty
Copy link
Contributor

@lizduty lizduty commented May 4, 2023

Basically just rebased #1027 and fixed the tests

@@ -1236,3 +1381,214 @@ func fidoWebAuthn(oc *Client, oktaOrgHost string, challengeContext *mfaChallenge

return gjson.GetBytes(body, "sessionToken").String(), nil
}

func verifyTrustedCert(oc *Client, doc *goquery.Document, duoHost string, duoSubmitURL string, q url.Values) (*goquery.Document, error) {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is the same as the existing PR, just broken out into helper functions to make testing easier

q.Add("parent", fmt.Sprintf("https://%s/signin/verify/duo/web", host))
q.Add("v", "2.8")

fakeForm := fmt.Sprintf(`
Copy link
Contributor Author

Choose a reason for hiding this comment

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

originally this was a constant, but it needs the http server address and it's only available at runtime


// anonymised from actual endpoint
const fakeEndpointForm = `
<form method="post" id="endpoint-health-form">
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I copied this out of dev tools and changed all the PII, so it's reasonably accurate

parent, _ := doc.Find("input[name=\"parent\"]").Attr("value")
duoAppUrl, _ := doc.Find("input[name=\"duo_app_url\"]").Attr("value")
ehDownloadLink, _ := doc.Find("input[name=\"eh_download_link\"]").Attr("value")
// isSilentCollection, _ := doc.Find("input[name=\"is_silent_collection\"]").Attr("value")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this wasn't present in my debug session and seems to not be necessary

Copy link
Contributor

Choose a reason for hiding this comment

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

Can you remove it it? Commented out code is dead code

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.

Please add tests to this. Thanks

@lizduty
Copy link
Contributor Author

lizduty commented May 5, 2023

Please add tests to this. Thanks

there's tests for the two helper functions introduced. Did you mean for the U2F flow as well?

@lizduty
Copy link
Contributor Author

lizduty commented May 5, 2023

@mapkon please let me know if there's any other tests you'd like

@mapkon
Copy link
Contributor

mapkon commented May 6, 2023

Thanks @lizduty I think we should wait for the code-coverage report.

@gliptak Do you know why it is not showing up on this?

@codecov-commenter
Copy link

Codecov Report

Merging #1039 (8905d45) into master (68d09f2) will increase coverage by 0.80%.
The diff coverage is 50.87%.

📣 This organization is not using Codecov’s GitHub App Integration. We recommend you install it so Codecov can continue to function properly for your repositories. Learn more

@@            Coverage Diff             @@
##           master    #1039      +/-   ##
==========================================
+ Coverage   36.40%   37.20%   +0.80%     
==========================================
  Files          52       53       +1     
  Lines        7546     7926     +380     
==========================================
+ Hits         2747     2949     +202     
- Misses       4415     4580     +165     
- Partials      384      397      +13     
Flag Coverage Δ
unittests 37.20% <50.87%> (+0.80%) ⬆️

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

Impacted Files Coverage Δ
pkg/provider/okta/okta.go 21.68% <44.41%> (+8.63%) ⬆️
pkg/provider/okta/okta_duo_u2f.go 80.88% <80.88%> (ø)
pkg/provider/okta/okta_webauthn.go 54.02% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@mapkon
Copy link
Contributor

mapkon commented May 6, 2023

@gliptak Got it. Please ignore my previous comment

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