Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(decl): use SetUint for open_mode uint32 field
The issue can be reproduced with the following test: ``` tests: - rule: DirectoryTraversalMonitoredFileRead name: test2 runner: HostRunner before: "echo Hi" steps: - type: syscall name: open syscall: open args: pathname: "/etc/../etc/../etc/shadow" flags: 0 mode: 0644 after: "echo Bye" ``` It was crashing with: ``` panic: reflect: call of reflect.Value.SetInt on uint32 Value ``` After this fix it runs successfully: ``` 2024-11-10T23:22:23.483+0100 info root /Users/jose.calvo/repos/event-generator/cmd/declarative/run/run.go:221 Starting test execution... {"testName": "test2", "testIndex": 0} 2024-11-10T23:22:23.494+0100 info root.runner.test.script /Users/jose.calvo/repos/event-generator/pkg/test/script/shell/shell.go:174 Script log line {"runnerType": "HostRunner", "testName": "test2", "testIndex": 0, "type": "stdout", "line": "Hi"} 2024-11-10T23:22:23.504+0100 debug root.runner.test /Users/jose.calvo/repos/event-generator/pkg/test/test/test.go:142 Executed test step {"runnerType": "HostRunner", "testName": "test2", "testIndex": 0, "stepName": "open", "stepIndex": 0} 2024-11-10T23:22:23.510+0100 debug root.runner.test /Users/jose.calvo/repos/event-generator/pkg/test/test/test.go:187 Executed test step cleanup {"runnerType": "HostRunner", "testName": "test2", "testIndex": 0, "stepName": "open", "stepIndex": 0} 2024-11-10T23:22:23.511+0100 info root.runner.test.script /Users/jose.calvo/repos/event-generator/pkg/test/script/shell/shell.go:174 Script log line {"runnerType": "HostRunner", "testName": "test2", "testIndex": 0, "type": "stdout", "line": "Bye"} 2024-11-10T23:22:23.514+0100 info root /Users/jose.calvo/repos/event-generator/cmd/declarative/run/run.go:249 Test execution completed {"testName": "test2", "testIndex": 0} ``` Signed-off-by: José Antonio Calvo <[email protected]>
- Loading branch information