Skip to content

Commit

Permalink
Disallow * as service-defaults name (#10069)
Browse files Browse the repository at this point in the history
  • Loading branch information
freddygv authored and hashicorp-ci committed Apr 19, 2021
1 parent 1950aa7 commit 8314f17
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .changelog/10069.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:breaking-change
connect: Disallow wildcard as name for service-defaults.
```
3 changes: 3 additions & 0 deletions agent/structs/config_entry.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ func (e *ServiceConfigEntry) Validate() error {
if e.Name == "" {
return fmt.Errorf("Name is required")
}
if e.Name == WildcardSpecifier {
return fmt.Errorf("service-defaults name must be the name of a service, and not a wildcard")
}

validationErr := validateConfigEntryMeta(e.Meta)

Expand Down
7 changes: 7 additions & 0 deletions agent/structs/config_entry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1699,6 +1699,13 @@ func TestServiceConfigEntry_Validate(t *testing.T) {
expect *ServiceConfigEntry
expectErr string
}{
{
name: "wildcard name is not allowed",
input: &ServiceConfigEntry{
Name: WildcardSpecifier,
},
expectErr: `must be the name of a service, and not a wildcard`,
},
{
name: "upstream config override no name",
input: &ServiceConfigEntry{
Expand Down

0 comments on commit 8314f17

Please sign in to comment.