Commit Graph

179 Commits

Author SHA1 Message Date
Jason Dellaluce
c0f8171d89 test: adapt integration tests to new rule loader error messages
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2022-04-11 12:22:18 +02:00
Jason Dellaluce
c801c09e7d update(test): adapt integration test error messages to comply to new parser errors
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2022-03-23 18:31:43 +01:00
Jason Dellaluce
9607cbc2c7 update(build): temporarely bump cloudtrail and json plugin version to dev builds
This is required due to the plugin API version being bumped to 1.0.0 in the framework after
the recent breaking changes. cloudtrail and json will be switched back to a stable build
once they get released to require the plugin API version with the newest major.

Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2022-03-18 23:20:01 +01:00
Mark Stemm
df219b5e1d New tests for rule + exception, macro with unknown source
Add new test cases for a rule with an unknown source *and* an
exception, and a macro with an unknown source.

The first results in a rule warning (and no error), and the second
prints an error and skips.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2022-03-18 13:54:47 +01:00
Josh Soref
19a6cf74f8 spelling: successfully
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2022-03-01 16:30:24 +01:00
Josh Soref
35d0f0603f spelling: multitrailing
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2022-03-01 16:30:24 +01:00
Josh Soref
19ab9e5f35 spelling: expand
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2022-03-01 16:30:24 +01:00
Mark Stemm
83c527dd91 Use cmake function to copy files, as a single target
Replace nearly-identical blocks of code that defined individual custom
targets/custom commands to copy files from source to build dir with
the copy_files_to_build_dir function.

This reduces the number of build targets and speeds up/cleans up the
make output.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2022-02-18 16:47:43 +01:00
Federico Di Pierro
ff21544186 update(build)!: replaced various PROBE with DRIVER where necessary.
Follow-up of https://github.com/falcosecurity/libs/pull/197.
Updated libs too to master version, as needed.

Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2022-02-08 09:50:39 +01:00
Leonardo Grasso
9ae8d281f5 fix(test): falco_hostnetwork_images list is now in k8s_audit_rules.yaml
Co-Authored-by: Jason Dellaluce <jasondellaluce@gmail.com>
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2022-01-24 15:03:12 +01:00
Federico Di Pierro
0c290d98f8 fix(tests): avoid hardcoding plugin version 0.1.0 in plugin tests.
Signed-off-by: Federico Di Pierro <nierro92@gmail.com>
2022-01-17 17:20:33 +01:00
Jason Dellaluce
b5667cab99 chore(test): remove unused files in test directory
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2021-12-09 10:36:45 +01:00
Jason Dellaluce
2a00a4d853 rules: adding support to openat2
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2021-12-06 19:12:14 +01:00
sai-arigeli
23706da75e Allow append of new exceptions to rules
Signed-off-by: Sai Arigeli <saiharisharigeli@gmail.com>

Return warnings after validation of rule exceptions

Signed-off-by: Sai Arigeli <saiharisharigeli@gmail.com>

Update FALCO_ENGINE_VERSION

Signed-off-by: Sai Arigeli <saiharisharigeli@gmail.com>
2021-11-18 09:11:20 +01:00
Jason Dellaluce
446c65007d test(userspace/engine): add integration test for rules enabled with enabled flag only
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2021-11-16 16:37:45 +01:00
Jason Dellaluce
df3728ec3f test(userspace/engine): add integration test for rules disabled with enabled flag only
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2021-11-16 16:37:45 +01:00
Jason Dellaluce
a66dda3daa test(userspace/engine): update integration tests to support enabled-only rules
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2021-11-16 16:37:45 +01:00
Mark Stemm
cb51522423 Skip plugins list/load/tests for MUSL_OPTIMIZED_BUILD
When MUSL_OPTIMIZED_BUILD is specified, falco is statically linked under
musl, and can't dlopen() files: see
https://inbox.vuxu.org/musl/20200423162406.GV11469@brightrain.aerifal.cx/T/

So skip listing/loading/testing plugins when MUSL_OPTIMIZED_BUILD is specified.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2021-11-12 18:27:59 +01:00
Mark Stemm
2a4e4d555d Add automated tests for plugins
Test infrastructure and sample confs/rules/traces for plugins
automated tests:

New test cases are in falco_tests_plugins.yaml and cover:
- Listing plugins and fields when plugins are loaded.
- Basic cloudtrail + json plugin on a fake cloudtrail json file and a
  sample rule that uses both plugins.
- Conflicts between source/extractor plugins
- Incompatible plugin api
- Wrong plugin path
- Checking for warnings when reading rules with unnown sources (e.g. when plugins are not loaded)

Some test-only plugins written in C are in test/plugins and built on
the fly. (They aren't included in packages of course).

The test framework needed some small changes to handle these tests:
- Add a mode to not check detection counts at all (for --list/--list-plugins)
- addl_cmdline_opts to allow specifying --list/--list-plugins
- Using DOTALL when matching stderr/stdout (allows multi-line matches more easily)

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2021-11-12 18:27:59 +01:00
Jason Dellaluce
6ee0b353ac test: adding a test for correct json pointer parsing
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2021-11-11 18:36:21 +01:00
Mark Stemm
f7893fbd14 Change expected result for old trace file with old execve event num
The trace file traces-positive/run-shell-untrusted.scap has an old
execve event number (PPME_SYSCALL_EXECVE_18), which was replaced by
PPME_SYSCALL_EXECVE_19 in 2018.

Given the changes in https://github.com/falcosecurity/libs/pull/94,
these events are now skipped. So change the test to note that *no*
events will be detected.

As a bit of context, event numbers won't be changing any longer--a
change around the same time 298fbde8029020ce3fbddd07e2910b59cc402b8b
allowed for extending existing events to add new parameters instead of
having to define a new event number just to add a new parameter. So
the notion of "old events" should not exist for any event created
after mid-to-late 2018.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2021-10-12 17:59:38 +02:00
Mark Stemm
10d47cb1f5 Update automated tests to reflect evttypes behavior
With the changes in https://github.com/falcosecurity/libs/pull/74,
there isn't any need to warn about the order of operators and the
evt.type field--the set of event types for a filter should be exact
now regardless of the order of operators.

So update tests that were logging those warnings to note that the
warnings won't occur any more.

Also, some tests more accurately *do* note that they have an overly
permissive evttype (e.g. ones related to syscalls, which are uncommon
and are evaluated for all event types) to reflect the new behavior.

Finally, in unit tests create an actual sinsp filter instead of a
gen_event_filter, which is the base class and shouldn't be created
directly.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2021-10-12 17:59:38 +02:00
Jason Dellaluce
0eb170cf5f update(test): enhance test cases for tags in json outputs
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2021-09-28 12:44:27 +02:00
Jason Dellaluce
c7d9b6ee7f test(outputs): add source and tags to json output
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2021-09-21 18:59:10 +02:00
Jason Dellaluce
b0562242e8 test(grpc): Test tags on outputs service
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2021-09-21 18:59:10 +02:00
Jason Dellaluce
9ea43c2663 update(test): check output order in output_strictly_contains
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2021-09-21 18:53:09 +02:00
Jason Dellaluce
4d55847bd4 fix(test): avoid output_strictly_contains failures
Signed-off-by: Jason Dellaluce <jasondellaluce@gmail.com>
2021-09-21 18:53:09 +02:00
Kaizhe Huang
684a5d85ff disable test
Signed-off-by: Kaizhe Huang <khuang@aurora.tech>
2021-06-07 12:17:21 +02:00
Kaizhe Huang
58cea0c5e7 minor fix
Signed-off-by: Kaizhe Huang <khuang@aurora.tech>
2021-06-07 12:17:21 +02:00
Kaizhe Huang
38ebc61808 fix tests
Signed-off-by: Kaizhe Huang <khuang@aurora.tech>
2021-06-07 12:17:21 +02:00
Kaizhe Huang
535db19991 disable change thread namespace test
Signed-off-by: Kaizhe Huang <khuang@aurora.tech>
2021-06-07 12:17:21 +02:00
Kaizhe Huang
abe46a19a0 minor changes
Signed-off-by: Kaizhe Huang <derek0405@gmail.com>
2021-06-07 12:17:21 +02:00
Kaizhe Huang
96fc8d1a27 update test
Signed-off-by: Kaizhe Huang <derek0405@gmail.com>
2021-06-07 12:17:21 +02:00
Leonardo Grasso
c60fac9e34 build(test): upgrade urllib3 to 1.26.5
CVE-2021-33503 has been fixed in urllib3 v1.26.5.
See:
 - https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-33503
 - https://github.com/urllib3/urllib3/releases/tag/1.26.5

Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2021-06-04 22:15:33 +02:00
Leonardo Di Donato
6e94c37399 new(test): regression test for FAL-01-003
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
2021-04-21 15:11:17 +02:00
Leonardo Di Donato
d3c22d3d0c new(test/trace_files): test fixture for FAL-01-003
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
2021-04-21 15:11:17 +02:00
Lorenzo Fontana
bd562a1ed9 update(userspace/engine): remove warnings for missing exceptions
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>
2021-04-09 18:17:11 +02:00
Mark Stemm
f14b37984c Add test for some containers being privileged
Add a test that verifies that a pod where one container has no security
context and the second container has a security context + privileged
properly matches the Create Privileged Pod falco rule.

There's a very similar test case already in
trace_files/k8s_audit/create_nginx_pod_privileged_2nd_container.json,
but in that case both containers have a securityContext property.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2021-04-09 10:34:48 +02:00
Lorenzo Fontana
f4ff2ed072 chore(test): replace bucket url with official distribution url
Signed-off-by: Lorenzo Fontana <lo@linux.com>
2021-04-09 10:23:42 +02:00
Lorenzo Fontana
cdeafa6fdc docs(test): express that grpcurl and virtualenv are needed
Signed-off-by: Lorenzo Fontana <lo@linux.com>
2021-04-08 17:32:02 +02:00
Leonardo Grasso
36378371ab update(test): update performance tests fixture URL
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2021-04-08 12:36:09 +02:00
Leonardo Grasso
aeca36bdaf update(test): update regression tests fixture URL
Signed-off-by: Leonardo Grasso <me@leonardograsso.com>
2021-04-08 12:36:09 +02:00
Leo Di Donato
8c9d4f49d5 fix(falco/test): bump pyyaml from 5.3.1 to 5.4
CVE-2020-14343 affects one of the dependencies the Falco (integration) test suite uses.

Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
2021-03-30 14:47:01 +02:00
Leonardo Di Donato
1ded30f173 update(test): tighten the condition to test the drops thresholds
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
2021-03-22 19:42:30 +01:00
Leonardo Di Donato
7edd965a08 fix(test/confs): drop log messages are debug, fix the test fixture accordingly
Co-authored-by: Leonardo Grasso <me@leonardograsso.com>
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
2021-03-22 19:42:30 +01:00
Leonardo Di Donato
920ab6982a new(test): test cases about wrong threshold drop config value
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
2021-03-22 19:42:30 +01:00
Leonardo Di Donato
5380fe5308 new(test): test case about illogical drop actions
Signed-off-by: Leonardo Di Donato <leodidonato@gmail.com>
2021-03-22 19:42:30 +01:00
Shane Lawrence
da8f054043 Fix broken links to docs.
Signed-off-by: Shane Lawrence <shane@lawrence.dev>
2021-03-05 10:48:21 +01:00
Mark Stemm
987ececa54 Remove test case for unknown objects.
The rules loader now allows objects with unknown keys.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2021-01-19 10:37:55 +01:00
Mark Stemm
b2eb3ec345 Don't look for event counts with -V/validate
When running falco with -V/valdiate <rules file>, you won't get any
event counts. All prior tests didn't get this far as they also resulted
in rules parsing errors.

However, validating can now result in warnings only. This won't exit but
won't print event counts either.

Signed-off-by: Mark Stemm <mark.stemm@gmail.com>
2021-01-19 10:37:55 +01:00