[Browser MFA] Add CompleteBrowserMFAChallenge gRPC#63873
Conversation
d516d0c to
9075cce
Compare
codingllama
left a comment
There was a problem hiding this comment.
Reviewed a good chunk of it, but not all.
As stated in the proto PR, I think the RPC could be in the specialized MFAService instead.
This could also, potentially, be split into a few distinct smaller PRs: lib/webauthn changes, browser MFA encrypt/decrypt, and the RPC itself. Once we add tests in various layers it'll likely grow.
2d299c0 to
5b450e8
Compare
|
Apologies @codingllama, your comments have lost their context since I split out the webauthn changes |
No worries, give me a ping when this is good for another pass. |
6a05b78 to
a1f454e
Compare
Cheers, @codingllama, I think this is ready for another pass. I shouldn't have pointed the browser-mfa-webauthn-validation branch at master because this branch, which relies on those changes, also relies on the proto changes. So, I've pointed this branch at the proto branch and once that goes in, I can point this one back at browser-mfa-webauthn-validation. |
2a10623 to
000dd03
Compare
e08f5d2 to
55869d8
Compare
Joerger
left a comment
There was a problem hiding this comment.
Partial review here.
I wonder if it is worth validating the MFA response from the browser before sending it back to tsh where it will then send the MFA response back to the server where it will have to be validated again anyway?
Agreed, I don't think it is necessary to validate it ahead of time. Perhaps it would be better to remove the validation and name it CompleteBrowserMFAChallenge instead. It doesn't hurt to validate it upfront, but I don't remember a technical/security requirement for it.
8ea0de0 to
0cb377a
Compare
0cb377a to
8a5561b
Compare
000dd03 to
9284a34
Compare
b7ec9db to
82e1d3b
Compare
There was a problem hiding this comment.
Would something like CLILoginResponse be a better name for this?
| // You should have received a copy of the GNU Affero General Public License | ||
| // along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
|
||
| package internal |
There was a problem hiding this comment.
Internal packages (ie those that are under an internal/ directory) are great, but I don't love naming the package itself internal.
How about lib/auth/internal/browsermfa? Something that still describes what the package contains.
| ) | ||
|
|
||
| // Payload type required by (lib/client/sso/redirector.go). | ||
| type ssoRedirectorResponse = authclient.SSHLoginResponse |
There was a problem hiding this comment.
Is there any particular reason to make this a type alias? Why not use authclient.SSHLoginResponse directly?
There was a problem hiding this comment.
There's a conversation somewhere in this PR (that I can't seem to find now), where Alan found it confusing that Browser MFA returns an SSHLoginResponse. So the type alias is to make the code easier to understand that we're returning this data to the redirector
| tests := []struct { | ||
| name string | ||
| setupSession func(t *testing.T) string | ||
| assertError func(t *testing.T, err error) |
There was a problem hiding this comment.
| assertError func(t *testing.T, err error) | |
| assertError require.ErrorAssertionFunc |
Consider using the existing library type instead of defining your own.
f533310 to
823277e
Compare
1f76179 to
1f9c073
Compare
|
@danielashare See the table below for backport results.
|
[Browser MFA] Add protobuf and config (#63831) [Browser MFA] Add proto for Browser MFA feature (#64048) [Browser MFA] Add CompleteBrowserMFAChallenge gRPC (#63873) [Browser MFA] Rename browser mfa config name (#64980) [Browser MFA] Add BrowserMFARequestID to CreateAuthenticateChallenge (#63945) [Browser MFA] Add Browser MFA to challenge request flow (#63936) [Browser MFA] Add initial requests for browser MFA process to client tools (#64301) [Browser MFA] Add tsh callback handling for webauthn response (#64461) [Browser MFA] Add Browser MFA to presence checks (#65052) [Browser MFA] Add browser MFA path to MFA finish flow (#64523) [Browser MFA] Add Browser MFA to Connect (#64887) [Browser MFA] Add Browser MFA UI (#64692) [Browser MFA] Fix formatting in moderated sessions (#65236) [Browser MFA] Add Browser MFA ceremony tests
[Browser MFA] Add protobuf and config (gravitational#63831) [Browser MFA] Add proto for Browser MFA feature (gravitational#64048) [Browser MFA] Add CompleteBrowserMFAChallenge gRPC (gravitational#63873) [Browser MFA] Rename browser mfa config name (gravitational#64980) [Browser MFA] Add BrowserMFARequestID to CreateAuthenticateChallenge (gravitational#63945) [Browser MFA] Add Browser MFA to challenge request flow (gravitational#63936) [Browser MFA] Add initial requests for browser MFA process to client tools (gravitational#64301) [Browser MFA] Add tsh callback handling for webauthn response (gravitational#64461) [Browser MFA] Add Browser MFA to presence checks (gravitational#65052) [Browser MFA] Add browser MFA path to MFA finish flow (gravitational#64523) [Browser MFA] Add Browser MFA to Connect (gravitational#64887) [Browser MFA] Add Browser MFA UI (gravitational#64692) [Browser MFA] Fix formatting in moderated sessions (gravitational#65236) [Browser MFA] Add Browser MFA ceremony tests
This PR adds the CompleteBrowserMFAChallenge gRPC endpoint. The RFD for this addition can be found here.
These changes address this part of the flow:
sequenceDiagram proxy->>auth: rpc CompleteBrowserMFAChallenge auth->>auth: Encrypt WebAuthn response<br/>with secret_key auth-->>proxy: Return http://127.0.0.1:port/callback?response={encrypted_webauthn} proxy-->>browser: HTTP 200 with redirect URLI would like to draw particular attention tologin.go. In order to validate the WebAuthn response from the browser without consuming it, I had to split the validation logic out oflogin.go'sfinishfunction in to its own function. I want to avoid consuming it because in the full Browser MFA flow, the WebAuthn response is returned totshwhere it will exchange the response for certificates etc. I wonder if it is worth validating the MFA response from the browser before sending it back totshwhere it will then send the MFA response back to the server where it will have to be validated again anyway?Decided in comments that there isn't any point double validating the response, instead response is validated once by
tsh.Manual tests: