Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
auth
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
id
auth
Merge requests
!34
Draft: Webauthn
Code
Review changes
Check out branch
Download
Patches
Plain diff
Merged
Draft: Webauthn
webauthn
into
master
Overview
0
Commits
3
Pipelines
4
Changes
3
Merged
ale
requested to merge
webauthn
into
master
3 years ago
Overview
0
Commits
3
Pipelines
4
Changes
3
Expand
0
0
Merge request reports
Viewing commit
b836909e
Prev
Next
Show latest version
3 files
+
83
−
24
Inline
Compare changes
Side-by-side
Inline
Show whitespace changes
Show one file at a time
Files
3
Search (e.g. *.vue) (Ctrl+P)
b836909e
Add separate webauthn_registrations field to 'file' backend users
· b836909e
ale
authored
3 years ago
backend/file/file.go
+
32
−
6
Options
@@ -23,18 +23,29 @@ type fileUser struct {
TOTPSecret
string
`yaml:"totp_secret"`
Groups
[]
string
`yaml:"groups"`
//
WebAuthN/
U2F registrations are encoded in a similar format
//
as
the one produced by 'pamu2fcfg': the key
handle is
// base64-encoded (this is "websafe" base64, without
padding),
// the public key is hex encoded.
WebAuthn
Registrations
[]
struct
{
//
Legacy
U2F registrations are encoded in a similar format
as
// the one produced by
old versions of
'pamu2fcfg': the key
//
handle is
base64-encoded (this is "websafe" base64, without
//
padding),
the public key is hex encoded.
U2F
Registrations
[]
struct
{
KeyHandle
string
`yaml:"key_handle"`
PublicKey
string
`yaml:"public_key"`
Comment
string
`yaml:"comment"`
}
`yaml:"u2f_registrations"`
// WebAuthN registrations are encoded as emitted by modern
// versions of pamu2fcfg: both values are base64-encoded
// (standard, with padding). The key is actually in COSE format.
WebAuthNRegistrations
[]
struct
{
KeyHandle
string
`yaml:"key_handle"`
PublicKey
string
`yaml:"public_key"`
Comment
string
`yaml:"comment"`
}
`yaml:"webauthn_registrations"`
AppSpecificPasswords
[]
struct
{
Service
string
`yaml:"service"`
EncryptedPassword
string
`yaml:"password"`
Comment
string
`yaml:"comment"`
}
`yaml:"app_specific_passwords"`
}
@@ -55,8 +66,23 @@ func (f *fileUser) toUser(filename string) *backend.User {
})
}
for
_
,
r
:=
range
f
.
WebAuth
n
Registrations
{
for
_
,
r
:=
range
f
.
WebAuth
N
Registrations
{
reg
,
err
:=
ct
.
ParseU2FRegistrationFromStrings
(
r
.
KeyHandle
,
r
.
PublicKey
)
if
err
!=
nil
{
log
.
Printf
(
"warning: %s: user %s: could not decode WebAuthN registration: %v"
,
filename
,
f
.
Name
,
err
)
continue
}
cred
,
err
:=
reg
.
Decode
()
if
err
!=
nil
{
log
.
Printf
(
"warning: %s: user %s: could not decode WebAuthN registration: %v"
,
filename
,
f
.
Name
,
err
)
continue
}
u
.
WebAuthnRegistrations
=
append
(
u
.
WebAuthnRegistrations
,
cred
)
}
for
_
,
r
:=
range
f
.
U2FRegistrations
{
reg
,
err
:=
ct
.
ParseLegacyU2FRegistrationFromStrings
(
r
.
KeyHandle
,
r
.
PublicKey
)
if
err
!=
nil
{
log
.
Printf
(
"warning: %s: user %s: could not decode U2F registration: %v"
,
filename
,
f
.
Name
,
err
)
continue
Loading