Skip to content

Commit

Permalink
SECKSD-14473 fixed validation: did not work for PenaltyBoxProtection:…
Browse files Browse the repository at this point in the history
… false
  • Loading branch information
aignachk authored and mgwoj committed Jun 27, 2022
1 parent 7f9286c commit 257c59e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pkg/appsec/eval_penalty_box_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func TestAppSec_UpdateEvalPenaltyBox(t *testing.T) {
ConfigID: 43253,
Version: 15,
PolicyID: "AAAA_81230",
PenaltyBoxProtection: true,
PenaltyBoxProtection: false,
Action: string(ActionTypeDeny),
},
headers: http.Header{
Expand Down
7 changes: 3 additions & 4 deletions pkg/appsec/penalty_box.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,9 @@ func (v GetPenaltyBoxesRequest) Validate() error {
// Validate validates an UpdatePenaltyBoxRequest.
func (v UpdatePenaltyBoxRequest) Validate() error {
return validation.Errors{
"ConfigID": validation.Validate(v.ConfigID, validation.Required),
"Version": validation.Validate(v.Version, validation.Required),
"PolicyID": validation.Validate(v.PolicyID, validation.Required),
"PenaltyBoxProtection": validation.Validate(v.PenaltyBoxProtection, validation.Required),
"ConfigID": validation.Validate(v.ConfigID, validation.Required),
"Version": validation.Validate(v.Version, validation.Required),
"PolicyID": validation.Validate(v.PolicyID, validation.Required),
"Action": validation.Validate(v.Action, validation.Required, validation.In(string(ActionTypeAlert), string(ActionTypeDeny), string(ActionTypeNone)).Error(
fmt.Sprintf("value '%s' is invalid. Must be one of: 'alert', 'deny' or 'none'", v.Action))),
}.Filter()
Expand Down

0 comments on commit 257c59e

Please sign in to comment.