mirror of
https://github.com/pomerium/pomerium.git
synced 2025-06-03 11:22:45 +02:00
Protect Options from being mutated by services
- Change Options URLs from pointers to values - Remove special handling for AuthenticateURL checksum - Change Options itself to a value
This commit is contained in:
parent
49bc8274f1
commit
64eb992854
12 changed files with 117 additions and 125 deletions
|
@ -22,14 +22,14 @@ func TestNew(t *testing.T) {
|
|||
{"bad shared secret", "AZA85podM73CjLCjViDNz1EUvvejKpWp7Hysr0knXA==", policies, true},
|
||||
{"really bad shared secret", "sup", policies, true},
|
||||
{"validation error, short secret", "AZA85podM73CjLCjViDNz1EUvvejKpWp7Hysr0knXA==", policies, true},
|
||||
{"nil options", "", []policy.Policy{}, true}, // special case
|
||||
{"empty options", "", []policy.Policy{}, true}, // special case
|
||||
{"missing policies", "gXK6ggrlIW2HyKyUF9rUO4azrDgxhDPWqw9y+lJU7B8=", []policy.Policy{}, true}, // special case
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
o := &config.Options{SharedKey: tt.SharedKey, Policies: tt.Policies}
|
||||
if tt.name == "nil options" {
|
||||
o = nil
|
||||
o := config.Options{SharedKey: tt.SharedKey, Policies: tt.Policies}
|
||||
if tt.name == "empty options" {
|
||||
o = config.Options{}
|
||||
}
|
||||
_, err := New(o)
|
||||
if (err != nil) != tt.wantErr {
|
||||
|
@ -76,7 +76,7 @@ func Test_UpdateOptions(t *testing.T) {
|
|||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
o := &config.Options{SharedKey: tt.SharedKey, Policies: tt.Policies}
|
||||
o := config.Options{SharedKey: tt.SharedKey, Policies: tt.Policies}
|
||||
authorize, _ := New(o)
|
||||
o.Policies = tt.newPolices
|
||||
authorize.UpdateOptions(o)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue