This is an automated email from the ASF dual-hosted git repository. acosentino pushed a commit to branch 23075 in repository https://gitbox.apache.org/repos/asf/camel.git
commit 9ae15b65f898e6e36b934505759179431645ffef Author: Andrea Cosentino <[email protected]> AuthorDate: Wed Feb 25 11:01:23 2026 +0100 CAMEL-23075 - Camel-ocsf: Fix broken inheritance in generated model classes Signed-off-by: Andrea Cosentino <[email protected]> --- .../src/main/resources/schema/AccountChange.json | 11 +++---- .../src/main/resources/schema/ApiActivity.json | 11 +++---- .../src/main/resources/schema/Authentication.json | 11 +++---- .../main/resources/schema/AuthorizeSession.json | 11 +++---- .../main/resources/schema/ComplianceFinding.json | 11 +++---- .../main/resources/schema/DatastoreActivity.json | 11 +++---- .../main/resources/schema/DetectionFinding.json | 9 ++---- .../src/main/resources/schema/DhcpActivity.json | 11 +++---- .../src/main/resources/schema/DnsActivity.json | 11 +++---- .../src/main/resources/schema/EmailActivity.json | 11 +++---- .../main/resources/schema/EntityManagement.json | 11 +++---- .../src/main/resources/schema/FileActivity.json | 11 +++---- .../src/main/resources/schema/FtpActivity.json | 11 +++---- .../src/main/resources/schema/GroupManagement.json | 11 +++---- .../src/main/resources/schema/HttpActivity.json | 11 +++---- .../src/main/resources/schema/IncidentFinding.json | 11 +++---- .../src/main/resources/schema/KernelActivity.json | 11 +++---- .../resources/schema/KernelExtensionActivity.json | 11 +++---- .../src/main/resources/schema/MemoryActivity.json | 11 +++---- .../src/main/resources/schema/ModuleActivity.json | 11 +++---- .../src/main/resources/schema/NetworkActivity.json | 11 +++---- .../main/resources/schema/NetworkFileActivity.json | 11 +++---- .../src/main/resources/schema/NtpActivity.json | 11 +++---- .../src/main/resources/schema/ProcessActivity.json | 11 +++---- .../src/main/resources/schema/RdpActivity.json | 11 +++---- .../main/resources/schema/RemediationActivity.json | 11 +++---- .../src/main/resources/schema/ScanActivity.json | 11 +++---- .../resources/schema/ScheduledJobActivity.json | 11 +++---- .../src/main/resources/schema/SecurityFinding.json | 11 +++---- .../src/main/resources/schema/SmbActivity.json | 11 +++---- .../src/main/resources/schema/SshActivity.json | 11 +++---- .../src/main/resources/schema/UserAccess.json | 11 +++---- .../resources/schema/VulnerabilityFinding.json | 11 +++---- .../resources/schema/WebResourcesActivity.json | 11 +++---- .../src/main/script/generate-ocsf-schemas.py | 8 +++-- .../camel/dataformat/ocsf/OcsfDataFormatTest.java | 17 +++++------ .../dataformat/ocsf/OcsfEventExampleTest.java | 34 +++++++++++----------- 37 files changed, 166 insertions(+), 265 deletions(-) diff --git a/components/camel-ocsf/src/main/resources/schema/AccountChange.json b/components/camel-ocsf/src/main/resources/schema/AccountChange.json index 98833cb41864..0c6b2ef0d45e 100644 --- a/components/camel-ocsf/src/main/resources/schema/AccountChange.json +++ b/components/camel-ocsf/src/main/resources/schema/AccountChange.json @@ -4,13 +4,10 @@ "title": "AccountChange", "type": "object", "javaType": "org.apache.camel.dataformat.ocsf.model.AccountChange", - "additionalProperties": true, "description": "AccountChange event class.", - "allOf": [ - { - "$ref": "OcsfEvent.json" - } - ], + "extends": { + "$ref": "OcsfEvent.json" + }, "properties": { "actor": { "$ref": "Actor.json" @@ -62,4 +59,4 @@ "$ref": "Policy.json" } } -} \ No newline at end of file +} diff --git a/components/camel-ocsf/src/main/resources/schema/ApiActivity.json b/components/camel-ocsf/src/main/resources/schema/ApiActivity.json index 4a270707fba0..b21c9ff6678c 100644 --- a/components/camel-ocsf/src/main/resources/schema/ApiActivity.json +++ b/components/camel-ocsf/src/main/resources/schema/ApiActivity.json @@ -4,13 +4,10 @@ "title": "ApiActivity", "type": "object", "javaType": "org.apache.camel.dataformat.ocsf.model.ApiActivity", - "additionalProperties": true, "description": "ApiActivity event class.", - "allOf": [ - { - "$ref": "OcsfEvent.json" - } - ], + "extends": { + "$ref": "OcsfEvent.json" + }, "properties": { "actor": { "$ref": "Actor.json" @@ -52,4 +49,4 @@ "$ref": "Fingerprint.json" } } -} \ No newline at end of file +} diff --git a/components/camel-ocsf/src/main/resources/schema/Authentication.json b/components/camel-ocsf/src/main/resources/schema/Authentication.json index e73fb6773219..eebb6fab6346 100644 --- a/components/camel-ocsf/src/main/resources/schema/Authentication.json +++ b/components/camel-ocsf/src/main/resources/schema/Authentication.json @@ -4,13 +4,10 @@ "title": "Authentication", "type": "object", "javaType": "org.apache.camel.dataformat.ocsf.model.Authentication", - "additionalProperties": true, "description": "Authentication event class.", - "allOf": [ - { - "$ref": "OcsfEvent.json" - } - ], + "extends": { + "$ref": "OcsfEvent.json" + }, "properties": { "account_switch_type_id": { "type": "integer", @@ -108,4 +105,4 @@ "title": "Cleartext Credentials" } } -} \ No newline at end of file +} diff --git a/components/camel-ocsf/src/main/resources/schema/AuthorizeSession.json b/components/camel-ocsf/src/main/resources/schema/AuthorizeSession.json index 0d9959f31ac9..b8437c27d63c 100644 --- a/components/camel-ocsf/src/main/resources/schema/AuthorizeSession.json +++ b/components/camel-ocsf/src/main/resources/schema/AuthorizeSession.json @@ -4,13 +4,10 @@ "title": "AuthorizeSession", "type": "object", "javaType": "org.apache.camel.dataformat.ocsf.model.AuthorizeSession", - "additionalProperties": true, "description": "AuthorizeSession event class.", - "allOf": [ - { - "$ref": "OcsfEvent.json" - } - ], + "extends": { + "$ref": "OcsfEvent.json" + }, "properties": { "privileges": { "type": "array", @@ -58,4 +55,4 @@ "$ref": "Fingerprint.json" } } -} \ No newline at end of file +} diff --git a/components/camel-ocsf/src/main/resources/schema/ComplianceFinding.json b/components/camel-ocsf/src/main/resources/schema/ComplianceFinding.json index 673020b34c98..85d1372b6883 100644 --- a/components/camel-ocsf/src/main/resources/schema/ComplianceFinding.json +++ b/components/camel-ocsf/src/main/resources/schema/ComplianceFinding.json @@ -4,13 +4,10 @@ "title": "ComplianceFinding", "type": "object", "javaType": "org.apache.camel.dataformat.ocsf.model.ComplianceFinding", - "additionalProperties": true, "description": "ComplianceFinding event class.", - "allOf": [ - { - "$ref": "OcsfEvent.json" - } - ], + "extends": { + "$ref": "OcsfEvent.json" + }, "properties": { "resources": { "type": "array", @@ -76,4 +73,4 @@ "title": "Confidence" } } -} \ No newline at end of file +} diff --git a/components/camel-ocsf/src/main/resources/schema/DatastoreActivity.json b/components/camel-ocsf/src/main/resources/schema/DatastoreActivity.json index 272afe14d8e7..3f327a3c8e05 100644 --- a/components/camel-ocsf/src/main/resources/schema/DatastoreActivity.json +++ b/components/camel-ocsf/src/main/resources/schema/DatastoreActivity.json @@ -4,13 +4,10 @@ "title": "DatastoreActivity", "type": "object", "javaType": "org.apache.camel.dataformat.ocsf.model.DatastoreActivity", - "additionalProperties": true, "description": "DatastoreActivity event class.", - "allOf": [ - { - "$ref": "OcsfEvent.json" - } - ], + "extends": { + "$ref": "OcsfEvent.json" + }, "properties": { "actor": { "$ref": "Actor.json" @@ -66,4 +63,4 @@ "additionalProperties": true } } -} \ No newline at end of file +} diff --git a/components/camel-ocsf/src/main/resources/schema/DetectionFinding.json b/components/camel-ocsf/src/main/resources/schema/DetectionFinding.json index 9853fdf4b53e..7723db2e01ec 100644 --- a/components/camel-ocsf/src/main/resources/schema/DetectionFinding.json +++ b/components/camel-ocsf/src/main/resources/schema/DetectionFinding.json @@ -4,13 +4,10 @@ "title": "DetectionFinding", "type": "object", "javaType": "org.apache.camel.dataformat.ocsf.model.DetectionFinding", - "additionalProperties": true, "description": "DetectionFinding event class.", - "allOf": [ - { - "$ref": "OcsfEvent.json" - } - ], + "extends": { + "$ref": "OcsfEvent.json" + }, "properties": { "impact": { "type": "string", diff --git a/components/camel-ocsf/src/main/resources/schema/DhcpActivity.json b/components/camel-ocsf/src/main/resources/schema/DhcpActivity.json index 0f20bdefe3f9..ec37324d7df4 100644 --- a/components/camel-ocsf/src/main/resources/schema/DhcpActivity.json +++ b/components/camel-ocsf/src/main/resources/schema/DhcpActivity.json @@ -4,13 +4,10 @@ "title": "DhcpActivity", "type": "object", "javaType": "org.apache.camel.dataformat.ocsf.model.DhcpActivity", - "additionalProperties": true, "description": "DhcpActivity event class.", - "allOf": [ - { - "$ref": "OcsfEvent.json" - } - ], + "extends": { + "$ref": "OcsfEvent.json" + }, "properties": { "cumulative_traffic": { "type": "object", @@ -86,4 +83,4 @@ "$ref": "Tls.json" } } -} \ No newline at end of file +} diff --git a/components/camel-ocsf/src/main/resources/schema/DnsActivity.json b/components/camel-ocsf/src/main/resources/schema/DnsActivity.json index 7fa54da8703f..ac0e48d0698d 100644 --- a/components/camel-ocsf/src/main/resources/schema/DnsActivity.json +++ b/components/camel-ocsf/src/main/resources/schema/DnsActivity.json @@ -4,13 +4,10 @@ "title": "DnsActivity", "type": "object", "javaType": "org.apache.camel.dataformat.ocsf.model.DnsActivity", - "additionalProperties": true, "description": "DnsActivity event class.", - "allOf": [ - { - "$ref": "OcsfEvent.json" - } - ], + "extends": { + "$ref": "OcsfEvent.json" + }, "properties": { "cumulative_traffic": { "type": "object", @@ -100,4 +97,4 @@ "$ref": "Tls.json" } } -} \ No newline at end of file +} diff --git a/components/camel-ocsf/src/main/resources/schema/EmailActivity.json b/components/camel-ocsf/src/main/resources/schema/EmailActivity.json index 4159a7572275..3905daec35d1 100644 --- a/components/camel-ocsf/src/main/resources/schema/EmailActivity.json +++ b/components/camel-ocsf/src/main/resources/schema/EmailActivity.json @@ -4,13 +4,10 @@ "title": "EmailActivity", "type": "object", "javaType": "org.apache.camel.dataformat.ocsf.model.EmailActivity", - "additionalProperties": true, "description": "EmailActivity event class.", - "allOf": [ - { - "$ref": "OcsfEvent.json" - } - ], + "extends": { + "$ref": "OcsfEvent.json" + }, "properties": { "email": { "type": "object", @@ -86,4 +83,4 @@ "additionalProperties": true } } -} \ No newline at end of file +} diff --git a/components/camel-ocsf/src/main/resources/schema/EntityManagement.json b/components/camel-ocsf/src/main/resources/schema/EntityManagement.json index 4b6220a9f573..d03e0a28c6d1 100644 --- a/components/camel-ocsf/src/main/resources/schema/EntityManagement.json +++ b/components/camel-ocsf/src/main/resources/schema/EntityManagement.json @@ -4,13 +4,10 @@ "title": "EntityManagement", "type": "object", "javaType": "org.apache.camel.dataformat.ocsf.model.EntityManagement", - "additionalProperties": true, "description": "EntityManagement event class.", - "allOf": [ - { - "$ref": "OcsfEvent.json" - } - ], + "extends": { + "$ref": "OcsfEvent.json" + }, "properties": { "actor": { "$ref": "Actor.json" @@ -62,4 +59,4 @@ "additionalProperties": true } } -} \ No newline at end of file +} diff --git a/components/camel-ocsf/src/main/resources/schema/FileActivity.json b/components/camel-ocsf/src/main/resources/schema/FileActivity.json index 4b4000e3fa94..e61964f95164 100644 --- a/components/camel-ocsf/src/main/resources/schema/FileActivity.json +++ b/components/camel-ocsf/src/main/resources/schema/FileActivity.json @@ -4,13 +4,10 @@ "title": "FileActivity", "type": "object", "javaType": "org.apache.camel.dataformat.ocsf.model.FileActivity", - "additionalProperties": true, "description": "FileActivity event class.", - "allOf": [ - { - "$ref": "OcsfEvent.json" - } - ], + "extends": { + "$ref": "OcsfEvent.json" + }, "properties": { "actor": { "$ref": "Actor.json" @@ -59,4 +56,4 @@ "title": "Component" } } -} \ No newline at end of file +} diff --git a/components/camel-ocsf/src/main/resources/schema/FtpActivity.json b/components/camel-ocsf/src/main/resources/schema/FtpActivity.json index 301820a0106a..02cc1d4c4d32 100644 --- a/components/camel-ocsf/src/main/resources/schema/FtpActivity.json +++ b/components/camel-ocsf/src/main/resources/schema/FtpActivity.json @@ -4,13 +4,10 @@ "title": "FtpActivity", "type": "object", "javaType": "org.apache.camel.dataformat.ocsf.model.FtpActivity", - "additionalProperties": true, "description": "FtpActivity event class.", - "allOf": [ - { - "$ref": "OcsfEvent.json" - } - ], + "extends": { + "$ref": "OcsfEvent.json" + }, "properties": { "cumulative_traffic": { "type": "object", @@ -106,4 +103,4 @@ "$ref": "Tls.json" } } -} \ No newline at end of file +} diff --git a/components/camel-ocsf/src/main/resources/schema/GroupManagement.json b/components/camel-ocsf/src/main/resources/schema/GroupManagement.json index 5af2461dd5d7..12f9a44f783e 100644 --- a/components/camel-ocsf/src/main/resources/schema/GroupManagement.json +++ b/components/camel-ocsf/src/main/resources/schema/GroupManagement.json @@ -4,13 +4,10 @@ "title": "GroupManagement", "type": "object", "javaType": "org.apache.camel.dataformat.ocsf.model.GroupManagement", - "additionalProperties": true, "description": "GroupManagement event class.", - "allOf": [ - { - "$ref": "OcsfEvent.json" - } - ], + "extends": { + "$ref": "OcsfEvent.json" + }, "properties": { "privileges": { "type": "array", @@ -58,4 +55,4 @@ "$ref": "Fingerprint.json" } } -} \ No newline at end of file +} diff --git a/components/camel-ocsf/src/main/resources/schema/HttpActivity.json b/components/camel-ocsf/src/main/resources/schema/HttpActivity.json index e2cc82c1b4bf..32851859bf76 100644 --- a/components/camel-ocsf/src/main/resources/schema/HttpActivity.json +++ b/components/camel-ocsf/src/main/resources/schema/HttpActivity.json @@ -4,13 +4,10 @@ "title": "HttpActivity", "type": "object", "javaType": "org.apache.camel.dataformat.ocsf.model.HttpActivity", - "additionalProperties": true, "description": "HttpActivity event class.", - "allOf": [ - { - "$ref": "OcsfEvent.json" - } - ], + "extends": { + "$ref": "OcsfEvent.json" + }, "properties": { "cumulative_traffic": { "type": "object", @@ -92,4 +89,4 @@ "$ref": "Tls.json" } } -} \ No newline at end of file +} diff --git a/components/camel-ocsf/src/main/resources/schema/IncidentFinding.json b/components/camel-ocsf/src/main/resources/schema/IncidentFinding.json index 208cb2013f0d..dd682203f6ac 100644 --- a/components/camel-ocsf/src/main/resources/schema/IncidentFinding.json +++ b/components/camel-ocsf/src/main/resources/schema/IncidentFinding.json @@ -4,13 +4,10 @@ "title": "IncidentFinding", "type": "object", "javaType": "org.apache.camel.dataformat.ocsf.model.IncidentFinding", - "additionalProperties": true, "description": "IncidentFinding event class.", - "allOf": [ - { - "$ref": "OcsfEvent.json" - } - ], + "extends": { + "$ref": "OcsfEvent.json" + }, "properties": { "verdict_id": { "type": "integer", @@ -116,4 +113,4 @@ "title": "Confidence" } } -} \ No newline at end of file +} diff --git a/components/camel-ocsf/src/main/resources/schema/KernelActivity.json b/components/camel-ocsf/src/main/resources/schema/KernelActivity.json index 6eb63cb9f70b..12cd6507f62a 100644 --- a/components/camel-ocsf/src/main/resources/schema/KernelActivity.json +++ b/components/camel-ocsf/src/main/resources/schema/KernelActivity.json @@ -4,13 +4,10 @@ "title": "KernelActivity", "type": "object", "javaType": "org.apache.camel.dataformat.ocsf.model.KernelActivity", - "additionalProperties": true, "description": "KernelActivity event class.", - "allOf": [ - { - "$ref": "OcsfEvent.json" - } - ], + "extends": { + "$ref": "OcsfEvent.json" + }, "properties": { "actor": { "$ref": "Actor.json" @@ -37,4 +34,4 @@ "additionalProperties": true } } -} \ No newline at end of file +} diff --git a/components/camel-ocsf/src/main/resources/schema/KernelExtensionActivity.json b/components/camel-ocsf/src/main/resources/schema/KernelExtensionActivity.json index 0920c11c048c..58b5d6deb3b7 100644 --- a/components/camel-ocsf/src/main/resources/schema/KernelExtensionActivity.json +++ b/components/camel-ocsf/src/main/resources/schema/KernelExtensionActivity.json @@ -4,13 +4,10 @@ "title": "KernelExtensionActivity", "type": "object", "javaType": "org.apache.camel.dataformat.ocsf.model.KernelExtensionActivity", - "additionalProperties": true, "description": "KernelExtensionActivity event class.", - "allOf": [ - { - "$ref": "OcsfEvent.json" - } - ], + "extends": { + "$ref": "OcsfEvent.json" + }, "properties": { "actor": { "$ref": "Actor.json" @@ -37,4 +34,4 @@ "$ref": "Fingerprint.json" } } -} \ No newline at end of file +} diff --git a/components/camel-ocsf/src/main/resources/schema/MemoryActivity.json b/components/camel-ocsf/src/main/resources/schema/MemoryActivity.json index 7fa58c0800c3..506e6de4de29 100644 --- a/components/camel-ocsf/src/main/resources/schema/MemoryActivity.json +++ b/components/camel-ocsf/src/main/resources/schema/MemoryActivity.json @@ -4,13 +4,10 @@ "title": "MemoryActivity", "type": "object", "javaType": "org.apache.camel.dataformat.ocsf.model.MemoryActivity", - "additionalProperties": true, "description": "MemoryActivity event class.", - "allOf": [ - { - "$ref": "OcsfEvent.json" - } - ], + "extends": { + "$ref": "OcsfEvent.json" + }, "properties": { "actor": { "$ref": "Actor.json" @@ -52,4 +49,4 @@ "title": "Requested Permissions" } } -} \ No newline at end of file +} diff --git a/components/camel-ocsf/src/main/resources/schema/ModuleActivity.json b/components/camel-ocsf/src/main/resources/schema/ModuleActivity.json index 868b2f50ee42..3aecd29b2065 100644 --- a/components/camel-ocsf/src/main/resources/schema/ModuleActivity.json +++ b/components/camel-ocsf/src/main/resources/schema/ModuleActivity.json @@ -4,13 +4,10 @@ "title": "ModuleActivity", "type": "object", "javaType": "org.apache.camel.dataformat.ocsf.model.ModuleActivity", - "additionalProperties": true, "description": "ModuleActivity event class.", - "allOf": [ - { - "$ref": "OcsfEvent.json" - } - ], + "extends": { + "$ref": "OcsfEvent.json" + }, "properties": { "actor": { "$ref": "Actor.json" @@ -36,4 +33,4 @@ "$ref": "Fingerprint.json" } } -} \ No newline at end of file +} diff --git a/components/camel-ocsf/src/main/resources/schema/NetworkActivity.json b/components/camel-ocsf/src/main/resources/schema/NetworkActivity.json index 79553916ec9d..4e8ac427656d 100644 --- a/components/camel-ocsf/src/main/resources/schema/NetworkActivity.json +++ b/components/camel-ocsf/src/main/resources/schema/NetworkActivity.json @@ -4,13 +4,10 @@ "title": "NetworkActivity", "type": "object", "javaType": "org.apache.camel.dataformat.ocsf.model.NetworkActivity", - "additionalProperties": true, "description": "NetworkActivity event class.", - "allOf": [ - { - "$ref": "OcsfEvent.json" - } - ], + "extends": { + "$ref": "OcsfEvent.json" + }, "properties": { "cumulative_traffic": { "type": "object", @@ -78,4 +75,4 @@ "$ref": "Tls.json" } } -} \ No newline at end of file +} diff --git a/components/camel-ocsf/src/main/resources/schema/NetworkFileActivity.json b/components/camel-ocsf/src/main/resources/schema/NetworkFileActivity.json index e2ff3d1535f7..148076a93c3a 100644 --- a/components/camel-ocsf/src/main/resources/schema/NetworkFileActivity.json +++ b/components/camel-ocsf/src/main/resources/schema/NetworkFileActivity.json @@ -4,13 +4,10 @@ "title": "NetworkFileActivity", "type": "object", "javaType": "org.apache.camel.dataformat.ocsf.model.NetworkFileActivity", - "additionalProperties": true, "description": "NetworkFileActivity event class.", - "allOf": [ - { - "$ref": "OcsfEvent.json" - } - ], + "extends": { + "$ref": "OcsfEvent.json" + }, "properties": { "cumulative_traffic": { "type": "object", @@ -82,4 +79,4 @@ "$ref": "Tls.json" } } -} \ No newline at end of file +} diff --git a/components/camel-ocsf/src/main/resources/schema/NtpActivity.json b/components/camel-ocsf/src/main/resources/schema/NtpActivity.json index 8cd44affa93a..3271103dd705 100644 --- a/components/camel-ocsf/src/main/resources/schema/NtpActivity.json +++ b/components/camel-ocsf/src/main/resources/schema/NtpActivity.json @@ -4,13 +4,10 @@ "title": "NtpActivity", "type": "object", "javaType": "org.apache.camel.dataformat.ocsf.model.NtpActivity", - "additionalProperties": true, "description": "NtpActivity event class.", - "allOf": [ - { - "$ref": "OcsfEvent.json" - } - ], + "extends": { + "$ref": "OcsfEvent.json" + }, "properties": { "cumulative_traffic": { "type": "object", @@ -91,4 +88,4 @@ "title": "Stratum ID" } } -} \ No newline at end of file +} diff --git a/components/camel-ocsf/src/main/resources/schema/ProcessActivity.json b/components/camel-ocsf/src/main/resources/schema/ProcessActivity.json index a0f48e8d48cc..28b10a641317 100644 --- a/components/camel-ocsf/src/main/resources/schema/ProcessActivity.json +++ b/components/camel-ocsf/src/main/resources/schema/ProcessActivity.json @@ -4,13 +4,10 @@ "title": "ProcessActivity", "type": "object", "javaType": "org.apache.camel.dataformat.ocsf.model.ProcessActivity", - "additionalProperties": true, "description": "ProcessActivity event class.", - "allOf": [ - { - "$ref": "OcsfEvent.json" - } - ], + "extends": { + "$ref": "OcsfEvent.json" + }, "properties": { "actor": { "$ref": "Actor.json" @@ -67,4 +64,4 @@ "title": "Launch Type" } } -} \ No newline at end of file +} diff --git a/components/camel-ocsf/src/main/resources/schema/RdpActivity.json b/components/camel-ocsf/src/main/resources/schema/RdpActivity.json index f661679db350..363ee0b4ed87 100644 --- a/components/camel-ocsf/src/main/resources/schema/RdpActivity.json +++ b/components/camel-ocsf/src/main/resources/schema/RdpActivity.json @@ -4,13 +4,10 @@ "title": "RdpActivity", "type": "object", "javaType": "org.apache.camel.dataformat.ocsf.model.RdpActivity", - "additionalProperties": true, "description": "RdpActivity event class.", - "allOf": [ - { - "$ref": "OcsfEvent.json" - } - ], + "extends": { + "$ref": "OcsfEvent.json" + }, "properties": { "cumulative_traffic": { "type": "object", @@ -115,4 +112,4 @@ "$ref": "Tls.json" } } -} \ No newline at end of file +} diff --git a/components/camel-ocsf/src/main/resources/schema/RemediationActivity.json b/components/camel-ocsf/src/main/resources/schema/RemediationActivity.json index d695116bfdac..76fb7c6988d4 100644 --- a/components/camel-ocsf/src/main/resources/schema/RemediationActivity.json +++ b/components/camel-ocsf/src/main/resources/schema/RemediationActivity.json @@ -4,13 +4,10 @@ "title": "RemediationActivity", "type": "object", "javaType": "org.apache.camel.dataformat.ocsf.model.RemediationActivity", - "additionalProperties": true, "description": "RemediationActivity event class.", - "allOf": [ - { - "$ref": "OcsfEvent.json" - } - ], + "extends": { + "$ref": "OcsfEvent.json" + }, "properties": { "raw_data_size": { "type": "integer", @@ -45,4 +42,4 @@ "$ref": "Fingerprint.json" } } -} \ No newline at end of file +} diff --git a/components/camel-ocsf/src/main/resources/schema/ScanActivity.json b/components/camel-ocsf/src/main/resources/schema/ScanActivity.json index 25fd7122991b..e4bf6b8f1bdb 100644 --- a/components/camel-ocsf/src/main/resources/schema/ScanActivity.json +++ b/components/camel-ocsf/src/main/resources/schema/ScanActivity.json @@ -4,13 +4,10 @@ "title": "ScanActivity", "type": "object", "javaType": "org.apache.camel.dataformat.ocsf.model.ScanActivity", - "additionalProperties": true, "description": "ScanActivity event class.", - "allOf": [ - { - "$ref": "OcsfEvent.json" - } - ], + "extends": { + "$ref": "OcsfEvent.json" + }, "properties": { "schedule_uid": { "type": "string", @@ -81,4 +78,4 @@ "title": "Scanned Folders" } } -} \ No newline at end of file +} diff --git a/components/camel-ocsf/src/main/resources/schema/ScheduledJobActivity.json b/components/camel-ocsf/src/main/resources/schema/ScheduledJobActivity.json index 7bc5c5b65199..00f9f475e4ef 100644 --- a/components/camel-ocsf/src/main/resources/schema/ScheduledJobActivity.json +++ b/components/camel-ocsf/src/main/resources/schema/ScheduledJobActivity.json @@ -4,13 +4,10 @@ "title": "ScheduledJobActivity", "type": "object", "javaType": "org.apache.camel.dataformat.ocsf.model.ScheduledJobActivity", - "additionalProperties": true, "description": "ScheduledJobActivity event class.", - "allOf": [ - { - "$ref": "OcsfEvent.json" - } - ], + "extends": { + "$ref": "OcsfEvent.json" + }, "properties": { "actor": { "$ref": "Actor.json" @@ -37,4 +34,4 @@ "additionalProperties": true } } -} \ No newline at end of file +} diff --git a/components/camel-ocsf/src/main/resources/schema/SecurityFinding.json b/components/camel-ocsf/src/main/resources/schema/SecurityFinding.json index abedb0763ded..7ef0eea41f69 100644 --- a/components/camel-ocsf/src/main/resources/schema/SecurityFinding.json +++ b/components/camel-ocsf/src/main/resources/schema/SecurityFinding.json @@ -4,13 +4,10 @@ "title": "SecurityFinding", "type": "object", "javaType": "org.apache.camel.dataformat.ocsf.model.SecurityFinding", - "additionalProperties": true, "description": "SecurityFinding event class.", - "allOf": [ - { - "$ref": "OcsfEvent.json" - } - ], + "extends": { + "$ref": "OcsfEvent.json" + }, "properties": { "impact": { "type": "string", @@ -153,4 +150,4 @@ } } } -} \ No newline at end of file +} diff --git a/components/camel-ocsf/src/main/resources/schema/SmbActivity.json b/components/camel-ocsf/src/main/resources/schema/SmbActivity.json index f0cb8b8d94d3..d04b8841c33a 100644 --- a/components/camel-ocsf/src/main/resources/schema/SmbActivity.json +++ b/components/camel-ocsf/src/main/resources/schema/SmbActivity.json @@ -4,13 +4,10 @@ "title": "SmbActivity", "type": "object", "javaType": "org.apache.camel.dataformat.ocsf.model.SmbActivity", - "additionalProperties": true, "description": "SmbActivity event class.", - "allOf": [ - { - "$ref": "OcsfEvent.json" - } - ], + "extends": { + "$ref": "OcsfEvent.json" + }, "properties": { "client_dialects": { "type": "array", @@ -116,4 +113,4 @@ "$ref": "Tls.json" } } -} \ No newline at end of file +} diff --git a/components/camel-ocsf/src/main/resources/schema/SshActivity.json b/components/camel-ocsf/src/main/resources/schema/SshActivity.json index c571065349fc..1d39dfb48219 100644 --- a/components/camel-ocsf/src/main/resources/schema/SshActivity.json +++ b/components/camel-ocsf/src/main/resources/schema/SshActivity.json @@ -4,13 +4,10 @@ "title": "SshActivity", "type": "object", "javaType": "org.apache.camel.dataformat.ocsf.model.SshActivity", - "additionalProperties": true, "description": "SshActivity event class.", - "allOf": [ - { - "$ref": "OcsfEvent.json" - } - ], + "extends": { + "$ref": "OcsfEvent.json" + }, "properties": { "cumulative_traffic": { "type": "object", @@ -94,4 +91,4 @@ "$ref": "Tls.json" } } -} \ No newline at end of file +} diff --git a/components/camel-ocsf/src/main/resources/schema/UserAccess.json b/components/camel-ocsf/src/main/resources/schema/UserAccess.json index 3a3bcd1abe17..2238a2501fe4 100644 --- a/components/camel-ocsf/src/main/resources/schema/UserAccess.json +++ b/components/camel-ocsf/src/main/resources/schema/UserAccess.json @@ -4,13 +4,10 @@ "title": "UserAccess", "type": "object", "javaType": "org.apache.camel.dataformat.ocsf.model.UserAccess", - "additionalProperties": true, "description": "UserAccess event class.", - "allOf": [ - { - "$ref": "OcsfEvent.json" - } - ], + "extends": { + "$ref": "OcsfEvent.json" + }, "properties": { "privileges": { "type": "array", @@ -59,4 +56,4 @@ "$ref": "Fingerprint.json" } } -} \ No newline at end of file +} diff --git a/components/camel-ocsf/src/main/resources/schema/VulnerabilityFinding.json b/components/camel-ocsf/src/main/resources/schema/VulnerabilityFinding.json index 63f27baa8148..77d6bf9f95a8 100644 --- a/components/camel-ocsf/src/main/resources/schema/VulnerabilityFinding.json +++ b/components/camel-ocsf/src/main/resources/schema/VulnerabilityFinding.json @@ -4,13 +4,10 @@ "title": "VulnerabilityFinding", "type": "object", "javaType": "org.apache.camel.dataformat.ocsf.model.VulnerabilityFinding", - "additionalProperties": true, "description": "VulnerabilityFinding event class.", - "allOf": [ - { - "$ref": "OcsfEvent.json" - } - ], + "extends": { + "$ref": "OcsfEvent.json" + }, "properties": { "resources": { "type": "array", @@ -69,4 +66,4 @@ "title": "Confidence" } } -} \ No newline at end of file +} diff --git a/components/camel-ocsf/src/main/resources/schema/WebResourcesActivity.json b/components/camel-ocsf/src/main/resources/schema/WebResourcesActivity.json index 75f681766f03..8dbbb3920b86 100644 --- a/components/camel-ocsf/src/main/resources/schema/WebResourcesActivity.json +++ b/components/camel-ocsf/src/main/resources/schema/WebResourcesActivity.json @@ -4,13 +4,10 @@ "title": "WebResourcesActivity", "type": "object", "javaType": "org.apache.camel.dataformat.ocsf.model.WebResourcesActivity", - "additionalProperties": true, "description": "WebResourcesActivity event class.", - "allOf": [ - { - "$ref": "OcsfEvent.json" - } - ], + "extends": { + "$ref": "OcsfEvent.json" + }, "properties": { "raw_data_size": { "type": "integer", @@ -58,4 +55,4 @@ "$ref": "Tls.json" } } -} \ No newline at end of file +} diff --git a/components/camel-ocsf/src/main/script/generate-ocsf-schemas.py b/components/camel-ocsf/src/main/script/generate-ocsf-schemas.py index dc0029ef8120..ad1005d41517 100644 --- a/components/camel-ocsf/src/main/script/generate-ocsf-schemas.py +++ b/components/camel-ocsf/src/main/script/generate-ocsf-schemas.py @@ -446,9 +446,13 @@ def generate_class_schema(ocsf: OcsfJsonSchemaEmbedded, class_name: str, "title": pascal_name, "type": "object", "javaType": f"{JAVA_PACKAGE}.{pascal_name}", - "additionalProperties": True, } + # Only set additionalProperties on classes that don't extend OcsfEvent + # (the parent OcsfEvent already has it, and duplicates cause @JsonAnySetter conflicts) + if not extends_base: + result["additionalProperties"] = True + # Add description if 'description' in schema: result['description'] = schema['description'] @@ -457,7 +461,7 @@ def generate_class_schema(ocsf: OcsfJsonSchemaEmbedded, class_name: str, # Extend base event if extends_base: - result['allOf'] = [{"$ref": "OcsfEvent.json"}] + result['extends'] = {"$ref": "OcsfEvent.json"} # Process properties (excluding base event properties) result['properties'] = {} diff --git a/components/camel-ocsf/src/test/java/org/apache/camel/dataformat/ocsf/OcsfDataFormatTest.java b/components/camel-ocsf/src/test/java/org/apache/camel/dataformat/ocsf/OcsfDataFormatTest.java index af161beb6f70..ade617826004 100644 --- a/components/camel-ocsf/src/test/java/org/apache/camel/dataformat/ocsf/OcsfDataFormatTest.java +++ b/components/camel-ocsf/src/test/java/org/apache/camel/dataformat/ocsf/OcsfDataFormatTest.java @@ -88,12 +88,11 @@ public class OcsfDataFormatTest extends CamelTestSupport { mock.expectedMessageCount(1); DetectionFinding finding = new DetectionFinding(); - // DetectionFinding contains finding-specific attributes - // Base event fields like activity_id, severity_id are captured via additionalProperties - finding.setAdditionalProperty("activity_id", OcsfConstants.ACTIVITY_CREATE); - finding.setAdditionalProperty("severity_id", OcsfConstants.SEVERITY_CRITICAL); - finding.setAdditionalProperty("time", (int) (System.currentTimeMillis() / 1000)); - finding.setAdditionalProperty("class_uid", OcsfConstants.CLASS_DETECTION_FINDING); + // DetectionFinding extends OcsfEvent, so base event fields have typed accessors + finding.setActivityId(OcsfConstants.ACTIVITY_CREATE); + finding.setSeverityId(OcsfConstants.SEVERITY_CRITICAL); + finding.setTime(System.currentTimeMillis() / 1000); + finding.setClassUid(OcsfConstants.CLASS_DETECTION_FINDING); finding.setIsAlert(true); finding.setRiskLevelId(Integer.valueOf(4)); finding.setRiskLevel("High"); @@ -144,9 +143,9 @@ public class OcsfDataFormatTest extends CamelTestSupport { mock.assertIsSatisfied(); DetectionFinding finding = mock.getExchanges().get(0).getIn().getBody(DetectionFinding.class); - // Base event fields are captured in additionalProperties - assertThat(finding.getAdditionalProperties().get("class_uid")).isEqualTo(2004); - assertThat(finding.getAdditionalProperties().get("severity_id")).isEqualTo(5); + // Base event fields are now accessible via typed getters (inherited from OcsfEvent) + assertThat(finding.getClassUid()).isEqualTo(2004); + assertThat(finding.getSeverityId()).isEqualTo(5); assertThat(finding.getIsAlert()).isTrue(); assertThat(finding.getRiskLevel()).isEqualTo("Critical"); assertThat(finding.getFindingInfo()).isNotNull(); diff --git a/components/camel-ocsf/src/test/java/org/apache/camel/dataformat/ocsf/OcsfEventExampleTest.java b/components/camel-ocsf/src/test/java/org/apache/camel/dataformat/ocsf/OcsfEventExampleTest.java index 31d60518ccc1..815ef53f4f1c 100644 --- a/components/camel-ocsf/src/test/java/org/apache/camel/dataformat/ocsf/OcsfEventExampleTest.java +++ b/components/camel-ocsf/src/test/java/org/apache/camel/dataformat/ocsf/OcsfEventExampleTest.java @@ -91,12 +91,12 @@ public class OcsfEventExampleTest extends CamelTestSupport { assertThat(finding.getRemediation()).isNotNull(); assertThat(finding.getRemediation().getDesc()).contains("Investigate the EC2 instance"); - // Base event fields are in additionalProperties - assertThat(finding.getAdditionalProperties().get("class_uid")).isEqualTo(2004); - assertThat(finding.getAdditionalProperties().get("severity_id")).isEqualTo(4); - assertThat(finding.getAdditionalProperties().get("severity")).isEqualTo("High"); + // Base event fields are now accessible via typed getters (inherited from OcsfEvent) + assertThat(finding.getClassUid()).isEqualTo(2004); + assertThat(finding.getSeverityId()).isEqualTo(4); + assertThat(finding.getSeverity()).isEqualTo("High"); - // Verify cloud info in additionalProperties + // Verify cloud info in additionalProperties (cloud is not a base event field) @SuppressWarnings("unchecked") java.util.Map<String, Object> cloud = (java.util.Map<String, Object>) finding.getAdditionalProperties().get("cloud"); assertThat(cloud.get("provider")).isEqualTo("AWS"); @@ -114,17 +114,17 @@ public class OcsfEventExampleTest extends CamelTestSupport { // Create a Detection Finding for a SQL Injection attempt DetectionFinding finding = new DetectionFinding(); - // Set base event fields via additionalProperties - finding.setAdditionalProperty("class_uid", OcsfConstants.CLASS_DETECTION_FINDING); - finding.setAdditionalProperty("class_name", "Detection Finding"); - finding.setAdditionalProperty("category_uid", OcsfConstants.CATEGORY_FINDINGS); - finding.setAdditionalProperty("category_name", "Findings"); - finding.setAdditionalProperty("activity_id", OcsfConstants.ACTIVITY_CREATE); - finding.setAdditionalProperty("activity_name", "Create"); - finding.setAdditionalProperty("severity_id", OcsfConstants.SEVERITY_HIGH); - finding.setAdditionalProperty("severity", "High"); - finding.setAdditionalProperty("time", 1706198400); - finding.setAdditionalProperty("message", "SQL Injection attempt detected in web application"); + // Set base event fields via typed setters (inherited from OcsfEvent) + finding.setClassUid(OcsfConstants.CLASS_DETECTION_FINDING); + finding.setClassName("Detection Finding"); + finding.setCategoryUid(OcsfConstants.CATEGORY_FINDINGS); + finding.setCategoryName("Findings"); + finding.setActivityId(OcsfConstants.ACTIVITY_CREATE); + finding.setActivityName("Create"); + finding.setSeverityId(OcsfConstants.SEVERITY_HIGH); + finding.setSeverity("High"); + finding.setTime(1706198400L); + finding.setMessage("SQL Injection attempt detected in web application"); // Set finding-specific fields finding.setIsAlert(true); @@ -196,7 +196,7 @@ public class OcsfEventExampleTest extends CamelTestSupport { product.setVendorName("MyCompany"); product.setVersion("2.5.0"); metadata.setProduct(product); - finding.setAdditionalProperty("metadata", metadata); + finding.setMetadata(metadata); // Send to marshal template.sendBody("direct:build-finding", finding);
