Skip to content

Commit

Permalink
Warn about origin vs RPID mismatch
Browse files Browse the repository at this point in the history
  • Loading branch information
codingllama committed Jun 21, 2022
1 parent 41317c5 commit 2981913
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/auth/webauthncli/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package webauthncli
import (
"context"
"errors"
"strings"

"github.com/gravitational/teleport/api/client/proto"
"github.com/gravitational/teleport/lib/auth/touchid"
Expand Down Expand Up @@ -67,6 +68,17 @@ func Login(
ctx context.Context,
origin string, assertion *wanlib.CredentialAssertion, prompt LoginPrompt, opts *LoginOpts,
) (*proto.MFAAuthenticateResponse, string, error) {
// origin vs RPID sanity check.
// Doesn't necessarily means a failure, but it's likely to be one.
switch rpID := assertion.Response.RelyingPartyID; {
case origin == "", assertion == nil: // let downstream handle empty/nil
case !strings.HasPrefix(origin, "https://"+rpID):
log.Warnf(""+
"WebAuthn: origin and RPID mismatch, "+
"if you are having authentication problems double check your proxy address "+
"(%q vs %q)", origin, rpID)
}

var attachment AuthenticatorAttachment
var user string
if opts != nil {
Expand Down

0 comments on commit 2981913

Please sign in to comment.