Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ASM] IAST Header injection vulnerability detection. #4981

Merged
merged 78 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from 62 commits
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
7682687
Evidence nullable
NachoEchevarria Nov 3, 2023
d66706c
netcore5 tests
NachoEchevarria Nov 6, 2023
bf3d799
Send xcontenttype header by default.
NachoEchevarria Nov 6, 2023
78f3719
snapshots & tests
NachoEchevarria Nov 6, 2023
0500028
mvc iast tests
NachoEchevarria Nov 7, 2023
d1a9dfc
Fix
NachoEchevarria Nov 7, 2023
721be58
mvc .net framework snapshots
NachoEchevarria Nov 8, 2023
4ee08c9
remove not needed
NachoEchevarria Nov 8, 2023
1ea9fc1
Show hash in tests
NachoEchevarria Nov 8, 2023
dd758ab
Update autogenerated
NachoEchevarria Nov 10, 2023
6b137fd
fix tests
NachoEchevarria Nov 10, 2023
3f8a2eb
Update mvc5 tests
NachoEchevarria Nov 10, 2023
8d7584a
add snapshot
NachoEchevarria Nov 13, 2023
7c48c2f
Fix
NachoEchevarria Nov 13, 2023
f1eb9aa
update
NachoEchevarria Nov 13, 2023
cb83c69
Debug tests
NachoEchevarria Nov 13, 2023
64b3fb0
test
NachoEchevarria Nov 13, 2023
d870de0
fix
NachoEchevarria Nov 13, 2023
03eae90
Fix tests
NachoEchevarria Nov 14, 2023
20a40df
Add perfromance improvements and snapshots
NachoEchevarria Nov 14, 2023
82d2ab2
Improve tests
NachoEchevarria Nov 14, 2023
0d97ab9
Add charset case
NachoEchevarria Nov 16, 2023
b7361dc
Remove try/catch
NachoEchevarria Nov 16, 2023
4880d4a
HSTS vulnerability
NachoEchevarria Nov 14, 2023
003265f
Hsts vulnerability tests
NachoEchevarria Nov 15, 2023
821115a
.net framework tests
NachoEchevarria Nov 15, 2023
b4f6676
Fix
NachoEchevarria Nov 16, 2023
97967b1
fix compilation errors
NachoEchevarria Nov 17, 2023
7d68514
Fix snapshots
NachoEchevarria Nov 17, 2023
23fe2be
Fix
NachoEchevarria Nov 17, 2023
b65aca4
update file names
NachoEchevarria Nov 17, 2023
8f4c270
Update telemetry tests
NachoEchevarria Nov 17, 2023
9eca103
Improve performance
NachoEchevarria Nov 17, 2023
3631733
Performance
NachoEchevarria Nov 17, 2023
a2b2978
Use ulong instead of int for max-age parsing
NachoEchevarria Nov 28, 2023
1483dd5
sample code
NachoEchevarria Dec 5, 2023
fb50abd
netcore tests
NachoEchevarria Dec 5, 2023
5c02e2a
add enums and tags
NachoEchevarria Dec 5, 2023
0d03138
implement vulnerability
NachoEchevarria Dec 12, 2023
bdcc7e6
Fix
NachoEchevarria Dec 13, 2023
ad202dc
update autogenerated
NachoEchevarria Dec 13, 2023
a52b720
implement header injection logic
NachoEchevarria Dec 13, 2023
8764c5c
improvements
NachoEchevarria Dec 14, 2023
a9ed3f5
Fix bugs in evidence
NachoEchevarria Dec 15, 2023
de488bb
make a new tokenizer
NachoEchevarria Dec 15, 2023
19725ee
Add snapshots
NachoEchevarria Dec 15, 2023
0a9f84d
aspnet 2 tests
NachoEchevarria Dec 15, 2023
9f73db1
mvc5 tests
NachoEchevarria Dec 18, 2023
b41ca85
fix tests
NachoEchevarria Dec 18, 2023
8659fce
Add header injection telemetry
NachoEchevarria Dec 18, 2023
8743fce
Fix asp netcore 2 tests
NachoEchevarria Dec 18, 2023
c75205a
Code improvements
NachoEchevarria Dec 18, 2023
86fd7a4
avoid mvc5 tests failures
NachoEchevarria Dec 18, 2023
0f040f5
Merge branch 'master' into nacho/headerInjection
NachoEchevarria Dec 18, 2023
49dc43a
do not taint content type in integration tests
NachoEchevarria Dec 18, 2023
7f89bcc
Protection against malformed cookies
NachoEchevarria Dec 18, 2023
293f8ce
Update tests
NachoEchevarria Dec 19, 2023
397d4dc
remove not needed snapshots
NachoEchevarria Dec 19, 2023
eeb6293
Merge branch 'master' into nacho/headerInjection
NachoEchevarria Jan 8, 2024
252b89b
Update tracer/src/Datadog.Trace/Iast/ReturnedHeadersAnalyzer.cs
NachoEchevarria Jan 8, 2024
ff01ce8
Add string to the constructor
NachoEchevarria Jan 8, 2024
45ece73
Add comment
NachoEchevarria Jan 8, 2024
b9d77eb
new case
NachoEchevarria Jan 9, 2024
7a04600
Merge branch 'master' into nacho/headerInjection
NachoEchevarria Jan 11, 2024
2ea6134
Merge from main.
NachoEchevarria Jan 11, 2024
42a0676
Refactor ReturnedHeaderAnalyzer. Added tests for multiple header values.
NachoEchevarria Jan 12, 2024
f5cf4bb
Update tracer/src/Datadog.Trace/Iast/SensitiveData/HeaderInjectionTok…
NachoEchevarria Jan 15, 2024
bbe324b
Add timeout to regex
NachoEchevarria Jan 15, 2024
5cc307d
Merge branch 'nacho/headerInjection' of https://github.com/DataDog/dd…
NachoEchevarria Jan 15, 2024
64e638d
improve HeaderInjectionTokenizer
NachoEchevarria Jan 15, 2024
496af3e
Improve performance
NachoEchevarria Jan 15, 2024
54118de
Add comment
NachoEchevarria Jan 15, 2024
d057455
Add try/catch for RegexMatchTimeoutException
NachoEchevarria Jan 16, 2024
96a11e9
Merge branch 'master' into nacho/headerInjection
NachoEchevarria Jan 16, 2024
bb8583e
Merge branch 'master' into nacho/headerInjection
NachoEchevarria Jan 17, 2024
f512f2e
Merge branch 'master' into nacho/headerInjection
NachoEchevarria Jan 17, 2024
f08d986
Merge branch 'master' into nacho/headerInjection
NachoEchevarria Jan 17, 2024
36d9278
Merge branch 'master' into nacho/headerInjection
NachoEchevarria Jan 17, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ internal static partial class IastInstrumentedSinksExtensions
/// The number of members in the enum.
/// This is a non-distinct count of defined names.
/// </summary>
public const int Length = 17;
public const int Length = 18;

/// <summary>
/// Returns the string representation of the <see cref="Datadog.Trace.Telemetry.Metrics.MetricTags.IastInstrumentedSinks"/> value.
Expand Down Expand Up @@ -47,6 +47,7 @@ public static string ToStringFast(this Datadog.Trace.Telemetry.Metrics.MetricTag
Datadog.Trace.Telemetry.Metrics.MetricTags.IastInstrumentedSinks.XContentTypeHeaderMissing => "vulnerability_type:xcontenttype_header_missing",
Datadog.Trace.Telemetry.Metrics.MetricTags.IastInstrumentedSinks.TrustBoundaryViolation => "vulnerability_type:trust_boundary_violation",
Datadog.Trace.Telemetry.Metrics.MetricTags.IastInstrumentedSinks.HstsHeaderMissing => "vulnerability_type:hsts_header_missing",
Datadog.Trace.Telemetry.Metrics.MetricTags.IastInstrumentedSinks.HeaderInjection => "vulnerability_type:header_injection",
_ => value.ToString(),
};

Expand Down Expand Up @@ -77,6 +78,7 @@ public static Datadog.Trace.Telemetry.Metrics.MetricTags.IastInstrumentedSinks[]
Datadog.Trace.Telemetry.Metrics.MetricTags.IastInstrumentedSinks.XContentTypeHeaderMissing,
Datadog.Trace.Telemetry.Metrics.MetricTags.IastInstrumentedSinks.TrustBoundaryViolation,
Datadog.Trace.Telemetry.Metrics.MetricTags.IastInstrumentedSinks.HstsHeaderMissing,
Datadog.Trace.Telemetry.Metrics.MetricTags.IastInstrumentedSinks.HeaderInjection,
};

/// <summary>
Expand Down Expand Up @@ -107,6 +109,7 @@ public static string[] GetNames()
nameof(Datadog.Trace.Telemetry.Metrics.MetricTags.IastInstrumentedSinks.XContentTypeHeaderMissing),
nameof(Datadog.Trace.Telemetry.Metrics.MetricTags.IastInstrumentedSinks.TrustBoundaryViolation),
nameof(Datadog.Trace.Telemetry.Metrics.MetricTags.IastInstrumentedSinks.HstsHeaderMissing),
nameof(Datadog.Trace.Telemetry.Metrics.MetricTags.IastInstrumentedSinks.HeaderInjection),
};

/// <summary>
Expand Down Expand Up @@ -137,5 +140,6 @@ public static string[] GetDescriptions()
"vulnerability_type:xcontenttype_header_missing",
"vulnerability_type:trust_boundary_violation",
"vulnerability_type:hsts_header_missing",
"vulnerability_type:header_injection",
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
namespace Datadog.Trace.Telemetry;
internal partial class MetricsTelemetryCollector
{
private const int CountLength = 329;
private const int CountLength = 330;

/// <summary>
/// Creates the buffer for the <see cref="Datadog.Trace.Telemetry.Metrics.Count" /> values.
Expand Down Expand Up @@ -380,7 +380,8 @@ private static AggregatedMetric[] GetCountBuffer()
new(new[] { "vulnerability_type:xcontenttype_header_missing" }),
new(new[] { "vulnerability_type:trust_boundary_violation" }),
new(new[] { "vulnerability_type:hsts_header_missing" }),
// request.tainted, index = 328
new(new[] { "vulnerability_type:header_injection" }),
// request.tainted, index = 329
new(null),
};

Expand All @@ -390,7 +391,7 @@ private static AggregatedMetric[] GetCountBuffer()
/// It is equal to the cardinality of the tag combinations (or 1 if there are no tags)
/// </summary>
private static int[] CountEntryCounts { get; }
= new int[]{ 4, 64, 1, 3, 4, 2, 2, 4, 1, 1, 1, 22, 3, 2, 4, 4, 1, 22, 3, 2, 44, 6, 1, 64, 1, 22, 3, 1, 1, 5, 12, 1, 17, 1, };
= new int[]{ 4, 64, 1, 3, 4, 2, 2, 4, 1, 1, 1, 22, 3, 2, 4, 4, 1, 22, 3, 2, 44, 6, 1, 64, 1, 22, 3, 1, 1, 5, 12, 1, 18, 1, };

public void RecordCountLogCreated(Datadog.Trace.Telemetry.Metrics.MetricTags.LogLevel tag, int increment = 1)
{
Expand Down Expand Up @@ -582,6 +583,6 @@ public void RecordCountIastExecutedSinks(Datadog.Trace.Telemetry.Metrics.MetricT

public void RecordCountIastRequestTainted(int increment = 1)
{
Interlocked.Add(ref _buffer.Count[328], increment);
Interlocked.Add(ref _buffer.Count[329], increment);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ internal static partial class IastInstrumentedSinksExtensions
/// The number of members in the enum.
/// This is a non-distinct count of defined names.
/// </summary>
public const int Length = 17;
public const int Length = 18;

/// <summary>
/// Returns the string representation of the <see cref="Datadog.Trace.Telemetry.Metrics.MetricTags.IastInstrumentedSinks"/> value.
Expand Down Expand Up @@ -47,6 +47,7 @@ public static string ToStringFast(this Datadog.Trace.Telemetry.Metrics.MetricTag
Datadog.Trace.Telemetry.Metrics.MetricTags.IastInstrumentedSinks.XContentTypeHeaderMissing => "vulnerability_type:xcontenttype_header_missing",
Datadog.Trace.Telemetry.Metrics.MetricTags.IastInstrumentedSinks.TrustBoundaryViolation => "vulnerability_type:trust_boundary_violation",
Datadog.Trace.Telemetry.Metrics.MetricTags.IastInstrumentedSinks.HstsHeaderMissing => "vulnerability_type:hsts_header_missing",
Datadog.Trace.Telemetry.Metrics.MetricTags.IastInstrumentedSinks.HeaderInjection => "vulnerability_type:header_injection",
_ => value.ToString(),
};

Expand Down Expand Up @@ -77,6 +78,7 @@ public static Datadog.Trace.Telemetry.Metrics.MetricTags.IastInstrumentedSinks[]
Datadog.Trace.Telemetry.Metrics.MetricTags.IastInstrumentedSinks.XContentTypeHeaderMissing,
Datadog.Trace.Telemetry.Metrics.MetricTags.IastInstrumentedSinks.TrustBoundaryViolation,
Datadog.Trace.Telemetry.Metrics.MetricTags.IastInstrumentedSinks.HstsHeaderMissing,
Datadog.Trace.Telemetry.Metrics.MetricTags.IastInstrumentedSinks.HeaderInjection,
};

/// <summary>
Expand Down Expand Up @@ -107,6 +109,7 @@ public static string[] GetNames()
nameof(Datadog.Trace.Telemetry.Metrics.MetricTags.IastInstrumentedSinks.XContentTypeHeaderMissing),
nameof(Datadog.Trace.Telemetry.Metrics.MetricTags.IastInstrumentedSinks.TrustBoundaryViolation),
nameof(Datadog.Trace.Telemetry.Metrics.MetricTags.IastInstrumentedSinks.HstsHeaderMissing),
nameof(Datadog.Trace.Telemetry.Metrics.MetricTags.IastInstrumentedSinks.HeaderInjection),
};

/// <summary>
Expand Down Expand Up @@ -137,5 +140,6 @@ public static string[] GetDescriptions()
"vulnerability_type:xcontenttype_header_missing",
"vulnerability_type:trust_boundary_violation",
"vulnerability_type:hsts_header_missing",
"vulnerability_type:header_injection",
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
namespace Datadog.Trace.Telemetry;
internal partial class MetricsTelemetryCollector
{
private const int CountLength = 329;
private const int CountLength = 330;

/// <summary>
/// Creates the buffer for the <see cref="Datadog.Trace.Telemetry.Metrics.Count" /> values.
Expand Down Expand Up @@ -380,7 +380,8 @@ private static AggregatedMetric[] GetCountBuffer()
new(new[] { "vulnerability_type:xcontenttype_header_missing" }),
new(new[] { "vulnerability_type:trust_boundary_violation" }),
new(new[] { "vulnerability_type:hsts_header_missing" }),
// request.tainted, index = 328
new(new[] { "vulnerability_type:header_injection" }),
// request.tainted, index = 329
new(null),
};

Expand All @@ -390,7 +391,7 @@ private static AggregatedMetric[] GetCountBuffer()
/// It is equal to the cardinality of the tag combinations (or 1 if there are no tags)
/// </summary>
private static int[] CountEntryCounts { get; }
= new int[]{ 4, 64, 1, 3, 4, 2, 2, 4, 1, 1, 1, 22, 3, 2, 4, 4, 1, 22, 3, 2, 44, 6, 1, 64, 1, 22, 3, 1, 1, 5, 12, 1, 17, 1, };
= new int[]{ 4, 64, 1, 3, 4, 2, 2, 4, 1, 1, 1, 22, 3, 2, 4, 4, 1, 22, 3, 2, 44, 6, 1, 64, 1, 22, 3, 1, 1, 5, 12, 1, 18, 1, };

public void RecordCountLogCreated(Datadog.Trace.Telemetry.Metrics.MetricTags.LogLevel tag, int increment = 1)
{
Expand Down Expand Up @@ -582,6 +583,6 @@ public void RecordCountIastExecutedSinks(Datadog.Trace.Telemetry.Metrics.MetricT

public void RecordCountIastRequestTainted(int increment = 1)
{
Interlocked.Add(ref _buffer.Count[328], increment);
Interlocked.Add(ref _buffer.Count[329], increment);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ internal static partial class IastInstrumentedSinksExtensions
/// The number of members in the enum.
/// This is a non-distinct count of defined names.
/// </summary>
public const int Length = 17;
public const int Length = 18;

/// <summary>
/// Returns the string representation of the <see cref="Datadog.Trace.Telemetry.Metrics.MetricTags.IastInstrumentedSinks"/> value.
Expand Down Expand Up @@ -47,6 +47,7 @@ public static string ToStringFast(this Datadog.Trace.Telemetry.Metrics.MetricTag
Datadog.Trace.Telemetry.Metrics.MetricTags.IastInstrumentedSinks.XContentTypeHeaderMissing => "vulnerability_type:xcontenttype_header_missing",
Datadog.Trace.Telemetry.Metrics.MetricTags.IastInstrumentedSinks.TrustBoundaryViolation => "vulnerability_type:trust_boundary_violation",
Datadog.Trace.Telemetry.Metrics.MetricTags.IastInstrumentedSinks.HstsHeaderMissing => "vulnerability_type:hsts_header_missing",
Datadog.Trace.Telemetry.Metrics.MetricTags.IastInstrumentedSinks.HeaderInjection => "vulnerability_type:header_injection",
_ => value.ToString(),
};

Expand Down Expand Up @@ -77,6 +78,7 @@ public static Datadog.Trace.Telemetry.Metrics.MetricTags.IastInstrumentedSinks[]
Datadog.Trace.Telemetry.Metrics.MetricTags.IastInstrumentedSinks.XContentTypeHeaderMissing,
Datadog.Trace.Telemetry.Metrics.MetricTags.IastInstrumentedSinks.TrustBoundaryViolation,
Datadog.Trace.Telemetry.Metrics.MetricTags.IastInstrumentedSinks.HstsHeaderMissing,
Datadog.Trace.Telemetry.Metrics.MetricTags.IastInstrumentedSinks.HeaderInjection,
};

/// <summary>
Expand Down Expand Up @@ -107,6 +109,7 @@ public static string[] GetNames()
nameof(Datadog.Trace.Telemetry.Metrics.MetricTags.IastInstrumentedSinks.XContentTypeHeaderMissing),
nameof(Datadog.Trace.Telemetry.Metrics.MetricTags.IastInstrumentedSinks.TrustBoundaryViolation),
nameof(Datadog.Trace.Telemetry.Metrics.MetricTags.IastInstrumentedSinks.HstsHeaderMissing),
nameof(Datadog.Trace.Telemetry.Metrics.MetricTags.IastInstrumentedSinks.HeaderInjection),
};

/// <summary>
Expand Down Expand Up @@ -137,5 +140,6 @@ public static string[] GetDescriptions()
"vulnerability_type:xcontenttype_header_missing",
"vulnerability_type:trust_boundary_violation",
"vulnerability_type:hsts_header_missing",
"vulnerability_type:header_injection",
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
namespace Datadog.Trace.Telemetry;
internal partial class MetricsTelemetryCollector
{
private const int CountLength = 329;
private const int CountLength = 330;

/// <summary>
/// Creates the buffer for the <see cref="Datadog.Trace.Telemetry.Metrics.Count" /> values.
Expand Down Expand Up @@ -380,7 +380,8 @@ private static AggregatedMetric[] GetCountBuffer()
new(new[] { "vulnerability_type:xcontenttype_header_missing" }),
new(new[] { "vulnerability_type:trust_boundary_violation" }),
new(new[] { "vulnerability_type:hsts_header_missing" }),
// request.tainted, index = 328
new(new[] { "vulnerability_type:header_injection" }),
// request.tainted, index = 329
new(null),
};

Expand All @@ -390,7 +391,7 @@ private static AggregatedMetric[] GetCountBuffer()
/// It is equal to the cardinality of the tag combinations (or 1 if there are no tags)
/// </summary>
private static int[] CountEntryCounts { get; }
= new int[]{ 4, 64, 1, 3, 4, 2, 2, 4, 1, 1, 1, 22, 3, 2, 4, 4, 1, 22, 3, 2, 44, 6, 1, 64, 1, 22, 3, 1, 1, 5, 12, 1, 17, 1, };
= new int[]{ 4, 64, 1, 3, 4, 2, 2, 4, 1, 1, 1, 22, 3, 2, 4, 4, 1, 22, 3, 2, 44, 6, 1, 64, 1, 22, 3, 1, 1, 5, 12, 1, 18, 1, };

public void RecordCountLogCreated(Datadog.Trace.Telemetry.Metrics.MetricTags.LogLevel tag, int increment = 1)
{
Expand Down Expand Up @@ -582,6 +583,6 @@ public void RecordCountIastExecutedSinks(Datadog.Trace.Telemetry.Metrics.MetricT

public void RecordCountIastRequestTainted(int increment = 1)
{
Interlocked.Add(ref _buffer.Count[328], increment);
Interlocked.Add(ref _buffer.Count[329], increment);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ internal static partial class IastInstrumentedSinksExtensions
/// The number of members in the enum.
/// This is a non-distinct count of defined names.
/// </summary>
public const int Length = 17;
public const int Length = 18;

/// <summary>
/// Returns the string representation of the <see cref="Datadog.Trace.Telemetry.Metrics.MetricTags.IastInstrumentedSinks"/> value.
Expand Down Expand Up @@ -47,6 +47,7 @@ public static string ToStringFast(this Datadog.Trace.Telemetry.Metrics.MetricTag
Datadog.Trace.Telemetry.Metrics.MetricTags.IastInstrumentedSinks.XContentTypeHeaderMissing => "vulnerability_type:xcontenttype_header_missing",
Datadog.Trace.Telemetry.Metrics.MetricTags.IastInstrumentedSinks.TrustBoundaryViolation => "vulnerability_type:trust_boundary_violation",
Datadog.Trace.Telemetry.Metrics.MetricTags.IastInstrumentedSinks.HstsHeaderMissing => "vulnerability_type:hsts_header_missing",
Datadog.Trace.Telemetry.Metrics.MetricTags.IastInstrumentedSinks.HeaderInjection => "vulnerability_type:header_injection",
_ => value.ToString(),
};

Expand Down Expand Up @@ -77,6 +78,7 @@ public static Datadog.Trace.Telemetry.Metrics.MetricTags.IastInstrumentedSinks[]
Datadog.Trace.Telemetry.Metrics.MetricTags.IastInstrumentedSinks.XContentTypeHeaderMissing,
Datadog.Trace.Telemetry.Metrics.MetricTags.IastInstrumentedSinks.TrustBoundaryViolation,
Datadog.Trace.Telemetry.Metrics.MetricTags.IastInstrumentedSinks.HstsHeaderMissing,
Datadog.Trace.Telemetry.Metrics.MetricTags.IastInstrumentedSinks.HeaderInjection,
};

/// <summary>
Expand Down Expand Up @@ -107,6 +109,7 @@ public static string[] GetNames()
nameof(Datadog.Trace.Telemetry.Metrics.MetricTags.IastInstrumentedSinks.XContentTypeHeaderMissing),
nameof(Datadog.Trace.Telemetry.Metrics.MetricTags.IastInstrumentedSinks.TrustBoundaryViolation),
nameof(Datadog.Trace.Telemetry.Metrics.MetricTags.IastInstrumentedSinks.HstsHeaderMissing),
nameof(Datadog.Trace.Telemetry.Metrics.MetricTags.IastInstrumentedSinks.HeaderInjection),
};

/// <summary>
Expand Down Expand Up @@ -137,5 +140,6 @@ public static string[] GetDescriptions()
"vulnerability_type:xcontenttype_header_missing",
"vulnerability_type:trust_boundary_violation",
"vulnerability_type:hsts_header_missing",
"vulnerability_type:header_injection",
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
namespace Datadog.Trace.Telemetry;
internal partial class MetricsTelemetryCollector
{
private const int CountLength = 329;
private const int CountLength = 330;

/// <summary>
/// Creates the buffer for the <see cref="Datadog.Trace.Telemetry.Metrics.Count" /> values.
Expand Down Expand Up @@ -380,7 +380,8 @@ private static AggregatedMetric[] GetCountBuffer()
new(new[] { "vulnerability_type:xcontenttype_header_missing" }),
new(new[] { "vulnerability_type:trust_boundary_violation" }),
new(new[] { "vulnerability_type:hsts_header_missing" }),
// request.tainted, index = 328
new(new[] { "vulnerability_type:header_injection" }),
// request.tainted, index = 329
new(null),
};

Expand All @@ -390,7 +391,7 @@ private static AggregatedMetric[] GetCountBuffer()
/// It is equal to the cardinality of the tag combinations (or 1 if there are no tags)
/// </summary>
private static int[] CountEntryCounts { get; }
= new int[]{ 4, 64, 1, 3, 4, 2, 2, 4, 1, 1, 1, 22, 3, 2, 4, 4, 1, 22, 3, 2, 44, 6, 1, 64, 1, 22, 3, 1, 1, 5, 12, 1, 17, 1, };
= new int[]{ 4, 64, 1, 3, 4, 2, 2, 4, 1, 1, 1, 22, 3, 2, 4, 4, 1, 22, 3, 2, 44, 6, 1, 64, 1, 22, 3, 1, 1, 5, 12, 1, 18, 1, };

public void RecordCountLogCreated(Datadog.Trace.Telemetry.Metrics.MetricTags.LogLevel tag, int increment = 1)
{
Expand Down Expand Up @@ -582,6 +583,6 @@ public void RecordCountIastExecutedSinks(Datadog.Trace.Telemetry.Metrics.MetricT

public void RecordCountIastRequestTainted(int increment = 1)
{
Interlocked.Add(ref _buffer.Count[328], increment);
Interlocked.Add(ref _buffer.Count[329], increment);
}
}
6 changes: 4 additions & 2 deletions tracer/src/Datadog.Trace/Iast/CookieAnalyzer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -96,8 +96,10 @@ private static void AnalyzeCookie(string cookieHeaderValue, IntegrationId integr
{
if (!IsExcluded(cookieHeaderValue))
{
var cookieHeader = SetCookieHeaderValue.Parse(cookieHeaderValue);
ReportVulnerabilities(integrationId, cookieHeader);
if (SetCookieHeaderValue.TryParse(cookieHeaderValue, out var cookieHeader))
{
ReportVulnerabilities(integrationId, cookieHeader);
}
}
}

Expand Down
Loading
Loading