Skip to content

Commit a72b4e5

Browse files
authored
chore(py-ocsf): update class attributes and oscf version (#42)
1 parent 2fc4f3f commit a72b4e5

File tree

6 files changed

+17
-6
lines changed

6 files changed

+17
-6
lines changed

examples/detection_finding.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,9 @@
146146
version="1.0",
147147
),
148148
cloud=Cloud(
149-
account=Account(name="Account 1", type="Account", type_id="3", uid="123"),
149+
account=Account(
150+
name="Account 1", type="Account", type_id="3", uid="123", labels=["Label 1"]
151+
),
150152
zone="Zone 1",
151153
org=Organization(name="Organization 1", ou_id="123", ou_name="OU 1", uid="123"),
152154
project_uid="123",
@@ -319,6 +321,7 @@
319321
risk_level="Risk Level",
320322
risk_level_id=123,
321323
risk_score=123,
324+
risk_details="Risk Details",
322325
timezone_offset=123,
323326
type_id=123,
324327
type_name="Type Name",

py_ocsf_models/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
OCSF_VERSION = "1.1.0"
1+
OCSF_VERSION = "1.2.0"

py_ocsf_models/events/base_event.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
from py_ocsf_models.objects.metadata import Metadata
88
from py_ocsf_models.objects.observable import Observable
99

10-
OCSF_VERSION = "1.1.0"
11-
1210

1311
class SeverityID(IntEnum):
1412
"""

py_ocsf_models/events/findings/detection_finding.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ class DetectionFinding(Finding, BaseModel):
134134
- Risk Level (risk_level) [Optional]: The risk level, normalized to the caption of the risk_level_id value. In the case of 'Other', it is defined by the event source.
135135
- Risk Level ID (risk_level_id) [Optional]: The normalized risk level id.
136136
- Risk Score (risk_score) [Optional]: The risk score as reported by the event source.
137+
- Risk Details (risk_details) [Optional]: Additional details about the risk.
137138
- Timezone Offset (timezone_offset) [Optional]: Difference in minutes from UTC.
138139
- Type ID (type_uid): The event/finding type ID. It identifies the event's semantics and structure. The value is calculated by the logging system as: class_uid * 100 + activity_id.
139140
- Type Name (type_name) [Optional]: The event/finding type name, as defined by the type_uid.
@@ -168,6 +169,7 @@ class DetectionFinding(Finding, BaseModel):
168169
risk_level: Optional[str]
169170
risk_level_id: Optional[RiskLevelID]
170171
risk_score: Optional[int]
172+
risk_details: Optional[str]
171173
status_id: Optional[StatusID] # type: ignore
172174
timezone_offset: Optional[int]
173175
type_uid: TypeID

py_ocsf_models/objects/account.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,12 @@ class Account(BaseModel):
2828
- Type (type) [Optional]: The account type, normalized to the caption of 'account_type_id'. In the case of 'Other', it is defined by the event source.
2929
- Type ID (type_id) [Recommended]: The normalized account type identifier.
3030
- Unique ID (uid) [Recommended]: The unique identifier of the account (e.g. AWS Account ID).
31+
- Labels (labels) [Optional]: The labels associated with the account.
3132
3233
"""
3334

3435
name: str
3536
type: Optional[str]
3637
type_id: TypeID
3738
uid: str
39+
labels: Optional[list[str]]

tests/detection_finding_test.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
from py_ocsf_models.objects.resource_details import ResourceDetails
3535
from py_ocsf_models.objects.vulnerability_details import VulnerabilityDetails
3636

37-
PROWLER_VERSION = "4.0.0"
37+
PROWLER_VERSION = "4.1.0"
3838
PROWLER_PRODUCT = "Prowler"
3939

4040

@@ -165,7 +165,11 @@ def test_detection_finding(self):
165165
),
166166
cloud=Cloud(
167167
account=Account(
168-
name="Account 1", type="Account", type_id="3", uid="123"
168+
name="Account 1",
169+
type="Account",
170+
type_id="3",
171+
uid="123",
172+
labels=["label 1"],
169173
),
170174
zone="Zone 1",
171175
org=Organization(
@@ -341,6 +345,7 @@ def test_detection_finding(self):
341345
risk_level="Risk Level",
342346
risk_level_id=1,
343347
risk_score=123,
348+
risk_details="Risk Details",
344349
timezone_offset=123,
345350
type_uid=DetectionFindingTypeID.Create,
346351
type_name=DetectionFindingTypeID.Create.name,
@@ -490,6 +495,7 @@ def test_detection_finding(self):
490495
assert detection_finding.cloud.org.name == "Organization 1"
491496
assert detection_finding.cloud.provider == "Provider 1"
492497
assert detection_finding.cloud.region == "Region 1"
498+
assert detection_finding.cloud.account.labels == ["label 1"]
493499

494500
# Assert ContainerProfile and nested objects
495501
container = detection_finding.container

0 commit comments

Comments
 (0)