Skip to content

Commit

Permalink
Stop JWT provider from being written in non default namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
roncodingenthusiast committed Jul 28, 2023
1 parent 449e050 commit b4ca14b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .changelog/PLACEHOLDER.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:bug
mesh: Stop jwt providers from being created in non-default namespaces
```
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.IsDefaultPartition(e.PartitionOrDefault()) {
return fmt.Errorf("Namespace are an enterprise only feature")
}

return nil
}

0 comments on commit b4ca14b

Please sign in to comment.