Skip to content

Commit

Permalink
🎨fix structure of decoy whenTrue/False
Browse files Browse the repository at this point in the history
  • Loading branch information
TarradeMarc committed Nov 21, 2024
1 parent c01265c commit a626ded
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Binary file modified proxy/wasm/cloud-active-defense.wasm
Binary file not shown.
4 changes: 2 additions & 2 deletions proxy/wasm/config_parser/parser.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,10 @@ func (p *Parser) filterJsonToStruct(filterJs *fastjson.Value) *FilterType {
},
},
WhenTrue: p.conditionsJsonToStruct(
filterJs.Get("inject").Get("store").GetArray("whenTrue"),
filterJs.Get("inject").GetArray("whenTrue"),
),
WhenFalse: p.conditionsJsonToStruct(
filterJs.Get("inject").Get("store").GetArray("whenFalse"),
filterJs.Get("inject").GetArray("whenFalse"),
),
},
Detect: DetectType{
Expand Down
12 changes: 6 additions & 6 deletions proxy/wasm/config_parser/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,15 +173,15 @@ func (c *DecoyConfig) MakeString() string{
confStr += fmt.Sprintf("filters[%d].inject.store.at.property: %s \n", filterind, filter.Inject.Store.At.Property)
confStr += fmt.Sprintln()
for condInd, cond := range filter.Inject.WhenTrue {
confStr += fmt.Sprintf("{\nfilters[%d].inject.store.whenTrue[%d].key: %s \n", filterind, condInd, cond.Key)
confStr += fmt.Sprintf("filters[%d].inject.store.whenTrue[%d].value: %s \n", filterind, condInd, cond.Value)
confStr += fmt.Sprintf("filters[%d].inject.store.whenTrue[%d].in: %s \n },\n", filterind, condInd, cond.In)
confStr += fmt.Sprintf("{\nfilters[%d].inject.whenTrue[%d].key: %s \n", filterind, condInd, cond.Key)
confStr += fmt.Sprintf("filters[%d].inject.whenTrue[%d].value: %s \n", filterind, condInd, cond.Value)
confStr += fmt.Sprintf("filters[%d].inject.whenTrue[%d].in: %s \n },\n", filterind, condInd, cond.In)
}
confStr += fmt.Sprintln()
for condInd, cond := range filter.Inject.WhenFalse {
confStr += fmt.Sprintf("{\nfilters[%d].inject.store.whenFalse[%d].key: %s \n", filterind, condInd, cond.Key)
confStr += fmt.Sprintf("filters[%d].inject.store.whenFalse[%d].value: %s \n", filterind, condInd, cond.Value)
confStr += fmt.Sprintf("filters[%d].inject.store.whenFalse[%d].in: %s \n},\n", filterind, condInd, cond.In)
confStr += fmt.Sprintf("{\nfilters[%d].inject.whenFalse[%d].key: %s \n", filterind, condInd, cond.Key)
confStr += fmt.Sprintf("filters[%d].inject.whenFalse[%d].value: %s \n", filterind, condInd, cond.Value)
confStr += fmt.Sprintf("filters[%d].inject.whenFalse[%d].in: %s \n},\n", filterind, condInd, cond.In)
}
confStr += fmt.Sprintln()
confStr += fmt.Sprintf("filters[%d].detect.seek.inRequest: %s \n", filterind, filter.Detect.Seek.InRequest)
Expand Down

0 comments on commit a626ded

Please sign in to comment.