JamesWoolfenden / pike

Pike is a tool for determining the permissions or policy required for IAC code

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

panic: runtime error: index out of range [0] with length 0

good92 opened this issue · comments

Thanks for your project.

Describe the bug
pike run on level1 of level1/level2 projects

To Reproduce

pike -d ./myproject/ scan

panic: runtime error: index out of range [0] with length 0

goroutine 1 [running]:
github.com/jameswoolfenden/pike/src.GetResources({0xc0000d8b80, 0x71})
/home/runner/work/pike/pike/src/data.go:53 +0x526
github.com/jameswoolfenden/pike/src.MakePolicy({0x7ffd579ea1b1, 0xe}, {0x0, 0x0}, {0x0, 0x0}, 0x0)
/home/runner/work/pike/pike/src/scan.go:106 +0x68b
github.com/jameswoolfenden/pike/src.Scan({0x7ffd579ea1b1, 0x0}, {0x0, 0xed22c0}, {0x0, 0xc0002009b0}, 0x40)
/home/runner/work/pike/pike/src/scan.go:23 +0x2f
main.main.func1(0xc0000c9200)
/home/runner/work/pike/pike/main.go:80 +0x45
github.com/urfave/cli/v2.(*Command).Run(0xc0000c9200, 0xc000155080)
/home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.10.3/command.go:169 +0x6be
github.com/urfave/cli/v2.(*App).RunContext(0xc00015e1a0, {0xb10390, 0xc0000ae020}, {0xc0000aa000, 0x4, 0x4})
/home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.10.3/app.go:341 +0x89c
github.com/urfave/cli/v2.(*App).Run(...)
/home/runner/go/pkg/mod/github.com/urfave/cli/v2@v2.10.3/app.go:247
main.main()
/home/runner/work/pike/pike/main.go:127 +0x10d2

Expected behavior
No crash, aggregation of sub-projects permissions

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: Amazon Linux 2
  • pike: latest version

thanks for logging, im not clear what this means "run on level1 of level1/level2 projects"

level1/level2/main.tf

A/1_B/main.tf
A/2_B/main.tf
A/README.md

I put in something to look for no labels on the tf, and some logging. I may be missing some resource or tf language that i haven't catered for. if you try out v0.1.64 and let me know. i haven't managed to replicate your scenario

tx, I will check that tomorrow.