mirror of
https://github.com/pomerium/pomerium.git
synced 2025-07-02 09:28:09 +02:00
webauthn: only return known device credentials that match the given type
This commit is contained in:
parent
f2a5bda162
commit
b966264cfd
2 changed files with 9 additions and 2 deletions
|
@ -12,6 +12,7 @@ import (
|
|||
"github.com/pomerium/pomerium/pkg/cryptutil"
|
||||
"github.com/pomerium/pomerium/pkg/grpc/device"
|
||||
"github.com/pomerium/pomerium/pkg/grpc/user"
|
||||
"github.com/pomerium/pomerium/pkg/slices"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -156,7 +157,10 @@ func newRequestOptions(
|
|||
options,
|
||||
deviceType.GetWebauthn().GetOptions().GetAuthenticatorSelection().UserVerification,
|
||||
)
|
||||
for _, knownDeviceCredential := range knownDeviceCredentials {
|
||||
knownDeviceCredentialsForType := slices.Filter(knownDeviceCredentials, func(c *device.Credential) bool {
|
||||
return c.GetTypeId() == deviceType.GetId()
|
||||
})
|
||||
for _, knownDeviceCredential := range knownDeviceCredentialsForType {
|
||||
if publicKey := knownDeviceCredential.GetWebauthn(); publicKey != nil {
|
||||
options.AllowCredentials = append(options.AllowCredentials, webauthn.PublicKeyCredentialDescriptor{
|
||||
Type: webauthn.PublicKeyCredentialTypePublicKey,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue