Skip to content

Commit

Permalink
Add test for preserving rule order
Browse files Browse the repository at this point in the history
Test the fix for #354. A rules
file has a event-specific rule first and a catchall rule second. Without
the changes in draios/sysdig#1103, the first
rule does not match the event.
  • Loading branch information
mstemm committed Apr 19, 2018
1 parent 6398687 commit 65cd607
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/falco_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -699,3 +699,13 @@ trace_files: !mux
- detect_madvise: 2
- detect_open: 2
trace_file: trace_files/syscall.scap

catchall_order:
detect: True
detect_level: INFO
rules_file:
- rules/catchall_order.yaml
detect_counts:
- open_dev_null: 1
dev_null: 0
trace_file: trace_files/cat_write.scap
12 changes: 12 additions & 0 deletions test/rules/catchall_order.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
- rule: open_dev_null
desc: Any open of the file /dev/null
condition: evt.type=open and fd.name=/dev/null
output: An open of /dev/null was seen (command=%proc.cmdline evt=%evt.type %evt.args)
priority: INFO

- rule: dev_null
desc: Anything related to /dev/null
condition: fd.name=/dev/null
output: Something related to /dev/null was seen (command=%proc.cmdline evt=%evt.type %evt.args)
priority: INFO
warn_evttypes: false

0 comments on commit 65cd607

Please sign in to comment.