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

fix: add "" case for user.name #52

Merged
merged 1 commit into from
Apr 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tests/data/rules/legacy.go
Original file line number Diff line number Diff line change
Expand Up @@ -2319,7 +2319,7 @@ var LegacyFalcoRules_v1_0_1 = run.NewStringFileAccessor(
# https://github.com/draios/sysdig/issues/954). So in that case, allow
# a setuid.
- macro: known_user_in_container
condition: (container and not user.name in ("<NA>","N/A"))
condition: (container and not user.name in ("<NA>","N/A",""))

# Add conditions to this macro (probably in a separate file,
# overwriting this macro) to allow for specific combinations of
Expand Down
4 changes: 1 addition & 3 deletions tests/falco/legacy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2628,9 +2628,7 @@ func TestFalco_Legacy_NonSudoSetuid(t *testing.T) {
falco.WithArgs("-o", "json_include_output_property=false"),
falco.WithArgs("-o", "json_include_tags_property=false"),
)
assert.NotZero(t, res.Detections().Count())
assert.NotZero(t, res.Detections().OfPriority("NOTICE").Count())
assert.Equal(t, 1, res.Detections().OfRule("Non sudo setuid").Count())
assert.Zero(t, res.Detections().Count())
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was triggered because user.name is "" but we should ignore this case, so I update the rule

assert.NoError(t, res.Err(), "%s", res.Stderr())
assert.Equal(t, 0, res.ExitCode())
}
Expand Down
Loading