Skip to content

Use second_factors for logic instead of deprecated second_factor.#47426

Merged
Joerger merged 10 commits intomasterfrom
joerger/use-second-factors
Oct 16, 2024
Merged

Use second_factors for logic instead of deprecated second_factor.#47426
Joerger merged 10 commits intomasterfrom
joerger/use-second-factors

Conversation

@Joerger
Copy link
Copy Markdown
Contributor

@Joerger Joerger commented Oct 10, 2024

This PR does not introduce any functional changes.

Follow up to #47233 to use the second factor helper methods for second factor logic, instead of using second_factor directly. This makes it so the server logic can function as expected whether the user sets the deprecated second_factor field or the new second_factors field in their auth preference.

The only remaining direct uses of second_factor are in tests and the proxy ping response for second_factor.

Helpers used:

  • cap.IsSecondFactorEnabled
  • cap.IsSecondFactorEnforced
  • cap.IsSecondFactorTOTPAllowed
  • cap.IsSecondFactorWebauthnAllowed
  • cap.IsSecondFactorSSOAllowed

This updated logic should be easier to read as well, so I hope this PR isn't too terribly difficult to review. Getting this in before the v17 test plan should also ease some concern.

Depends on #47233

@Joerger Joerger changed the base branch from master to joerger/add-second-factors October 10, 2024 02:08
@github-actions
Copy link
Copy Markdown
Contributor

🤖 Vercel preview here: https://docs-5lcqvjwq2-goteleport.vercel.app/docs/ver/preview

@Joerger Joerger mentioned this pull request Oct 10, 2024
@Joerger Joerger added the no-changelog Indicates that a PR does not require a changelog entry label Oct 10, 2024
@Joerger Joerger force-pushed the joerger/add-second-factors branch from 07c1201 to 3dafdec Compare October 10, 2024 18:34
@Joerger Joerger force-pushed the joerger/use-second-factors branch 3 times, most recently from 8de6ebb to ed14fdc Compare October 10, 2024 22:01
@Joerger Joerger force-pushed the joerger/use-second-factors branch from ed14fdc to d00fd0e Compare October 10, 2024 22:09
@Joerger Joerger force-pushed the joerger/add-second-factors branch from 4f4e9dd to 5e2c711 Compare October 10, 2024 23:30
Base automatically changed from joerger/add-second-factors to master October 11, 2024 00:35
@Joerger Joerger force-pushed the joerger/use-second-factors branch from d00fd0e to b0d55c2 Compare October 11, 2024 20:01
@Joerger Joerger marked this pull request as ready for review October 11, 2024 20:20
@github-actions github-actions Bot added size/sm tctl tctl - Teleport admin tool labels Oct 11, 2024
@Joerger Joerger force-pushed the joerger/use-second-factors branch from bb99e06 to 9bbd5af Compare October 11, 2024 20:24
@Joerger
Copy link
Copy Markdown
Contributor Author

Joerger commented Oct 11, 2024

In this commit b0d55c2 I fixed some issues with the logic around deleting your last mfa device or passkey.

IMO the updated logic is simple enough to include in this PR, especially since the fix comes as a direct result from the new helpers and simplified second factors handling. Would be good to have @codingllama's or @bl-nero's approval.

@Joerger Joerger force-pushed the joerger/use-second-factors branch 2 times, most recently from 2bc96f1 to d4536b2 Compare October 11, 2024 23:36
@Joerger Joerger force-pushed the joerger/use-second-factors branch from d4536b2 to 8ce6e31 Compare October 12, 2024 01:41
Comment thread lib/auth/methods.go
Copy link
Copy Markdown
Contributor

@codingllama codingllama left a comment

Choose a reason for hiding this comment

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

Could we update the PR title and description so both are more descriptive of the changes done here?

Comment thread api/types/authentication.go
Comment thread api/types/second_factor.go Outdated
Comment thread lib/auth/auth.go Outdated
Comment thread lib/auth/auth.go Outdated
Comment thread lib/auth/grpcserver_test.go
Comment thread lib/auth/methods.go Outdated
Comment thread lib/web/apiserver.go Outdated
Comment thread lib/web/apiserver.go Outdated
Comment thread lib/web/apiserver.go Outdated
Comment thread lib/web/apiserver.go Outdated
@Joerger Joerger changed the title Add second_factors - Follow up Use second_factors for second factor logic instead of deprecated second_factor. Oct 15, 2024
@Joerger Joerger changed the title Use second_factors for second factor logic instead of deprecated second_factor. Use second_factors for logic instead of deprecated second_factor. Oct 15, 2024
@Joerger Joerger requested a review from codingllama October 15, 2024 18:35
Comment thread api/types/second_factor.go
Comment thread api/types/second_factor.go
Comment thread lib/auth/grpcserver_test.go
Comment thread lib/auth/grpcserver_test.go
Comment thread lib/auth/auth.go Outdated
@Joerger Joerger requested a review from codingllama October 16, 2024 17:29
@Joerger Joerger added this pull request to the merge queue Oct 16, 2024
Merged via the queue into master with commit 73d0daf Oct 16, 2024
@Joerger Joerger deleted the joerger/use-second-factors branch October 16, 2024 19:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-changelog Indicates that a PR does not require a changelog entry size/sm tctl tctl - Teleport admin tool

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants