Skip to content

Commit 299a865

Browse files
committed
Add deduplicable to constructors
1 parent b01a5c4 commit 299a865

1 file changed

Lines changed: 16 additions & 9 deletions

File tree

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

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ public interface VulnerabilityType {
8787
VulnerabilityTypes.REFLECTION_INJECTION, VulnerabilityMarks.REFLECTION_INJECTION_MARK);
8888

8989
VulnerabilityType SESSION_REWRITING =
90-
new ServiceVulnerabilityType(VulnerabilityTypes.SESSION_REWRITING);
90+
new ServiceVulnerabilityType(VulnerabilityTypes.SESSION_REWRITING, false);
9191

9292
String name();
9393

@@ -109,14 +109,26 @@ class VulnerabilityTypeImpl implements VulnerabilityType {
109109

110110
private final int mark;
111111

112+
private final boolean deduplicable;
113+
112114
public VulnerabilityTypeImpl(final byte type, final int... marks) {
113115
this(type, ' ', marks);
114116
}
115117

118+
public VulnerabilityTypeImpl(final byte type, boolean deduplicable, final int... marks) {
119+
this(type, ' ', deduplicable, marks);
120+
}
121+
116122
public VulnerabilityTypeImpl(final byte type, final char separator, final int... marks) {
123+
this(type, separator, true, marks);
124+
}
125+
126+
public VulnerabilityTypeImpl(
127+
final byte type, final char separator, final boolean deduplicable, final int... marks) {
117128
this.type = type;
118129
this.separator = separator;
119130
mark = computeMarks(marks);
131+
this.deduplicable = deduplicable;
120132
}
121133

122134
@Override
@@ -153,7 +165,7 @@ public long calculateHash(@Nonnull final Vulnerability vulnerability) {
153165

154166
@Override
155167
public boolean isDeduplicable() {
156-
return true;
168+
return deduplicable;
157169
}
158170

159171
protected void update(final CRC32 crc, final String value) {
@@ -205,13 +217,8 @@ public long calculateHash(@Nonnull final Vulnerability vulnerability) {
205217
}
206218

207219
class ServiceVulnerabilityType extends VulnerabilityTypeImpl {
208-
public ServiceVulnerabilityType(byte type, int... marks) {
209-
super(type, marks);
210-
}
211-
212-
@Override
213-
public boolean isDeduplicable() {
214-
return false;
220+
public ServiceVulnerabilityType(byte type, boolean deduplicable, int... marks) {
221+
super(type, deduplicable, marks);
215222
}
216223

217224
@Override

0 commit comments

Comments
 (0)