Limit uploaded event details
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"warningEventThreshold": 10,
|
"warningEventThreshold": 10,
|
||||||
|
"maxReportedEvents": 1000,
|
||||||
"criticalEventThreshold": 30,
|
"criticalEventThreshold": 30,
|
||||||
"warningUniqueIpThreshold": 5,
|
"warningUniqueIpThreshold": 5,
|
||||||
"criticalUniqueIpThreshold": 12,
|
"criticalUniqueIpThreshold": 12,
|
||||||
|
|||||||
@@ -53,6 +53,14 @@ internal sealed class AttackScanner
|
|||||||
|
|
||||||
attacks.Sort(static (left, right) => left.Timestamp.CompareTo(right.Timestamp));
|
attacks.Sort(static (left, right) => left.Timestamp.CompareTo(right.Timestamp));
|
||||||
|
|
||||||
|
int totalEventCount = attacks.Count;
|
||||||
|
int maxReportedEvents = Math.Clamp(configuration.MaxReportedEvents, 100, 5000);
|
||||||
|
List<AttackEvent> reportedEvents = attacks
|
||||||
|
.OrderByDescending(static attack => attack.Timestamp)
|
||||||
|
.Take(maxReportedEvents)
|
||||||
|
.OrderBy(static attack => attack.Timestamp)
|
||||||
|
.ToList();
|
||||||
|
|
||||||
List<AggregatedAttack> topSources = attacks
|
List<AggregatedAttack> topSources = attacks
|
||||||
.GroupBy(static attack => attack.SourceIp)
|
.GroupBy(static attack => attack.SourceIp)
|
||||||
.Select(group => AggregatedAttack.FromGroup(group))
|
.Select(group => AggregatedAttack.FromGroup(group))
|
||||||
@@ -81,7 +89,9 @@ internal sealed class AttackScanner
|
|||||||
GeneratedAtUtc = generatedAtUtc,
|
GeneratedAtUtc = generatedAtUtc,
|
||||||
ClientVersion = BuildMetadata.Version,
|
ClientVersion = BuildMetadata.Version,
|
||||||
LookbackDays = options.LookbackDays,
|
LookbackDays = options.LookbackDays,
|
||||||
TotalEvents = attacks.Count,
|
TotalEvents = totalEventCount,
|
||||||
|
ReportedEventCount = reportedEvents.Count,
|
||||||
|
EventsTruncated = reportedEvents.Count < totalEventCount,
|
||||||
UniqueIpCount = uniqueIpCount,
|
UniqueIpCount = uniqueIpCount,
|
||||||
AlertState = correlationAssessment.FinalAlertState,
|
AlertState = correlationAssessment.FinalAlertState,
|
||||||
AlertReason = correlationAssessment.CorrelationReason == "No CVE correlation applied." ? baseAlertReason : correlationAssessment.CorrelationReason,
|
AlertReason = correlationAssessment.CorrelationReason == "No CVE correlation applied." ? baseAlertReason : correlationAssessment.CorrelationReason,
|
||||||
@@ -95,7 +105,7 @@ internal sealed class AttackScanner
|
|||||||
FinishedAtUtc = generatedAtUtc,
|
FinishedAtUtc = generatedAtUtc,
|
||||||
UploadAttempted = false
|
UploadAttempted = false
|
||||||
},
|
},
|
||||||
Events = attacks,
|
Events = reportedEvents,
|
||||||
TopSources = topSources,
|
TopSources = topSources,
|
||||||
Errors = errors
|
Errors = errors
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ internal sealed record ScannerConfiguration
|
|||||||
{
|
{
|
||||||
public int WarningEventThreshold { get; init; } = 10;
|
public int WarningEventThreshold { get; init; } = 10;
|
||||||
|
|
||||||
|
public int MaxReportedEvents { get; init; } = 1000;
|
||||||
|
|
||||||
public int CriticalEventThreshold { get; init; } = 30;
|
public int CriticalEventThreshold { get; init; } = 30;
|
||||||
|
|
||||||
public int WarningUniqueIpThreshold { get; init; } = 5;
|
public int WarningUniqueIpThreshold { get; init; } = 5;
|
||||||
|
|||||||
@@ -107,6 +107,10 @@ internal sealed record ScanResult
|
|||||||
|
|
||||||
public int TotalEvents { get; init; }
|
public int TotalEvents { get; init; }
|
||||||
|
|
||||||
|
public int ReportedEventCount { get; init; }
|
||||||
|
|
||||||
|
public bool EventsTruncated { get; init; }
|
||||||
|
|
||||||
public int UniqueIpCount { get; init; }
|
public int UniqueIpCount { get; init; }
|
||||||
|
|
||||||
public string AlertState { get; init; } = "ok";
|
public string AlertState { get; init; } = "ok";
|
||||||
|
|||||||
@@ -9,10 +9,10 @@
|
|||||||
<RootNamespace>OCSentinelCli</RootNamespace>
|
<RootNamespace>OCSentinelCli</RootNamespace>
|
||||||
<Product>OfficeCom Sentinel</Product>
|
<Product>OfficeCom Sentinel</Product>
|
||||||
<Company>OfficeCom</Company>
|
<Company>OfficeCom</Company>
|
||||||
<Version>1.5.0-beta.6</Version>
|
<Version>1.5.0-beta.7</Version>
|
||||||
<AssemblyVersion>1.5.0.0</AssemblyVersion>
|
<AssemblyVersion>1.5.0.0</AssemblyVersion>
|
||||||
<FileVersion>1.5.0.0</FileVersion>
|
<FileVersion>1.5.0.0</FileVersion>
|
||||||
<InformationalVersion>1.5.0-beta.6</InformationalVersion>
|
<InformationalVersion>1.5.0-beta.7</InformationalVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
Reference in New Issue
Block a user