./opa run --server --log-level debug policy.rego
{"current_version":"0.58.0","level":"debug","msg":"OPA is up to date.","time":"2023-11-03T10:32:03+01:00"}
This is basic policy:
package test
import future.keywords.contains
import future.keywords.every
import future.keywords.if
import future.keywords.in
default allow := false
allow if {
bt = {tag | tag := input.book.tags[_]}
ut = {tag | tag := input.user.tags[_]}
bt & ut == bt
}
and query:
curl -d '{"query":"data.test.allow == true","input":{"user":{"tags":["1","3","3"]},"book":{"tags":["1","3"]}},"unknowns":["input.book"]}' localhost:8181/v1/compile?pretty=true
curl: (52) Empty reply from server
This is basic policy:
and query:
Click me for crash stacktrace
```bash ./opa run --server --log-level debug test.rego {"addrs":[":8181"],"diagnostic-addrs":[],"level":"info","msg":"Initializing server. OPA is running on a public (0.0.0.0) network interface. Unless you intend to expose OPA outside of the host, binding to the localhost interface (--addr localhost:8181) is recommended. See https://www.openpolicyagent.org/docs/latest/security/#interface-binding","time":"2023-11-23T13:08:18+01:00"} {"level":"debug","msg":"maxprocs: Leaving GOMAXPROCS=20: CPU quota undefined","time":"2023-11-23T13:08:18+01:00"} {"level":"debug","msg":"Server initialized.","time":"2023-11-23T13:08:18+01:00"} {"headers":{"Content-Type":["application/json"],"User-Agent":["Open Policy Agent/0.58.0 (linux, amd64)"]},"level":"debug","method":"POST","msg":"Sending request.","time":"2023-11-23T13:08:18+01:00","url":"https://telemetry.openpolicyagent.org/v1/version"} {"headers":{"Content-Length":["216"],"Content-Type":["application/json"],"Date":["Thu, 23 Nov 2023 12:08:19 GMT"]},"level":"debug","method":"POST","msg":"Received response.","status":"200 OK","time":"2023-11-23T13:08:19+01:00","url":"https://telemetry.openpolicyagent.org/v1/version"} {"current_version":"0.58.0","level":"debug","msg":"OPA is up to date.","time":"2023-11-23T13:08:19+01:00"} {"client_addr":"127.0.0.1:50862","level":"info","msg":"Received request.","req_body":"{\"query\":\"data.test.allow == true\",\"input\":{\"user\":{\"tags\":[\"1\",\"3\",\"3\"]},\"book\":{\"tags\":[\"1\",\"3\"]}},\"unknowns\":[\"input.book\"]}","req_id":1,"req_method":"POST","req_params":{"pretty":["true"]},"req_path":"/v1/compile","time":"2023-11-23T13:09:30+01:00"} runtime: goroutine stack exceeds 1000000000-byte limit runtime: sp=0xc020682390 stack=[0xc020682000, 0xc040682000] fatal error: stack overflow runtime stack: runtime.throw({0x1c1cb5e?, 0x20?}) /usr/local/go/src/runtime/panic.go:1077 +0x5c fp=0x7fe8b97f9720 sp=0x7fe8b97f96f0 pc=0x48d07c runtime.newstack() /usr/local/go/src/runtime/stack.go:1107 +0x5ac fp=0x7fe8b97f98d0 sp=0x7fe8b97f9720 pc=0x4a78ec traceback: unexpected SPWRITE function runtime.morestack runtime.morestack() /usr/local/go/src/runtime/asm_amd64.s:593 +0x8f fp=0x7fe8b97f98d8 sp=0x7fe8b97f98d0 pc=0x4c180f goroutine 16 [running]: github.com/open-policy-agent/opa/ast.sortOrder({0x1b64960?, 0xc008fab400}) /src/ast/compare.go:249 +0x54d fp=0xc0206823a0 sp=0xc020682398 pc=0x8817ed github.com/open-policy-agent/opa/ast.Compare({0x1b64960?, 0xc008fab400?}, {0x1b64960?, 0xc008fab3f0?}) /src/ast/compare.go:67 +0xfa fp=0xc0206825f8 sp=0xc0206823a0 pc=0x87fe5a github.com/open-policy-agent/opa/ast.Var.Compare(...) /src/ast/term.go:836 github.com/open-policy-agent/opa/ast.(*Var).Compare(0xc020682658?, {0x20e3800?, 0xc008fab3f0})Workaround: