Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
D
dex
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
dex
Commits
2853ac71
Commit
2853ac71
authored
Dec 17, 2015
by
bobbyrullo
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #215 from ericchiang/fix_panic
cmd, db: verify at least one secret is passed to --key-secrets
parents
dddc4c12
49389c9b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
1 deletion
+15
-1
main.go
cmd/dex-overlord/main.go
+4
-0
main.go
cmd/dex-worker/main.go
+3
-0
key.go
db/key.go
+3
-0
key_test.go
db/key_test.go
+5
-1
No files found.
cmd/dex-overlord/main.go
View file @
2853ac71
...
@@ -72,6 +72,10 @@ func main() {
...
@@ -72,6 +72,10 @@ func main() {
log
.
Fatalf
(
"Unable to use --admin-listen flag: %v"
,
err
)
log
.
Fatalf
(
"Unable to use --admin-listen flag: %v"
,
err
)
}
}
if
len
(
keySecrets
.
BytesSlice
())
==
0
{
log
.
Fatalf
(
"Must specify at least one key secret"
)
}
dbCfg
:=
db
.
Config
{
dbCfg
:=
db
.
Config
{
DSN
:
*
dbURL
,
DSN
:
*
dbURL
,
MaxIdleConnections
:
1
,
MaxIdleConnections
:
1
,
...
...
cmd/dex-worker/main.go
View file @
2853ac71
...
@@ -135,6 +135,9 @@ func main() {
...
@@ -135,6 +135,9 @@ func main() {
UsersFile
:
*
users
,
UsersFile
:
*
users
,
}
}
}
else
{
}
else
{
if
len
(
keySecrets
.
BytesSlice
())
==
0
{
log
.
Fatalf
(
"Must specify at least one key secret"
)
}
if
*
dbMaxIdleConns
==
0
{
if
*
dbMaxIdleConns
==
0
{
log
.
Warning
(
"Running with no limit on: database idle connections"
)
log
.
Warning
(
"Running with no limit on: database idle connections"
)
}
}
...
...
db/key.go
View file @
2853ac71
...
@@ -90,6 +90,9 @@ type privateKeySetBlob struct {
...
@@ -90,6 +90,9 @@ type privateKeySetBlob struct {
}
}
func
NewPrivateKeySetRepo
(
dbm
*
gorp
.
DbMap
,
useOldFormat
bool
,
secrets
...
[]
byte
)
(
*
PrivateKeySetRepo
,
error
)
{
func
NewPrivateKeySetRepo
(
dbm
*
gorp
.
DbMap
,
useOldFormat
bool
,
secrets
...
[]
byte
)
(
*
PrivateKeySetRepo
,
error
)
{
if
len
(
secrets
)
==
0
{
return
nil
,
errors
.
New
(
"must provide at least one key secret"
)
}
for
i
,
secret
:=
range
secrets
{
for
i
,
secret
:=
range
secrets
{
if
len
(
secret
)
!=
32
{
if
len
(
secret
)
!=
32
{
return
nil
,
fmt
.
Errorf
(
"key secret %d: expected 32-byte secret"
,
i
)
return
nil
,
fmt
.
Errorf
(
"key secret %d: expected 32-byte secret"
,
i
)
...
...
db/key_test.go
View file @
2853ac71
...
@@ -7,6 +7,10 @@ import (
...
@@ -7,6 +7,10 @@ import (
func
TestNewPrivateKeySetRepoInvalidKey
(
t
*
testing
.
T
)
{
func
TestNewPrivateKeySetRepoInvalidKey
(
t
*
testing
.
T
)
{
_
,
err
:=
NewPrivateKeySetRepo
(
nil
,
false
,
[]
byte
(
"sharks"
))
_
,
err
:=
NewPrivateKeySetRepo
(
nil
,
false
,
[]
byte
(
"sharks"
))
if
err
==
nil
{
if
err
==
nil
{
t
.
Fatalf
(
"Expected non-nil error"
)
t
.
Errorf
(
"Expected non-nil error for key secret that was not 32 bytes"
)
}
_
,
err
=
NewPrivateKeySetRepo
(
nil
,
false
)
if
err
==
nil
{
t
.
Fatalf
(
"Expected non-nil error when creating repo with no key secrets"
)
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment