authorize: fix custom rego panic (#2226)

* fix custom rego panic

* fix type cast
This commit is contained in:
Caleb Doxsey 2021-05-21 08:21:22 -06:00 committed by GitHub
parent cc4c400140
commit 897e7202bb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 48 additions and 20 deletions

View file

@ -53,4 +53,17 @@ func TestCustomEvaluator(t *testing.T) {
}
assert.NotNil(t, res)
})
t.Run("invalid package", func(t *testing.T) {
ce := NewCustomEvaluator(store)
res, err := ce.Evaluate(ctx, &CustomEvaluatorRequest{
RegoPolicy: `package custom_ext_authz.rego
allow {
true
}`,
})
if !assert.NoError(t, err) {
return
}
assert.NotNil(t, res)
})
}