Skip to content

logparser.py: don't error out on exec events without target

commit 7297e2f6 assumed that exec events always have a "target=...", but this is only true for events in complain mode. In enforce mode, the log line doesn't include "target=...".

This commits sets an empty target instead of erroring out on every exec event in enforce mode.

Also adjust ask_exec() in aa.py to only update hashlog[aamode][target_profile]['final_name'] if target_profile is set (hashlog[aamode][''] doesn't exist and trying to write to it would error out)

Also add log testcases for exec with and without target=

  • in complain mode, exec events include target=...
  • in enforce mode, the log message doesn't include target=...

Note that the utils tests skip exec events (they'd be interactive), therefore exec*.profile doesn't contain an exec rule.

Manual testing shows that setting an empty target works as expected.

Merge request reports