Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cnspec panics with props example #1515

Open
arlimus opened this issue Dec 14, 2024 · 0 comments · May be fixed by #1516
Open

cnspec panics with props example #1515

arlimus opened this issue Dec 14, 2024 · 0 comments · May be fixed by #1516
Assignees
Labels
bug Something isn't working p1 Priority 1

Comments

@arlimus
Copy link
Member

arlimus commented Dec 14, 2024

Describe the bug

cnspec throws a panic when used with the example props policy YAML

To Reproduce

On current 7940e5e: Build and install cnspec, then run:

> cnspec scan -f examples/props.mql.yaml
→ no provider specified, defaulting to local. Use --help to see all providers.
→ no Mondoo configuration file provided, using defaults
! No credentials provided. Switching to --incognito mode.
→ discover related assets for 1 asset(s)
panic: invalid reporting job

                            goroutine 69 [running]:
                                                   go.mondoo.com/cnspec/v11/policy/executor/internal.(*ReportingJobNodeData).score(0xc0012e0580)
                                                                                                                                                	/pub/go/src/github.com/mondoohq/cnspec/policy/executor/internal/nodes.go:536 +0x4fc
                                                                            go.mondoo.com/cnspec/v11/policy/executor/internal.(*ReportingJobNodeData).recalculate(0xc0012e0580)
                	/pub/go/src/github.com/mondoohq/cnspec/policy/executor/internal/nodes.go:486 +0x3f
                                                                                                          go.mondoo.com/cnspec/v11/policy/executor/internal.(*GraphExecutor).Execute(0xc0012db220)
                                   	/pub/go/src/github.com/mondoohq/cnspec/policy/executor/internal/graph.go:121 +0x46d
                                                                                                                           go.mondoo.com/cnspec/v11/policy/executor.ExecuteResolvedPolicy({0x2f2dd08, 0xc0011bd180}, {0x2f31cd0, 0xc000e2e7b0}, {0xc0006feec0, 0x3a}, 0xc0012a5400, {0xc000978a40, 0x2, 0x8}, ...)
                                                                                                                                                   	/pub/go/src/github.com/mondoohq/cnspec/policy/executor/graph.go:59 +0x453
                                                                  go.mondoo.com/cnspec/v11/policy/scan.(*localAssetScanner).runPolicy(0xc000af1d38)
                                                                                                                                                   	/pub/go/src/github.com/mondoohq/cnspec/policy/scan/local_scanner.go:979 +0x549
                                                                       go.mondoo.com/cnspec/v11/policy/scan.(*localAssetScanner).run(0xc000af1d38)
                                                                                                                                                  	/pub/go/src/github.com/mondoohq/cnspec/policy/scan/local_scanner.go:750 +0x33
                                                                      go.mondoo.com/cnspec/v11/policy/scan.(*LocalScanner).runMotorizedAsset.func1(0x2f2dd08?, 0xc0011bd080?)
              	/pub/go/src/github.com/mondoohq/cnspec/policy/scan/local_scanner.go:601 +0x218
                                                                                              go.mondoo.com/cnspec/v11/internal/datalakes/inmemory.WithDb({0x2f2dd08?, 0xc0011bd080?}, 0xc0000d4e08?, 0xc000b8fdf8)
                                                    	/pub/go/src/github.com/mondoohq/cnspec/internal/datalakes/inmemory/inmemory.go:52 +0x42
                                                                                                                                               go.mondoo.com/cnspec/v11/policy/scan.(*LocalScanner).runMotorizedAsset(0xc00061c198?, 0x2a2f145?)
                                                                                 	/pub/go/src/github.com/mondoohq/cnspec/policy/scan/local_scanner.go:577 +0x65
      go.mondoo.com/cnspec/v11/policy/scan.(*LocalScanner).RunAssetJob(0xc0011e8360, 0xc00052d080)
                                                                                                  	/pub/go/src/github.com/mondoohq/cnspec/policy/scan/local_scanner.go:524 +0xab
                      go.mondoo.com/cnspec/v11/policy/scan.(*LocalScanner).distributeJob.func3()
                                                                                                	/pub/go/src/github.com/mondoohq/cnspec/policy/scan/local_scanner.go:450 +0x4c5
                       created by go.mondoo.com/cnspec/v11/policy/scan.(*LocalScanner).distributeJob in goroutine 1
                                                                                                                   	/pub/go/src/github.com/mondoohq/cnspec/policy/scan/local_scanner.go:416 +0x836
                                       
@arlimus arlimus added bug Something isn't working p1 Priority 1 labels Dec 14, 2024
jaym added a commit that referenced this issue Dec 14, 2024
This removes the old resolver and uses the rewrite everywhere.

Should fix #1515
@jaym jaym linked a pull request Dec 14, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working p1 Priority 1
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants