Skip to content

Commit

Permalink
update(userspace/engine): remove warnings for missing exceptions
Browse files Browse the repository at this point in the history
We want users to continue using rules without having to use exceptions.
Exceptions are an additional feature for more advanced use-cases, having
a warning in there will mean that everyone now adds an empty exception
to avoid the warning.

Co-Authored-By: Leonardo Grasso <me@leonardograsso.com>
Signed-off-by: Lorenzo Fontana <lo@linux.com>
  • Loading branch information
fntlnz and leogr committed Apr 8, 2021
1 parent 548ad42 commit 1b0e379
Show file tree
Hide file tree
Showing 4 changed files with 1 addition and 45 deletions.
12 changes: 0 additions & 12 deletions test/falco_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -356,8 +356,6 @@ trace_files: !mux
condition: evt.type=fork
priority: INFO
---
1 warnings:
Rule no output rule: consider adding an exceptions property to define supported exceptions fields
validate_rules_file:
- rules/invalid_rule_without_output.yaml
trace_file: trace_files/cat_write.scap
Expand Down Expand Up @@ -413,8 +411,6 @@ trace_files: !mux
condition: evt.type=open
append: true
---
1 warnings:
Rule my_rule: consider adding an exceptions property to define supported exceptions fields
validate_rules_file:
- rules/rule_append_failure.yaml
trace_file: trace_files/cat_write.scap
Expand Down Expand Up @@ -542,9 +538,6 @@ trace_files: !mux
priority: INFO
append: false
---
2 warnings:
Rule some rule: consider adding an exceptions property to define supported exceptions fields
Rule some rule: consider adding an exceptions property to define supported exceptions fields
validate_rules_file:
- rules/invalid_overwrite_rule_multiple_docs.yaml
trace_file: trace_files/cat_write.scap
Expand All @@ -567,9 +560,6 @@ trace_files: !mux
priority: INFO
append: true
---
2 warnings:
Rule some rule: consider adding an exceptions property to define supported exceptions fields
Rule some rule: consider adding an exceptions property to define supported exceptions fields
validate_rules_file:
- rules/invalid_append_rule_multiple_docs.yaml
trace_file: trace_files/cat_write.scap
Expand Down Expand Up @@ -627,8 +617,6 @@ trace_files: !mux
output: "An open was seen %not_a_real_field"
priority: WARNING
---
1 warnings:
Rule rule_with_invalid_output: consider adding an exceptions property to define supported exceptions fields
validate_rules_file:
- rules/invalid_rule_output.yaml
trace_file: trace_files/cat_write.scap
Expand Down
9 changes: 0 additions & 9 deletions test/falco_tests_exceptions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -185,15 +185,6 @@ trace_files: !mux
- rules/exceptions/append_item_not_in_rule.yaml
trace_file: trace_files/cat_write.scap

rule_without_exception:
exit_status: 0
stderr_contains: |+
1 warnings:
Rule My Rule: consider adding an exceptions property to define supported exceptions fields
validate_rules_file:
- rules/exceptions/rule_without_exception.yaml
trace_file: trace_files/cat_write.scap

rule_exception_no_values:
detect: True
detect_level: WARNING
Expand Down
21 changes: 0 additions & 21 deletions test/rules/exceptions/rule_without_exception.yaml

This file was deleted.

4 changes: 1 addition & 3 deletions userspace/engine/lua/rule_loader.lua
Original file line number Diff line number Diff line change
Expand Up @@ -522,10 +522,8 @@ function load_rules_doc(rules_mgr, doc, load_state)
v['source'] = "syscall"
end

-- Add an empty exceptions property to the rule if not
-- defined, but add a warning about defining one
-- Add an empty exceptions property to the rule if not defined
if v['exceptions'] == nil then
warnings[#warnings + 1] = "Rule "..v['rule']..": consider adding an exceptions property to define supported exceptions fields"
v['exceptions'] = {}
end

Expand Down

0 comments on commit 1b0e379

Please sign in to comment.