@@ -285,7 +285,7 @@ func TestUpdateWAF(t *testing.T) {
285
285
ephemeral := map [string ]interface {}{
286
286
"my.other.input" : map [string ]bool {"safe" : true },
287
287
}
288
- res , err := wafCtx .Run (RunAddressData {Persistent : values , Ephemeral : ephemeral }, time . Second )
288
+ res , err := wafCtx .Run (RunAddressData {Persistent : values , Ephemeral : ephemeral })
289
289
require .NoError (t , err )
290
290
require .NotEmpty (t , res .Events )
291
291
require .Nil (t , res .Actions )
@@ -304,7 +304,7 @@ func TestUpdateWAF(t *testing.T) {
304
304
values = map [string ]interface {}{
305
305
"my.input" : "Arachni" ,
306
306
}
307
- res , err = wafCtx2 .Run (RunAddressData {Persistent : values , Ephemeral : ephemeral }, time . Second )
307
+ res , err = wafCtx2 .Run (RunAddressData {Persistent : values , Ephemeral : ephemeral })
308
308
require .NoError (t , err )
309
309
require .NotEmpty (t , res .Events )
310
310
require .NotEmpty (t , res .Actions )
@@ -376,7 +376,7 @@ func TestTimeout(t *testing.T) {
376
376
require .NotNil (t , context )
377
377
defer context .Close ()
378
378
379
- _ , err = context .Run (RunAddressData {Persistent : normalValue , Ephemeral : normalValue }, 0 )
379
+ _ , err = context .Run (RunAddressData {Persistent : normalValue , Ephemeral : normalValue })
380
380
require .NoError (t , err )
381
381
require .NotEmpty (t , context .Stats ())
382
382
require .NotZero (t , context .Stats ().Timers ["_dd.appsec.waf.decode" ])
@@ -391,7 +391,7 @@ func TestTimeout(t *testing.T) {
391
391
require .NotNil (t , context )
392
392
defer context .Close ()
393
393
394
- _ , err = context .Run (RunAddressData {Persistent : map [string ]any {"my.input" : "curl/7.88" }}, 0 )
394
+ _ , err = context .Run (RunAddressData {Persistent : map [string ]any {"my.input" : "curl/7.88" }})
395
395
require .NoError (t , err )
396
396
require .NotEmpty (t , context .Stats ())
397
397
require .NotZero (t , context .Stats ().Timers ["_dd.appsec.waf.decode" ])
@@ -406,7 +406,7 @@ func TestTimeout(t *testing.T) {
406
406
require .NotNil (t , context )
407
407
defer context .Close ()
408
408
409
- _ , err = context .Run (RunAddressData {Persistent : largeValue }, 0 )
409
+ _ , err = context .Run (RunAddressData {Persistent : largeValue })
410
410
require .Equal (t , errors .ErrTimeout , err )
411
411
require .GreaterOrEqual (t , context .Stats ().Timers ["_dd.appsec.waf.duration_ext" ], time .Millisecond )
412
412
require .GreaterOrEqual (t , context .Stats ().Timers ["_dd.appsec.waf.encode" ], time .Millisecond )
@@ -418,7 +418,7 @@ func TestTimeout(t *testing.T) {
418
418
require .NotNil (t , context )
419
419
defer context .Close ()
420
420
421
- _ , err = context .Run (RunAddressData {Ephemeral : largeValue }, 0 )
421
+ _ , err = context .Run (RunAddressData {Ephemeral : largeValue })
422
422
require .Equal (t , errors .ErrTimeout , err )
423
423
require .GreaterOrEqual (t , context .Stats ().Timers ["_dd.appsec.waf.duration_ext" ], time .Millisecond )
424
424
require .GreaterOrEqual (t , context .Stats ().Timers ["_dd.appsec.waf.encode" ], time .Millisecond )
@@ -431,7 +431,7 @@ func TestTimeout(t *testing.T) {
431
431
defer context .Close ()
432
432
433
433
for i := 0 ; i < 1000 && err != errors .ErrTimeout ; i ++ {
434
- _ , err = context .Run (RunAddressData {Persistent : normalValue }, 0 )
434
+ _ , err = context .Run (RunAddressData {Persistent : normalValue })
435
435
}
436
436
437
437
require .Equal (t , errors .ErrTimeout , err )
@@ -457,7 +457,7 @@ func TestMatching(t *testing.T) {
457
457
ephemeral := map [string ]interface {}{
458
458
"my.other.input" : map [string ]bool {"safe" : true },
459
459
}
460
- res , err := wafCtx .Run (RunAddressData {Persistent : values , Ephemeral : ephemeral }, time . Second )
460
+ res , err := wafCtx .Run (RunAddressData {Persistent : values , Ephemeral : ephemeral })
461
461
require .NoError (t , err )
462
462
require .Nil (t , res .Events )
463
463
require .Nil (t , res .Actions )
@@ -466,7 +466,7 @@ func TestMatching(t *testing.T) {
466
466
values = map [string ]interface {}{
467
467
"server.request.uri.raw" : "something" ,
468
468
}
469
- res , err = wafCtx .Run (RunAddressData {Persistent : values , Ephemeral : ephemeral }, time . Second )
469
+ res , err = wafCtx .Run (RunAddressData {Persistent : values , Ephemeral : ephemeral })
470
470
require .NoError (t , err )
471
471
require .Nil (t , res .Events )
472
472
require .Nil (t , res .Actions )
@@ -476,25 +476,25 @@ func TestMatching(t *testing.T) {
476
476
values = map [string ]interface {}{
477
477
"my.input" : "Arachni" ,
478
478
}
479
- res , err = wafCtx .Run (RunAddressData {Persistent : values , Ephemeral : ephemeral }, time . Second )
479
+ res , err = wafCtx .Run (RunAddressData {Persistent : values , Ephemeral : ephemeral })
480
480
require .NoError (t , err )
481
481
require .NotEmpty (t , res .Events )
482
482
require .Nil (t , res .Actions )
483
483
484
484
// Not matching anymore since it already matched before
485
- res , err = wafCtx .Run (RunAddressData {Persistent : values , Ephemeral : ephemeral }, time . Second )
485
+ res , err = wafCtx .Run (RunAddressData {Persistent : values , Ephemeral : ephemeral })
486
486
require .NoError (t , err )
487
487
require .Nil (t , res .Events )
488
488
require .Nil (t , res .Actions )
489
489
490
490
// Nil values
491
- res , err = wafCtx .Run (RunAddressData {}, time . Second )
491
+ res , err = wafCtx .Run (RunAddressData {})
492
492
require .NoError (t , err )
493
493
require .Nil (t , res .Events )
494
494
require .Nil (t , res .Actions )
495
495
496
496
// Empty values
497
- res , err = wafCtx .Run (RunAddressData {Persistent : map [string ]interface {}{}, Ephemeral : ephemeral }, time . Second )
497
+ res , err = wafCtx .Run (RunAddressData {Persistent : map [string ]interface {}{}, Ephemeral : ephemeral })
498
498
require .NoError (t , err )
499
499
require .Nil (t , res .Events )
500
500
require .Nil (t , res .Actions )
@@ -524,7 +524,7 @@ func TestMatchingEphemeralAndPersistent(t *testing.T) {
524
524
Ephemeral : map [string ]any {"my.input" : "Arachni/ephemeral" },
525
525
}
526
526
527
- res , err := wafCtx .Run (addresses , time . Second )
527
+ res , err := wafCtx .Run (addresses )
528
528
require .NoError (t , err )
529
529
530
530
// There is only one hit here
@@ -546,7 +546,7 @@ func TestMatchingEphemeralAndPersistent(t *testing.T) {
546
546
)
547
547
548
548
// Matche the same inputs a second time...
549
- res , err = wafCtx .Run (addresses , time . Second )
549
+ res , err = wafCtx .Run (addresses )
550
550
require .NoError (t , err )
551
551
// There shouldn't be any match anymore...
552
552
require .Empty (t , res .Events )
@@ -579,7 +579,7 @@ func TestMatchingEphemeral(t *testing.T) {
579
579
input2 : "go client" ,
580
580
},
581
581
}
582
- res , err := wafCtx .Run (runAddresses , time . Second )
582
+ res , err := wafCtx .Run (runAddresses )
583
583
require .NoError (t , err )
584
584
require .Nil (t , res .Events )
585
585
require .Nil (t , res .Actions )
@@ -593,7 +593,7 @@ func TestMatchingEphemeral(t *testing.T) {
593
593
"server.request.body.raw" : "something" ,
594
594
},
595
595
}
596
- res , err = wafCtx .Run (runAddresses , time . Second )
596
+ res , err = wafCtx .Run (runAddresses )
597
597
require .NoError (t , err )
598
598
require .Nil (t , res .Events )
599
599
require .Nil (t , res .Actions )
@@ -610,13 +610,13 @@ func TestMatchingEphemeral(t *testing.T) {
610
610
611
611
// Matching
612
612
// Note a WAF rule with ephemeral addresses may match more than once!
613
- res , err = wafCtx .Run (runAddresses , time . Second )
613
+ res , err = wafCtx .Run (runAddresses )
614
614
require .NoError (t , err )
615
615
require .Len (t , res .Events , 2 ) // 1 ephemeral, 1 persistent [!!Only if the rules have a different tags.type value!!]
616
616
require .Nil (t , res .Actions )
617
617
618
618
// Ephemeral address should still match, persistent shouldn't anymore
619
- res , err = wafCtx .Run (runAddresses , time . Second )
619
+ res , err = wafCtx .Run (runAddresses )
620
620
require .NoError (t , err )
621
621
require .Len (t , res .Events , 1 ) // 1 ephemeral
622
622
require .Nil (t , res .Actions )
@@ -653,7 +653,7 @@ func TestMatchingEphemeralOnly(t *testing.T) {
653
653
input1 : "go client" ,
654
654
},
655
655
}
656
- res , err := wafCtx .Run (runAddresses , time . Second )
656
+ res , err := wafCtx .Run (runAddresses )
657
657
require .NoError (t , err )
658
658
require .Nil (t , res .Events )
659
659
require .Nil (t , res .Actions )
@@ -664,7 +664,7 @@ func TestMatchingEphemeralOnly(t *testing.T) {
664
664
"server.request.uri.raw" : "something" ,
665
665
},
666
666
}
667
- res , err = wafCtx .Run (runAddresses , time . Second )
667
+ res , err = wafCtx .Run (runAddresses )
668
668
require .NoError (t , err )
669
669
require .Nil (t , res .Events )
670
670
require .Nil (t , res .Actions )
@@ -677,7 +677,7 @@ func TestMatchingEphemeralOnly(t *testing.T) {
677
677
}
678
678
679
679
// Matching
680
- res , err = wafCtx .Run (runAddresses , time . Second )
680
+ res , err = wafCtx .Run (runAddresses )
681
681
require .NoError (t , err )
682
682
require .Len (t , res .Events , 1 ) // 1 ephemeral
683
683
require .Nil (t , res .Actions )
@@ -711,7 +711,7 @@ func TestActions(t *testing.T) {
711
711
ephemeral := map [string ]interface {}{
712
712
"my.other.input" : map [string ]bool {"safe" : true },
713
713
}
714
- res , err := wafCtx .Run (RunAddressData {Persistent : values , Ephemeral : ephemeral }, time . Second )
714
+ res , err := wafCtx .Run (RunAddressData {Persistent : values , Ephemeral : ephemeral })
715
715
require .NoError (t , err )
716
716
require .NotEmpty (t , res .Events )
717
717
for _ , aType := range expectedActionsTypes {
@@ -780,7 +780,7 @@ func TestConcurrency(t *testing.T) {
780
780
ephemeralData := map [string ]interface {}{
781
781
"server.request.body" : bodies [i ],
782
782
}
783
- res , err := wafCtx .Run (RunAddressData {Persistent : data , Ephemeral : ephemeralData }, time . Minute )
783
+ res , err := wafCtx .Run (RunAddressData {Persistent : data , Ephemeral : ephemeralData })
784
784
if err != nil {
785
785
panic (err )
786
786
}
@@ -805,7 +805,7 @@ func TestConcurrency(t *testing.T) {
805
805
ephemeral := map [string ]interface {}{
806
806
"server.request.body" : map [string ]bool {"safe" : true },
807
807
}
808
- res , err := wafCtx .Run (RunAddressData {Persistent : data , Ephemeral : ephemeral }, time . Second )
808
+ res , err := wafCtx .Run (RunAddressData {Persistent : data , Ephemeral : ephemeral })
809
809
require .NoError (t , err )
810
810
require .NotEmpty (t , res .Events )
811
811
})
@@ -851,7 +851,7 @@ func TestConcurrency(t *testing.T) {
851
851
}
852
852
ephemeral := map [string ]interface {}{"server.request.body" : bodies [i ]}
853
853
854
- res , err := wafCtx .Run (RunAddressData {Persistent : data , Ephemeral : ephemeral }, time . Minute )
854
+ res , err := wafCtx .Run (RunAddressData {Persistent : data , Ephemeral : ephemeral })
855
855
856
856
if err != nil {
857
857
panic (err )
@@ -870,7 +870,7 @@ func TestConcurrency(t *testing.T) {
870
870
ephemeral := map [string ]interface {}{
871
871
"server.request.body" : map [string ]bool {"safe" : true },
872
872
}
873
- res , err := wafCtx .Run (RunAddressData {Persistent : data , Ephemeral : ephemeral }, time . Hour )
873
+ res , err := wafCtx .Run (RunAddressData {Persistent : data , Ephemeral : ephemeral })
874
874
require .NoError (t , err )
875
875
require .NotEmpty (t , res .Events )
876
876
require .Nil (t , res .Actions )
@@ -969,7 +969,7 @@ func TestConcurrency(t *testing.T) {
969
969
// effectively releases the WAF context, and between 0 and N calls to wafCtx.Run(...) are
970
970
// done (those that land after `wafCtx.Close()` happened will be silent no-ops).
971
971
if n % 2 == 0 {
972
- wafCtx .Run (RunAddressData {Ephemeral : data }, time . Hour )
972
+ wafCtx .Run (RunAddressData {Ephemeral : data })
973
973
} else {
974
974
wafCtx .Close ()
975
975
}
@@ -1118,7 +1118,7 @@ func TestMetrics(t *testing.T) {
1118
1118
"server.request.body" : map [string ]bool {"safe" : true },
1119
1119
}
1120
1120
start := time .Now ()
1121
- res , err := wafCtx .Run (RunAddressData {Persistent : data , Ephemeral : ephemeral }, time . Second )
1121
+ res , err := wafCtx .Run (RunAddressData {Persistent : data , Ephemeral : ephemeral })
1122
1122
elapsedNS := time .Since (start ).Nanoseconds ()
1123
1123
require .NoError (t , err )
1124
1124
require .NotNil (t , res .Events )
@@ -1146,7 +1146,7 @@ func TestMetrics(t *testing.T) {
1146
1146
}
1147
1147
1148
1148
for i := uint64 (1 ); i <= 10 ; i ++ {
1149
- _ , err := wafCtx .Run (RunAddressData {Persistent : data , Ephemeral : ephemeral }, 0 )
1149
+ _ , err := wafCtx .Run (RunAddressData {Persistent : data , Ephemeral : ephemeral })
1150
1150
require .Equal (t , errors .ErrTimeout , err )
1151
1151
require .Equal (t , wafCtx .TotalTimeouts (), i )
1152
1152
}
@@ -1169,7 +1169,7 @@ func TestObfuscatorConfig(t *testing.T) {
1169
1169
ephemeral := map [string ]interface {}{
1170
1170
"server.request.body" : map [string ]bool {"safe" : true },
1171
1171
}
1172
- res , err := wafCtx .Run (RunAddressData {Persistent : data , Ephemeral : ephemeral }, time . Second )
1172
+ res , err := wafCtx .Run (RunAddressData {Persistent : data , Ephemeral : ephemeral })
1173
1173
require .NoError (t , err )
1174
1174
require .NotNil (t , res .Events )
1175
1175
require .Nil (t , res .Actions )
@@ -1192,7 +1192,7 @@ func TestObfuscatorConfig(t *testing.T) {
1192
1192
ephemeral := map [string ]interface {}{
1193
1193
"server.request.body" : map [string ]bool {"safe" : true },
1194
1194
}
1195
- res , err := wafCtx .Run (RunAddressData {Persistent : data , Ephemeral : ephemeral }, time . Second )
1195
+ res , err := wafCtx .Run (RunAddressData {Persistent : data , Ephemeral : ephemeral })
1196
1196
require .NoError (t , err )
1197
1197
require .NotNil (t , res .Events )
1198
1198
require .Nil (t , res .Actions )
@@ -1215,7 +1215,7 @@ func TestObfuscatorConfig(t *testing.T) {
1215
1215
ephemeral := map [string ]interface {}{
1216
1216
"server.request.body" : map [string ]bool {"safe" : true },
1217
1217
}
1218
- res , err := wafCtx .Run (RunAddressData {Persistent : data , Ephemeral : ephemeral }, time . Second )
1218
+ res , err := wafCtx .Run (RunAddressData {Persistent : data , Ephemeral : ephemeral })
1219
1219
require .NoError (t , err )
1220
1220
require .NotNil (t , res .Events )
1221
1221
require .Nil (t , res .Actions )
@@ -1249,7 +1249,7 @@ func TestTruncationInformation(t *testing.T) {
1249
1249
"container_too_large" : make ([]bool , bindings .WafMaxContainerSize + extra + 2 ),
1250
1250
},
1251
1251
},
1252
- }, time . Second )
1252
+ })
1253
1253
require .NoError (t , err )
1254
1254
require .Equal (t , map [TruncationReason ][]int {
1255
1255
StringTooLong : {bindings .WafMaxStringLength + extra + 2 , bindings .WafMaxStringLength + extra },
0 commit comments