Skip to content

Commit 53eb0f8

Browse files
committed
Add changes
1 parent b1bc13f commit 53eb0f8

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

Diff for: experimental/types/value_metadata.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ func NewDataMetadataList() DataMetadataList {
9696

9797
func (v *DataMetadataList) EvaluateMetadata(data string) {
9898
// we do the analysis only once
99-
if !v.evaluated {
99+
if v != nil && !v.evaluated {
100100
v.metadata = make(map[DataMetadata]bool)
101101
v.evaluateBoolean(data)
102102
v.evaluateNumeric(data)

Diff for: internal/corazarules/rule_match.go

+3
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ func (m MatchData) ChainLevel() int {
6666

6767
func (m *MatchData) DataMetadata() experimentalTypes.DataMetadataList {
6868
// Evaluate the metadata if it's not set
69+
if m.Metadata_ == nil {
70+
m.Metadata_ = &experimentalTypes.DataMetadataList{}
71+
}
6972
m.Metadata_.EvaluateMetadata(m.Value_)
7073
return *m.Metadata_
7174
}

Diff for: internal/seclang/parser_test.go

+3
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ func TestAllowedMetadataTagsInspectionEnabled(t *testing.T) {
154154
t.Error(err)
155155
}
156156
tx := waf.NewTransaction()
157+
tx.SetMetadataInspection(true)
157158
tx.AddRequestHeader("Content-Type", "application/json")
158159
tx.ProcessURI("http://localhost/test.php", "GET", "1.1")
159160
tx.ProcessRequestHeaders()
@@ -210,6 +211,7 @@ func BenchmarkAllowedMetadataTagsInspectionEnabled(b *testing.B) {
210211
b.ResetTimer()
211212
for i := 0; i < b.N; i++ {
212213
tx := waf.NewTransaction()
214+
tx.SetMetadataInspection(true)
213215
tx.AddRequestHeader("Content-Type", "application/json")
214216
tx.ProcessURI("http://localhost/test.php", "GET", "1.1")
215217
tx.ProcessRequestHeaders()
@@ -267,6 +269,7 @@ func BenchmarkAllowedMetadataTagsInspectionDisabled(b *testing.B) {
267269
b.ResetTimer()
268270
for i := 0; i < b.N; i++ {
269271
tx := waf.NewTransaction()
272+
tx.SetMetadataInspection(false)
270273
tx.AddRequestHeader("Content-Type", "application/json")
271274
tx.SetMetadataInspection(false)
272275
tx.ProcessURI("http://localhost/test.php", "GET", "1.1")

0 commit comments

Comments
 (0)