Skip to content

Commit b74cc24

Browse files
authored
change cookie vulns hash calculation (#8210)
What Does This Do Change the evidence hash calculation for the location one Motivation Using evidence for the cookie vulnerabilities hash is not the most effective approach. In some applications, a different cookie name is used per request or session. This leads to a large number of duplicate vulnerabilities. Deduplicating by location leads to a predictably low and bounded number of vulnerabilities.
1 parent ac2ce26 commit b74cc24

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

dd-java-agent/agent-iast/src/main/java/com/datadog/iast/model/VulnerabilityType.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ public interface VulnerabilityType {
3131
type(VulnerabilityTypes.WEAK_HASH).excludedSources(Builder.DB_EXCLUDED).build();
3232
VulnerabilityType INSECURE_COOKIE =
3333
type(VulnerabilityTypes.INSECURE_COOKIE)
34-
.hash(VulnerabilityType::evidenceHash)
34+
.hash(VulnerabilityType::fileAndLineHash)
3535
.excludedSources(Builder.DB_EXCLUDED)
3636
.build();
3737
VulnerabilityType NO_HTTPONLY_COOKIE =
3838
type(VulnerabilityTypes.NO_HTTPONLY_COOKIE)
39-
.hash(VulnerabilityType::evidenceHash)
39+
.hash(VulnerabilityType::fileAndLineHash)
4040
.excludedSources(Builder.DB_EXCLUDED)
4141
.build();
4242
VulnerabilityType HSTS_HEADER_MISSING =
@@ -51,7 +51,7 @@ public interface VulnerabilityType {
5151
.build();
5252
VulnerabilityType NO_SAMESITE_COOKIE =
5353
type(VulnerabilityTypes.NO_SAMESITE_COOKIE)
54-
.hash(VulnerabilityType::evidenceHash)
54+
.hash(VulnerabilityType::fileAndLineHash)
5555
.excludedSources(Builder.DB_EXCLUDED)
5656
.build();
5757

dd-java-agent/agent-iast/src/test/groovy/com/datadog/iast/model/VulnerabilityTypeTest.groovy

+9-9
Original file line numberDiff line numberDiff line change
@@ -30,15 +30,15 @@ class VulnerabilityTypeTest extends DDSpecification {
3030
WEAK_CIPHER | getSpanAndClassAndMethodLocation(123) | new Evidence("MD5") | 3265519776
3131
WEAK_CIPHER | getSpanAndClassAndMethodLocation(456) | new Evidence("MD4") | 3265519776
3232
WEAK_CIPHER | getSpanAndClassAndMethodLocation(789) | null | 3265519776
33-
INSECURE_COOKIE | getSpanAndStackLocation(123) | null | 3471934557
34-
INSECURE_COOKIE | getSpanAndStackLocation(123) | new Evidence("cookieName1") | 360083726
35-
INSECURE_COOKIE | getSpanAndStackLocation(123) | new Evidence("cookieName2") | 2357141684
36-
NO_HTTPONLY_COOKIE | getSpanAndStackLocation(123) | null | 2115643285
37-
NO_HTTPONLY_COOKIE | getSpanAndStackLocation(123) | new Evidence("cookieName1") | 585548920
38-
NO_HTTPONLY_COOKIE | getSpanAndStackLocation(123) | new Evidence("cookieName2") | 3153040834
39-
NO_SAMESITE_COOKIE | getSpanAndStackLocation(123) | null | 3683185539
40-
NO_SAMESITE_COOKIE | getSpanAndStackLocation(123) | new Evidence("cookieName1") | 881944211
41-
NO_SAMESITE_COOKIE | getSpanAndStackLocation(123) | new Evidence("cookieName2") | 2912433961
33+
INSECURE_COOKIE | getSpanAndStackLocation(123) | null | 1156210466
34+
INSECURE_COOKIE | getSpanAndStackLocation(123) | new Evidence("cookieName1") | 1156210466
35+
INSECURE_COOKIE | getSpanAndStackLocation(123) | new Evidence("cookieName2") | 1156210466
36+
NO_HTTPONLY_COOKIE | getSpanAndStackLocation(123) | null | 1522983769
37+
NO_HTTPONLY_COOKIE | getSpanAndStackLocation(123) | new Evidence("cookieName1") | 1522983769
38+
NO_HTTPONLY_COOKIE | getSpanAndStackLocation(123) | new Evidence("cookieName2") | 1522983769
39+
NO_SAMESITE_COOKIE | getSpanAndStackLocation(123) | null | 1090504969
40+
NO_SAMESITE_COOKIE | getSpanAndStackLocation(123) | new Evidence("cookieName1") | 1090504969
41+
NO_SAMESITE_COOKIE | getSpanAndStackLocation(123) | new Evidence("cookieName2") | 1090504969
4242
XCONTENTTYPE_HEADER_MISSING | getSpanAndService(123, null) | null | 3429203725
4343
XCONTENTTYPE_HEADER_MISSING | getSpanAndService(123, 'serviceName1') | null | 2718833340
4444
XCONTENTTYPE_HEADER_MISSING | getSpanAndService(123, 'serviceName2') | null | 990333702

0 commit comments

Comments
 (0)