mirror of
https://github.com/optim-enterprises-bv/vault.git
synced 2025-10-29 17:52:32 +00:00
bug(20562): allowed_domains are compared case-sensitive if they use g… (#22126)
* bug(20562): allowed_domains are compared case-sensitive if they use glob patterns * bug(20562): review fixes
This commit is contained in:
@@ -659,7 +659,7 @@ func validateNames(b *backend, data *inputBundle, names []string) string {
|
||||
|
||||
if data.role.AllowGlobDomains &&
|
||||
strings.Contains(currDomain, "*") &&
|
||||
glob.Glob(currDomain, name) {
|
||||
glob.Glob(strings.ToLower(currDomain), strings.ToLower(name)) {
|
||||
valid = true
|
||||
break
|
||||
}
|
||||
|
||||
@@ -174,6 +174,24 @@ func TestPki_PermitFQDNs(t *testing.T) {
|
||||
expectedDnsNames: []string{"Example.Net", "eXaMPLe.COM"},
|
||||
expectedEmails: []string{},
|
||||
},
|
||||
"case insensitivity subdomain validation": {
|
||||
input: &inputBundle{
|
||||
apiData: &framework.FieldData{
|
||||
Schema: fields,
|
||||
Raw: map[string]interface{}{
|
||||
"common_name": "SUB.EXAMPLE.COM",
|
||||
"ttl": 3600,
|
||||
},
|
||||
},
|
||||
role: &roleEntry{
|
||||
AllowedDomains: []string{"example.com", "*.Example.com"},
|
||||
AllowGlobDomains: true,
|
||||
MaxTTL: 3600,
|
||||
},
|
||||
},
|
||||
expectedDnsNames: []string{"SUB.EXAMPLE.COM"},
|
||||
expectedEmails: []string{},
|
||||
},
|
||||
"case email as AllowedDomain with bare domains": {
|
||||
input: &inputBundle{
|
||||
apiData: &framework.FieldData{
|
||||
|
||||
3
changelog/22126.txt
Normal file
3
changelog/22126.txt
Normal file
@@ -0,0 +1,3 @@
|
||||
```release-note:bug
|
||||
secrets/pki: allowed_domains are now compared in a case-insensitive manner if they use glob patterns
|
||||
```
|
||||
Reference in New Issue
Block a user