-
Notifications
You must be signed in to change notification settings - Fork 41
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
fix(decl): use SetUint for open_mode uint32 field #238
fix(decl): use SetUint for open_mode uint32 field #238
Conversation
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]>
Good catch! It looks good to me |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
LGTM label has been added. Git tree hash: 5936cab66bbf055ef1be4ed8ca8bed6b7c87ab20
|
/hold |
Hey @jacalvo, thanks for the fix! Can you have a look at the linter? |
Fixes lint error G115: integer overflow conversion int -> uint64 (gosec) Signed-off-by: José Antonio Calvo <[email protected]>
3bf6c96
to
5fd9c3e
Compare
/unhold |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/lgtm
LGTM label has been added. Git tree hash: 2147e67fb1f4e81d8aa9b8e92ee7c599fede48bb
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: alacuku, jacalvo The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
9d5f392
into
falcosecurity:declarative-testing
What type of PR is this?
/kind bug
Any specific area of the project related to this PR?
/area pkg
What this PR does / why we need it:
The issue can be reproduced with the following test:
It was crashing with:
After this fix it runs successfully:
Which issue(s) this PR fixes:
Fixes #
Special notes for your reviewer: