infobloxopen / seal

Apache License 2.0
16 stars 11 forks source link

compiler coredump on single-quote #111

Closed rchowinfoblox closed 3 years ago

rchowinfoblox commented 3 years ago

This SEAL with single-quote instead of double-quote causes compiler segfault:

allow subject group everyone to manage rchow.abacpolicy where ctx.id == 'deadbeef'

coredump:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x18 pc=0x77c45a]

goroutine 1 [running]:
github.com/infobloxopen/seal/pkg/ast.(*InfixCondition).GetTypes(0xc000274280, 0x16, 0x91a0a0, 0xc00028c1e0)
        /home/riccho/go/src/github.com/infobloxopen/seal/pkg/ast/ast.go:254 +0x9a
github.com/infobloxopen/seal/pkg/ast.(*WhereClause).GetTypes(0xc00028c1e0, 0xc00028c1e0, 0xc00013a200, 0x5)
        /home/riccho/go/src/github.com/infobloxopen/seal/pkg/ast/ast.go:201 +0x39
github.com/infobloxopen/seal/pkg/parser.(*Parser).validateActionStatement(0xc000272500, 0xc000259800, 0xc0001e5498, 0x781150)
        /home/riccho/go/src/github.com/infobloxopen/seal/pkg/parser/parser.go:153 +0x22b
github.com/infobloxopen/seal/pkg/parser.(*Parser).parseActionStatement.func1(0xc000272500, 0xc0001e5520)
        /home/riccho/go/src/github.com/infobloxopen/seal/pkg/parser/parser.go:393 +0x3c
github.com/infobloxopen/seal/pkg/parser.(*Parser).parseActionStatement(0xc000272500, 0xc000259800)
        /home/riccho/go/src/github.com/infobloxopen/seal/pkg/parser/parser.go:441 +0x474
github.com/infobloxopen/seal/pkg/parser.(*Parser).parseStatement(0xc000272500, 0x97ec26, 0x7)
        /home/riccho/go/src/github.com/infobloxopen/seal/pkg/parser/parser.go:87 +0x5d
github.com/infobloxopen/seal/pkg/parser.(*Parser).ParsePolicies(0xc000272500, 0xc000031a00)
        /home/riccho/go/src/github.com/infobloxopen/seal/pkg/parser/parser.go:75 +0x6f
github.com/infobloxopen/seal/pkg/compiler.(*PolicyCompiler).Compile(0xc000198420, 0x7ffe3fdbe5ce, 0x8, 0xc00013a1c0, 0xdf, 0x0, 0x0, 0x0, 0x0)
        /home/riccho/go/src/github.com/infobloxopen/seal/pkg/compiler/policy_compiler.go:79 +0xc5
github.com/infobloxopen/seal/cmd.compileFunc(0xcd9c00, 0xc00015c480, 0x0, 0x8)
        /home/riccho/go/src/github.com/infobloxopen/seal/cmd/compile.go:80 +0x3cd
github.com/infobloxopen/seal/vendor/github.com/spf13/cobra.(*Command).execute(0xcd9c00, 0xc00015c400, 0x8, 0x8, 0xcd9c00, 0xc00015c400)
        /home/riccho/go/src/github.com/infobloxopen/seal/vendor/github.com/spf13/cobra/command.go:846 +0x2c2
github.com/infobloxopen/seal/vendor/github.com/spf13/cobra.(*Command).ExecuteC(0xcd9960, 0xc0000100b0, 0xc000187f48, 0x446fea)
        /home/riccho/go/src/github.com/infobloxopen/seal/vendor/github.com/spf13/cobra/command.go:950 +0x375
github.com/infobloxopen/seal/vendor/github.com/spf13/cobra.(*Command).Execute(...)
        /home/riccho/go/src/github.com/infobloxopen/seal/vendor/github.com/spf13/cobra/command.go:887
github.com/infobloxopen/seal/vendor/github.com/spf13/cobra.(*Command).ExecuteContext(...)
        /home/riccho/go/src/github.com/infobloxopen/seal/vendor/github.com/spf13/cobra/command.go:880
github.com/infobloxopen/seal/cmd.Execute(0xa235e0, 0xc0000280a8)
        /home/riccho/go/src/github.com/infobloxopen/seal/cmd/root.go:45 +0x5c
main.main()
        /home/riccho/go/src/github.com/infobloxopen/seal/main.go:25 +0x39