Skip to content

Commit

Permalink
Stop JWT provider from being written in non default namespace (#18325)
Browse files Browse the repository at this point in the history
  • Loading branch information
roncodingenthusiast authored Jul 31, 2023
1 parent 6ada2e0 commit 356b29b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .changelog/18325.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
mesh: **(Enterprise Only)** Require that `jwt-provider` config entries are created in the `default` namespace.
```
2 changes: 1 addition & 1 deletion agent/structs/config_entry_jwt_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ func (e *JWTProviderConfigEntry) Validate() error {
return err
}

if err := e.validatePartition(); err != nil {
if err := e.validatePartitionAndNamespace(); err != nil {
return err
}

Expand Down
7 changes: 6 additions & 1 deletion agent/structs/config_entry_jwt_provider_oss.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,14 @@ import (
"github.com/hashicorp/consul/acl"
)

func (e *JWTProviderConfigEntry) validatePartition() error {
func (e *JWTProviderConfigEntry) validatePartitionAndNamespace() error {
if !acl.IsDefaultPartition(e.PartitionOrDefault()) {
return fmt.Errorf("Partitions are an enterprise only feature")
}

if acl.DefaultNamespaceName != e.NamespaceOrDefault() {
return fmt.Errorf("Namespaces are an enterprise only feature")
}

return nil
}

0 comments on commit 356b29b

Please sign in to comment.