diff --git a/consul/acl_endpoint.go b/consul/acl_endpoint.go index 4c49f189a..eb6d4b20a 100644 --- a/consul/acl_endpoint.go +++ b/consul/acl_endpoint.go @@ -2,9 +2,11 @@ package consul import ( "fmt" - "github.com/armon/go-metrics" - "github.com/hashicorp/consul/consul/structs" "time" + + "github.com/armon/go-metrics" + "github.com/hashicorp/consul/acl" + "github.com/hashicorp/consul/consul/structs" ) // ACL endpoint is used to manipulate ACLs @@ -30,8 +32,11 @@ func (a *ACL) Apply(args *structs.ACLRequest, reply *string) error { return fmt.Errorf("Invalid ACL Type") } - // TODO: Validate the rules compile - // + // Validate the rules compile + _, err := acl.Parse(args.ACL.Rules) + if err != nil { + return fmt.Errorf("ACL rule compilation failed: %v", err) + } case structs.ACLDelete: if args.ACL.ID == "" {