You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is not an existing bug but a possible bug. I am developing a feature (a new kind of event), when adding a test for my feature, I encountered a bug in integration-tests. My test case looks like this, after running ping, tracee should emit events.SchedProcessExec and events.MyDevelopingEvent.
Line 2482 calculates index of actEvtsCopy, the expression cmdIdx*len(cmd.expectedEvents)+evtIdx will produce wrong index when cmd in cmdEvents have different number of expectedEvents. Take my test case as an example, when comparing output of runCmd("ping"), the correct index should be 1 and 2, but the expression gives 2 and 3 because len(cmd.expectedEvents) of "ping" is 2 and len(cmd.expectedEvent) of "who" is 1.
I think main branch also have this possible bug. I give version v0.21.0 here.
v0.21.0
Output of uname -a:
Linux 6.9.9-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.9.9-1 (2024-07-13) x86_64 GNU/Linux
Additional details
I suggest changing code to below.
actEvtIdx:=0for_, cmd:=rangecmdEvents {
syscallsInSets:= []string{}
checkSets:=len(cmd.sets) >0ifcheckSets {
syscallsInSets=getAllSyscallsInSets(cmd.sets)
}
// compare the expected events with the actual events in the same orderfor_, expEvt:=rangecmd.expectedEvents {
// runCmds ensures at least same number of events were received in actual,// hence no out of range panic hereactEvt:=actEvtsCopy[actEvtIdx]
actEvtIdx++
The text was updated successfully, but these errors were encountered:
ExpectAllInOrderSequentially might try to access an index out of range
depending on the number of events that are being checked.
More about in issue aquasecurity#4255.
ExpectAllInOrderSequentially might try to access an index out of range
depending on the number of events that are being checked.
More about in issue aquasecurity#4255.
geyslan
added a commit
to geyslan/tracee
that referenced
this issue
Sep 25, 2024
ExpectAllInOrderSequentially might try to access an index out of range
depending on the number of events that are being checked.
More about in issue aquasecurity#4255.
Description
This is not an existing bug but a possible bug. I am developing a feature (a new kind of event), when adding a test for my feature, I encountered a bug in integration-tests. My test case looks like this, after running
ping
, tracee should emitevents.SchedProcessExec
andevents.MyDevelopingEvent
.Line 2482 calculates index of
actEvtsCopy
, the expressioncmdIdx*len(cmd.expectedEvents)+evtIdx
will produce wrong index whencmd
incmdEvents
have different number ofexpectedEvents
. Take my test case as an example, when comparing output ofrunCmd("ping")
, the correct index should be 1 and 2, but the expression gives 2 and 3 becauselen(cmd.expectedEvents)
of"ping"
is 2 andlen(cmd.expectedEvent)
of"who"
is 1.tracee/tests/integration/event_filters_test.go
Lines 2473 to 2482 in a325d64
Output of
tracee version
:I think
main
branch also have this possible bug. I give version v0.21.0 here.Output of
uname -a
:Additional details
I suggest changing code to below.
The text was updated successfully, but these errors were encountered: