Skip to content

Commit

Permalink
Merge pull request #3 from metal-toolbox/relax-compound-event-message…
Browse files Browse the repository at this point in the history
…-check

aucoalesce: Be more forgiving of compound events.
  • Loading branch information
JAORMX authored Mar 13, 2023
2 parents 6fba496 + 3d62faa commit 2122257
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
7 changes: 4 additions & 3 deletions aucoalesce/coalesce.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,9 +218,10 @@ func normalizeCompound(msgs []*auparse.AuditMessage) (*Event, error) {
break
}
}
if syscall == nil {
// All compound records have syscall messages.
return nil, errors.New("missing syscall message in compound event")
if special == nil && syscall == nil {
return nil, &CompoundEventError{
message: "compound event's special and syscall audit messages are nil",
}
}

event := newEvent(special, syscall)
Expand Down
11 changes: 11 additions & 0 deletions aucoalesce/errors.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package aucoalesce

// CompoundEventError is returned by CoalesceMessages when a compound
// audit event cannot be parsed.
type CompoundEventError struct {
message string
}

func (o *CompoundEventError) Error() string {
return o.message
}

0 comments on commit 2122257

Please sign in to comment.