contentctl 4.2.5__py3-none-any.whl → 4.3.1__py3-none-any.whl

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.
@@ -8,7 +8,6 @@ from contentctl.objects.enums import SecurityContentProduct, SecurityContentType
8
8
  from contentctl.input.director import Director, DirectorOutputDto
9
9
  from contentctl.output.conf_output import ConfOutput
10
10
  from contentctl.output.conf_writer import ConfWriter
11
- from contentctl.output.ba_yml_output import BAYmlOutput
12
11
  from contentctl.output.api_json_output import ApiJsonOutput
13
12
  from contentctl.output.data_source_writer import DataSourceWriter
14
13
  from contentctl.objects.lookup import Lookup
@@ -86,17 +85,4 @@ class Build:
86
85
 
87
86
  print(f"Build of '{input_dto.config.app.title}' API successful to {input_dto.config.getAPIPath()}")
88
87
 
89
- if input_dto.config.build_ssa:
90
-
91
- srs_path = input_dto.config.getSSAPath() / 'srs'
92
- complex_path = input_dto.config.getSSAPath() / 'complex'
93
- shutil.rmtree(srs_path, ignore_errors=True)
94
- shutil.rmtree(complex_path, ignore_errors=True)
95
- srs_path.mkdir(parents=True)
96
- complex_path.mkdir(parents=True)
97
- ba_yml_output = BAYmlOutput()
98
- ba_yml_output.writeObjects(input_dto.director_output_dto.ssa_detections, str(input_dto.config.getSSAPath()))
99
-
100
- print(f"Build of 'SSA' successful to {input_dto.config.getSSAPath()}")
101
-
102
88
  return input_dto.director_output_dto
@@ -1060,7 +1060,9 @@ class DetectionTestingInfrastructure(BaseModel, abc.ABC):
1060
1060
  results = JSONResultsReader(job.results(output_mode="json"))
1061
1061
 
1062
1062
  # Consolidate a set of the distinct observable field names
1063
- observable_fields_set = set([o.name for o in detection.tags.observable])
1063
+ observable_fields_set = set([o.name for o in detection.tags.observable]) # keeping this around for later
1064
+ risk_object_fields_set = set([o.name for o in detection.tags.observable if "Victim" in o.role ]) # just the "Risk Objects"
1065
+ threat_object_fields_set = set([o.name for o in detection.tags.observable if "Attacker" in o.role]) # just the "threat objects"
1064
1066
 
1065
1067
  # Ensure the search had at least one result
1066
1068
  if int(job.content.get("resultCount", "0")) > 0:
@@ -1068,7 +1070,10 @@ class DetectionTestingInfrastructure(BaseModel, abc.ABC):
1068
1070
  test.result = UnitTestResult()
1069
1071
 
1070
1072
  # Initialize the collection of fields that are empty that shouldn't be
1073
+ present_threat_objects: set[str] = set()
1071
1074
  empty_fields: set[str] = set()
1075
+
1076
+
1072
1077
 
1073
1078
  # Filter out any messages in the results
1074
1079
  for result in results:
@@ -1077,30 +1082,50 @@ class DetectionTestingInfrastructure(BaseModel, abc.ABC):
1077
1082
 
1078
1083
  # If not a message, it is a dict and we will process it
1079
1084
  results_fields_set = set(result.keys())
1085
+ # Guard against first events (relevant later)
1080
1086
 
1081
- # Identify any observable fields that are not available in the results
1082
- missing_fields = observable_fields_set - results_fields_set
1083
- if len(missing_fields) > 0:
1087
+ # Identify any risk object fields that are not available in the results
1088
+ missing_risk_objects = risk_object_fields_set - results_fields_set
1089
+ if len(missing_risk_objects) > 0:
1084
1090
  # Report a failure in such cases
1085
- e = Exception(f"The observable field(s) {missing_fields} are missing in the detection results")
1091
+ e = Exception(f"The observable field(s) {missing_risk_objects} are missing in the detection results")
1086
1092
  test.result.set_job_content(
1087
1093
  job.content,
1088
1094
  self.infrastructure,
1089
- TestResultStatus.ERROR,
1095
+ TestResultStatus.FAIL,
1090
1096
  exception=e,
1091
1097
  duration=time.time() - search_start_time,
1092
1098
  )
1093
1099
 
1094
- return
1100
+ return
1095
1101
 
1096
- # If we find one or more fields that contain the string "null" then they were
1102
+ # If we find one or more risk object fields that contain the string "null" then they were
1097
1103
  # not populated and we should throw an error. This can happen if there is a typo
1098
1104
  # on a field. In this case, the field will appear but will not contain any values
1099
- current_empty_fields = set()
1105
+ current_empty_fields: set[str] = set()
1106
+
1100
1107
  for field in observable_fields_set:
1101
1108
  if result.get(field, 'null') == 'null':
1102
- current_empty_fields.add(field)
1103
-
1109
+ if field in risk_object_fields_set:
1110
+ e = Exception(f"The risk object field {field} is missing in at least one result.")
1111
+ test.result.set_job_content(
1112
+ job.content,
1113
+ self.infrastructure,
1114
+ TestResultStatus.FAIL,
1115
+ exception=e,
1116
+ duration=time.time() - search_start_time,
1117
+ )
1118
+ return
1119
+ else:
1120
+ if field in threat_object_fields_set:
1121
+ current_empty_fields.add(field)
1122
+ else:
1123
+ if field in threat_object_fields_set:
1124
+ present_threat_objects.add(field)
1125
+ continue
1126
+
1127
+
1128
+
1104
1129
  # If everything succeeded up until now, and no empty fields are found in the
1105
1130
  # current result, then the search was a success
1106
1131
  if len(current_empty_fields) == 0:
@@ -1114,21 +1139,32 @@ class DetectionTestingInfrastructure(BaseModel, abc.ABC):
1114
1139
 
1115
1140
  else:
1116
1141
  empty_fields = empty_fields.union(current_empty_fields)
1117
-
1118
- # Report a failure if there were empty fields in all results
1119
- e = Exception(
1120
- f"One or more required observable fields {empty_fields} contained 'null' values. Is the "
1121
- "data being parsed correctly or is there an error in the naming of a field?"
1142
+
1143
+
1144
+ missing_threat_objects = threat_object_fields_set - present_threat_objects
1145
+ # Report a failure if there were empty fields in a threat object in all results
1146
+ if len(missing_threat_objects) > 0:
1147
+ e = Exception(
1148
+ f"One or more required threat object fields {missing_threat_objects} contained 'null' values in all events. "
1149
+ "Is the data being parsed correctly or is there an error in the naming of a field?"
1122
1150
  )
1123
- test.result.set_job_content(
1124
- job.content,
1125
- self.infrastructure,
1126
- TestResultStatus.ERROR,
1127
- exception=e,
1128
- duration=time.time() - search_start_time,
1129
- )
1151
+ test.result.set_job_content(
1152
+ job.content,
1153
+ self.infrastructure,
1154
+ TestResultStatus.FAIL,
1155
+ exception=e,
1156
+ duration=time.time() - search_start_time,
1157
+ )
1158
+ return
1159
+
1130
1160
 
1131
- return
1161
+ test.result.set_job_content(
1162
+ job.content,
1163
+ self.infrastructure,
1164
+ TestResultStatus.PASS,
1165
+ duration=time.time() - search_start_time,
1166
+ )
1167
+ return
1132
1168
 
1133
1169
  else:
1134
1170
  # Report a failure if there were no results at all
@@ -30,7 +30,6 @@ class Validate:
30
30
  [],
31
31
  [],
32
32
  [],
33
- [],
34
33
  )
35
34
 
36
35
  director = Director(director_output_dto)
@@ -28,13 +28,11 @@ from contentctl.enrichments.attack_enrichment import AttackEnrichment
28
28
  from contentctl.enrichments.cve_enrichment import CveEnrichment
29
29
 
30
30
  from contentctl.objects.config import validate
31
- from contentctl.input.ssa_detection_builder import SSADetectionBuilder
32
31
  from contentctl.objects.enums import SecurityContentType
33
32
 
34
33
  from contentctl.objects.enums import DetectionStatus
35
34
  from contentctl.helper.utils import Utils
36
35
 
37
- from contentctl.input.ssa_detection_builder import SSADetectionBuilder
38
36
  from contentctl.objects.enums import SecurityContentType
39
37
 
40
38
  from contentctl.objects.enums import DetectionStatus
@@ -56,7 +54,6 @@ class DirectorOutputDto:
56
54
  macros: list[Macro]
57
55
  lookups: list[Lookup]
58
56
  deployments: list[Deployment]
59
- ssa_detections: list[SSADetection]
60
57
  data_sources: list[DataSource]
61
58
  name_to_content_map: dict[str, SecurityContentObject] = field(default_factory=dict)
62
59
  uuid_to_content_map: dict[UUID, SecurityContentObject] = field(default_factory=dict)
@@ -98,8 +95,6 @@ class DirectorOutputDto:
98
95
  self.stories.append(content)
99
96
  elif isinstance(content, Detection):
100
97
  self.detections.append(content)
101
- elif isinstance(content, SSADetection):
102
- self.ssa_detections.append(content)
103
98
  elif isinstance(content, DataSource):
104
99
  self.data_sources.append(content)
105
100
  else:
@@ -112,11 +107,9 @@ class DirectorOutputDto:
112
107
  class Director():
113
108
  input_dto: validate
114
109
  output_dto: DirectorOutputDto
115
- ssa_detection_builder: SSADetectionBuilder
116
110
 
117
111
  def __init__(self, output_dto: DirectorOutputDto) -> None:
118
112
  self.output_dto = output_dto
119
- self.ssa_detection_builder = SSADetectionBuilder()
120
113
 
121
114
  def execute(self, input_dto: validate) -> None:
122
115
  self.input_dto = input_dto
@@ -129,7 +122,6 @@ class Director():
129
122
  self.createSecurityContent(SecurityContentType.data_sources)
130
123
  self.createSecurityContent(SecurityContentType.playbooks)
131
124
  self.createSecurityContent(SecurityContentType.detections)
132
- self.createSecurityContent(SecurityContentType.ssa_detections)
133
125
 
134
126
 
135
127
  from contentctl.objects.abstract_security_content_objects.detection_abstract import MISSING_SOURCES
@@ -142,12 +134,7 @@ class Director():
142
134
  print("No missing data_sources!")
143
135
 
144
136
  def createSecurityContent(self, contentType: SecurityContentType) -> None:
145
- if contentType == SecurityContentType.ssa_detections:
146
- files = Utils.get_all_yml_files_from_directory(
147
- os.path.join(self.input_dto.path, "ssa_detections")
148
- )
149
- security_content_files = [f for f in files if f.name.startswith("ssa___")]
150
- elif contentType in [
137
+ if contentType in [
151
138
  SecurityContentType.deployments,
152
139
  SecurityContentType.lookups,
153
140
  SecurityContentType.macros,
@@ -179,43 +166,37 @@ class Director():
179
166
  modelDict = YmlReader.load_file(file)
180
167
 
181
168
  if contentType == SecurityContentType.lookups:
182
- lookup = Lookup.model_validate(modelDict,context={"output_dto":self.output_dto, "config":self.input_dto})
169
+ lookup = Lookup.model_validate(modelDict, context={"output_dto":self.output_dto, "config":self.input_dto})
183
170
  self.output_dto.addContentToDictMappings(lookup)
184
171
 
185
172
  elif contentType == SecurityContentType.macros:
186
- macro = Macro.model_validate(modelDict,context={"output_dto":self.output_dto})
173
+ macro = Macro.model_validate(modelDict, context={"output_dto":self.output_dto})
187
174
  self.output_dto.addContentToDictMappings(macro)
188
175
 
189
176
  elif contentType == SecurityContentType.deployments:
190
- deployment = Deployment.model_validate(modelDict,context={"output_dto":self.output_dto})
177
+ deployment = Deployment.model_validate(modelDict, context={"output_dto":self.output_dto})
191
178
  self.output_dto.addContentToDictMappings(deployment)
192
179
 
193
180
  elif contentType == SecurityContentType.playbooks:
194
- playbook = Playbook.model_validate(modelDict,context={"output_dto":self.output_dto})
181
+ playbook = Playbook.model_validate(modelDict, context={"output_dto":self.output_dto})
195
182
  self.output_dto.addContentToDictMappings(playbook)
196
183
 
197
184
  elif contentType == SecurityContentType.baselines:
198
- baseline = Baseline.model_validate(modelDict,context={"output_dto":self.output_dto})
185
+ baseline = Baseline.model_validate(modelDict, context={"output_dto":self.output_dto})
199
186
  self.output_dto.addContentToDictMappings(baseline)
200
187
 
201
188
  elif contentType == SecurityContentType.investigations:
202
- investigation = Investigation.model_validate(modelDict,context={"output_dto":self.output_dto})
189
+ investigation = Investigation.model_validate(modelDict, context={"output_dto":self.output_dto})
203
190
  self.output_dto.addContentToDictMappings(investigation)
204
191
 
205
192
  elif contentType == SecurityContentType.stories:
206
- story = Story.model_validate(modelDict,context={"output_dto":self.output_dto})
193
+ story = Story.model_validate(modelDict, context={"output_dto":self.output_dto})
207
194
  self.output_dto.addContentToDictMappings(story)
208
195
 
209
196
  elif contentType == SecurityContentType.detections:
210
- detection = Detection.model_validate(modelDict,context={"output_dto":self.output_dto, "app":self.input_dto.app})
197
+ detection = Detection.model_validate(modelDict, context={"output_dto":self.output_dto, "app":self.input_dto.app})
211
198
  self.output_dto.addContentToDictMappings(detection)
212
199
 
213
- elif contentType == SecurityContentType.ssa_detections:
214
- self.constructSSADetection(self.ssa_detection_builder, self.output_dto,str(file))
215
- ssa_detection = self.ssa_detection_builder.getObject()
216
- if ssa_detection.status in [DetectionStatus.production.value, DetectionStatus.validation.value]:
217
- self.output_dto.addContentToDictMappings(ssa_detection)
218
-
219
200
  elif contentType == SecurityContentType.data_sources:
220
201
  data_source = DataSource.model_validate(
221
202
  modelDict, context={"output_dto": self.output_dto}
@@ -262,19 +243,3 @@ class Director():
262
243
  f"The following {len(validation_errors)} error(s) were found during validation:\n\n{errors_string}\n\nVALIDATION FAILED"
263
244
  )
264
245
 
265
- def constructSSADetection(
266
- self,
267
- builder: SSADetectionBuilder,
268
- directorOutput: DirectorOutputDto,
269
- file_path: str,
270
- ) -> None:
271
- builder.reset()
272
- builder.setObject(file_path)
273
- builder.addMitreAttackEnrichmentNew(directorOutput.attack_enrichment)
274
- builder.addKillChainPhase()
275
- builder.addCIS()
276
- builder.addNist()
277
- builder.addAnnotations()
278
- builder.addMappings()
279
- builder.addUnitTest()
280
- builder.addRBA()
@@ -46,7 +46,7 @@ class Detection_Abstract(SecurityContentObject):
46
46
  status: DetectionStatus = Field(...)
47
47
  data_source: list[str] = []
48
48
  tags: DetectionTags = Field(...)
49
- search: Union[str, dict[str, Any]] = Field(...)
49
+ search: str = Field(...)
50
50
  how_to_implement: str = Field(..., min_length=4)
51
51
  known_false_positives: str = Field(..., min_length=4)
52
52
 
@@ -65,11 +65,7 @@ class Detection_Abstract(SecurityContentObject):
65
65
 
66
66
  @field_validator("search", mode="before")
67
67
  @classmethod
68
- def validate_presence_of_filter_macro(
69
- cls,
70
- value: Union[str, dict[str, Any]],
71
- info: ValidationInfo
72
- ) -> Union[str, dict[str, Any]]:
68
+ def validate_presence_of_filter_macro(cls, value:str, info:ValidationInfo)->str:
73
69
  """
74
70
  Validates that, if required to be present, the filter macro is present with the proper name.
75
71
  The filter macro MUST be derived from the name of the detection
@@ -83,12 +79,9 @@ class Detection_Abstract(SecurityContentObject):
83
79
 
84
80
  Returns:
85
81
  Union[str, dict[str,Any]]: The search, either in sigma or SPL format.
86
- """
87
-
88
- if isinstance(value, dict):
89
- # If the search is a dict, then it is in Sigma format so return it
90
- return value
91
-
82
+ """
83
+
84
+
92
85
  # Otherwise, the search is SPL.
93
86
 
94
87
  # In the future, we will may add support that makes the inclusion of the
@@ -155,15 +148,16 @@ class Detection_Abstract(SecurityContentObject):
155
148
  @computed_field
156
149
  @property
157
150
  def datamodel(self) -> List[DataModel]:
158
- if isinstance(self.search, str):
159
- return [dm for dm in DataModel if dm.value in self.search]
160
- else:
161
- return []
151
+ return [dm for dm in DataModel if dm.value in self.search]
152
+
153
+
154
+
162
155
 
163
156
  @computed_field
164
157
  @property
165
158
  def source(self) -> str:
166
159
  return self.file_path.absolute().parent.name
160
+
167
161
 
168
162
  deployment: Deployment = Field({})
169
163
 
@@ -249,12 +243,9 @@ class Detection_Abstract(SecurityContentObject):
249
243
  @computed_field
250
244
  @property
251
245
  def providing_technologies(self) -> List[ProvidingTechnology]:
252
- if isinstance(self.search, str):
253
- return ProvidingTechnology.getProvidingTechFromSearch(self.search)
254
- else:
255
- # Dict-formatted searches (sigma) will not have providing technologies
256
- return []
257
-
246
+ return ProvidingTechnology.getProvidingTechFromSearch(self.search)
247
+
248
+
258
249
  @computed_field
259
250
  @property
260
251
  def risk(self) -> list[dict[str, Any]]:
@@ -299,6 +290,11 @@ class Detection_Abstract(SecurityContentObject):
299
290
  risk_object['threat_object_field'] = entity.name
300
291
  risk_object['threat_object_type'] = "url"
301
292
  risk_objects.append(risk_object)
293
+
294
+ elif 'Attacker' in entity.role:
295
+ risk_object['threat_object_field'] = entity.name
296
+ risk_object['threat_object_type'] = entity.type.lower()
297
+ risk_objects.append(risk_object)
302
298
 
303
299
  else:
304
300
  risk_object['risk_object_type'] = 'other'
@@ -445,18 +441,13 @@ class Detection_Abstract(SecurityContentObject):
445
441
 
446
442
  @field_validator('lookups', mode="before")
447
443
  @classmethod
448
- def getDetectionLookups(cls, v: list[str], info: ValidationInfo) -> list[Lookup]:
449
- if info.context is None:
450
- raise ValueError("ValidationInfo.context unexpectedly null")
451
-
452
- director: DirectorOutputDto = info.context.get("output_dto", None)
453
-
454
- search: Union[str, dict[str, Any], None] = info.data.get("search", None)
455
- if not isinstance(search, str):
456
- # The search was sigma formatted (or failed other validation and was None), so we will
457
- # not validate macros in it
458
- return []
459
-
444
+ def getDetectionLookups(cls, v:list[str], info:ValidationInfo) -> list[Lookup]:
445
+ director:DirectorOutputDto = info.context.get("output_dto",None)
446
+
447
+ search:Union[str,None] = info.data.get("search",None)
448
+ if search is None:
449
+ raise ValueError("Search was None - is this file missing the search field?")
450
+
460
451
  lookups = Lookup.get_lookups(search, director)
461
452
  return lookups
462
453
 
@@ -496,11 +487,9 @@ class Detection_Abstract(SecurityContentObject):
496
487
 
497
488
  director: DirectorOutputDto = info.context.get("output_dto", None)
498
489
 
499
- search: str | dict[str, Any] | None = info.data.get("search", None)
500
- if not isinstance(search, str):
501
- # The search was sigma formatted (or failed other validation and was None), so we will
502
- # not validate macros in it
503
- return []
490
+ search: str | None = info.data.get("search", None)
491
+ if search is None:
492
+ raise ValueError("Search was None - is this file missing the search field?")
504
493
 
505
494
  search_name: Union[str, Any] = info.data.get("name", None)
506
495
  message = f"Expected 'search_name' to be a string, instead it was [{type(search_name)}]"
@@ -614,45 +603,43 @@ class Detection_Abstract(SecurityContentObject):
614
603
 
615
604
  @model_validator(mode="after")
616
605
  def search_observables_exist_validate(self):
617
- if isinstance(self.search, str):
606
+ observable_fields = [ob.name.lower() for ob in self.tags.observable]
618
607
 
619
- observable_fields = [ob.name.lower() for ob in self.tags.observable]
608
+ # All $field$ fields from the message must appear in the search
609
+ field_match_regex = r"\$([^\s.]*)\$"
620
610
 
621
- # All $field$ fields from the message must appear in the search
622
- field_match_regex = r"\$([^\s.]*)\$"
623
-
624
- missing_fields: set[str]
625
- if self.tags.message:
626
- matches = re.findall(field_match_regex, self.tags.message.lower())
627
- message_fields = [match.replace("$", "").lower() for match in matches]
628
- missing_fields = set([field for field in observable_fields if field not in self.search.lower()])
629
- else:
630
- message_fields = []
631
- missing_fields = set()
632
-
633
- error_messages: list[str] = []
634
- if len(missing_fields) > 0:
635
- error_messages.append(
636
- "The following fields are declared as observables, but do not exist in the "
637
- f"search: {missing_fields}"
638
- )
611
+ missing_fields: set[str]
612
+ if self.tags.message:
613
+ matches = re.findall(field_match_regex, self.tags.message.lower())
614
+ message_fields = [match.replace("$", "").lower() for match in matches]
615
+ missing_fields = set([field for field in observable_fields if field not in self.search.lower()])
616
+ else:
617
+ message_fields = []
618
+ missing_fields = set()
619
+
620
+ error_messages: list[str] = []
621
+ if len(missing_fields) > 0:
622
+ error_messages.append(
623
+ "The following fields are declared as observables, but do not exist in the "
624
+ f"search: {missing_fields}"
625
+ )
639
626
 
640
- missing_fields = set([field for field in message_fields if field not in self.search.lower()])
641
- if len(missing_fields) > 0:
642
- error_messages.append(
643
- "The following fields are used as fields in the message, but do not exist in "
644
- f"the search: {missing_fields}"
645
- )
627
+ missing_fields = set([field for field in message_fields if field not in self.search.lower()])
628
+ if len(missing_fields) > 0:
629
+ error_messages.append(
630
+ "The following fields are used as fields in the message, but do not exist in "
631
+ f"the search: {missing_fields}"
632
+ )
646
633
 
647
- # NOTE: we ignore the type error around self.status because we are using Pydantic's
648
- # use_enum_values configuration
649
- # https://docs.pydantic.dev/latest/api/config/#pydantic.config.ConfigDict.populate_by_name
650
- if len(error_messages) > 0 and self.status == DetectionStatus.production.value: # type: ignore
651
- msg = (
652
- "Use of fields in observables/messages that do not appear in search:\n\t- "
653
- "\n\t- ".join(error_messages)
654
- )
655
- raise ValueError(msg)
634
+ # NOTE: we ignore the type error around self.status because we are using Pydantic's
635
+ # use_enum_values configuration
636
+ # https://docs.pydantic.dev/latest/api/config/#pydantic.config.ConfigDict.populate_by_name
637
+ if len(error_messages) > 0 and self.status == DetectionStatus.production.value: # type: ignore
638
+ msg = (
639
+ "Use of fields in observables/messages that do not appear in search:\n\t- "
640
+ "\n\t- ".join(error_messages)
641
+ )
642
+ raise ValueError(msg)
656
643
 
657
644
  # Found everything
658
645
  return self
@@ -175,7 +175,6 @@ class validate(Config_Base):
175
175
  "be avoided for performance reasons.")
176
176
  build_app: bool = Field(default=True, description="Should an app be built and output in the build_path?")
177
177
  build_api: bool = Field(default=False, description="Should api objects be built and output in the build_path?")
178
- build_ssa: bool = Field(default=False, description="Should ssa objects be built and output in the build_path?")
179
178
  data_source_TA_validation: bool = Field(default=False, description="Validate latest TA information from Splunkbase")
180
179
 
181
180
  def getAtomicRedTeamRepoPath(self, atomic_red_team_repo_name:str = "atomic-red-team"):
@@ -577,7 +576,6 @@ class test_common(build):
577
576
  # output to dist. We have already built it!
578
577
  self.build_app = False
579
578
  self.build_api = False
580
- self.build_ssa = False
581
579
  self.enrichments = False
582
580
 
583
581
  self.enable_integration_testing = True
@@ -132,3 +132,8 @@ SES_ATTACK_TACTICS_ID_MAPPING = {
132
132
  "Exfiltration": "TA0010",
133
133
  "Impact": "TA0040"
134
134
  }
135
+
136
+ RBA_OBSERVABLE_ROLE_MAPPING = {
137
+ "Attacker": 0,
138
+ "Victim": 1
139
+ }
@@ -1,5 +1,5 @@
1
1
  from pydantic import BaseModel, field_validator
2
- from contentctl.objects.constants import SES_OBSERVABLE_TYPE_MAPPING, SES_OBSERVABLE_ROLE_MAPPING
2
+ from contentctl.objects.constants import SES_OBSERVABLE_TYPE_MAPPING, RBA_OBSERVABLE_ROLE_MAPPING
3
3
 
4
4
 
5
5
  class Observable(BaseModel):
@@ -26,10 +26,12 @@ class Observable(BaseModel):
26
26
  def check_roles(cls, v: list[str]):
27
27
  if len(v) == 0:
28
28
  raise ValueError("Error, at least 1 role must be listed for Observable.")
29
+ if len(v) > 1:
30
+ raise ValueError("Error, each Observable can only have one role.")
29
31
  for role in v:
30
- if role not in SES_OBSERVABLE_ROLE_MAPPING.keys():
32
+ if role not in RBA_OBSERVABLE_ROLE_MAPPING.keys():
31
33
  raise ValueError(
32
34
  f"Invalid role '{role}' provided for observable. Valid observable types are "
33
- f"{SES_OBSERVABLE_ROLE_MAPPING.keys()}"
35
+ f"{RBA_OBSERVABLE_ROLE_MAPPING.keys()}"
34
36
  )
35
37
  return v
@@ -53,11 +53,11 @@ tags:
53
53
  - name: parent_process_name
54
54
  type: Process
55
55
  role:
56
- - Parent Process
56
+ - Attacker
57
57
  - name: process_name
58
58
  type: Process
59
59
  role:
60
- - Child Process
60
+ - Attacker
61
61
  product:
62
62
  - Splunk Enterprise
63
63
  - Splunk Enterprise Security
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: contentctl
3
- Version: 4.2.5
3
+ Version: 4.3.1
4
4
  Summary: Splunk Content Control Tool
5
5
  License: Apache 2.0
6
6
  Author: STRT
@@ -19,12 +19,10 @@ Requires-Dist: gitpython (>=3.1.43,<4.0.0)
19
19
  Requires-Dist: pycvesearch (>=1.2,<2.0)
20
20
  Requires-Dist: pydantic (>=2.7.1,<3.0.0)
21
21
  Requires-Dist: pygit2 (>=1.14.1,<2.0.0)
22
- Requires-Dist: pysigma (>=0.11.5,<0.12.0)
23
- Requires-Dist: pysigma-backend-splunk (>=1.1.0,<2.0.0)
24
22
  Requires-Dist: questionary (>=2.0.1,<3.0.0)
25
23
  Requires-Dist: requests (>=2.32.2,<2.33.0)
26
24
  Requires-Dist: semantic-version (>=2.10.0,<3.0.0)
27
- Requires-Dist: setuptools (>=69.5.1,<73.0.0)
25
+ Requires-Dist: setuptools (>=69.5.1,<74.0.0)
28
26
  Requires-Dist: splunk-sdk (>=2.0.1,<3.0.0)
29
27
  Requires-Dist: tqdm (>=4.66.4,<5.0.0)
30
28
  Requires-Dist: tyro (>=0.8.3,<0.9.0)
@@ -36,8 +34,20 @@ Description-Content-Type: text/markdown
36
34
  <p align="center">
37
35
  <img src="docs/contentctl_logo_white.png" title="In case you're wondering, it's a capybara" alt="contentctl logo" width="250" height="250"></p>
38
36
 
39
-
40
-
37
+ # contentctl Quick Start Guide
38
+ If you are already familiar with contentctl, the following common commands may be very useful for basic operations
39
+
40
+ | Operation | Command |
41
+ |-----------|---------|
42
+ | Create a repository | `contentctl init` |
43
+ | Validate Your Content | `contentctl validate` |
44
+ | Validate Your Content, performing MITRE Enrichments | `contentctl validate –-enrichments`|
45
+ | Build Your App | `contentctl build` |
46
+ | Test All the content in your app, pausing so that you can debug a search if it fails | `contentctl test –-post-test-behavior pause_on_failure mode:all` |
47
+ | Test All the content in your app, pausing after every detection to allow debugging | `contentctl test –-post-test-behavior always_pause mode:all` |
48
+ | Test 1 or more specified detections. If you are testing more than one detection, the paths are space-separated. You may also use shell-expanded regexes | `contentctl test –-post-test-behavior always_pause mode:selected --mode.files detections/endpoint/7zip_commandline_to_smb_share_path.yml detections/cloud/aws_multi_factor_authentication_disabled.yml detections/application/okta*` |
49
+ | Diff your current branch with a target_branch and test detections that have been updated. Your current branch **must be DIFFERENT** than the target_branch | `contentctl test –-post-test-behavior always_pause mode:changes –-mode.target_branch develop` |
50
+ | Perform Integration Testing of all content. Note that Enterprise Security MUST be listed as an app in your contentctl.yml folder, otherwise all tests will subsequently fail | `contentctl test –-enable-integration-testing --post-test-behavior never_pause mode:all` |
41
51
 
42
52
  # Introduction
43
53
  #### Security Is Hard