Skip to content

Commit

Permalink
handle object-markings-refs in SMOs
Browse files Browse the repository at this point in the history
  • Loading branch information
rpiazza committed Sep 10, 2024
1 parent 675746b commit aa8c9a1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion stix2/datastore/relational_db/input_creation.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ def generate_insert_for_core(data_sink, stix_object, core_properties, schema_nam
insert_statements.append(core_insert_statement)

if "object_marking_refs" in stix_object:
if schema_name == "sdo":
if schema_name != "sco":
object_markings_ref_table = data_sink.tables_dictionary["common.object_marking_refs_sdo"]
else:
object_markings_ref_table = data_sink.tables_dictionary["common.object_marking_refs_sco"]
Expand Down
8 changes: 6 additions & 2 deletions stix2/datastore/relational_db/relational_db_testing.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ def extension_definition_insert():
schema="a schema",
version="1.2.3",
extension_types=["property-extension", "new-sdo", "new-sro"],
object_marking_refs=[
"marking-definition--caa0d913-5db8-4424-aae0-43e770287d30",
"marking-definition--122a27a0-b96f-46bc-8fcd-f7a159757e77"
],
granular_markings=[
{
"lang": "en_US",
Expand Down Expand Up @@ -168,7 +172,7 @@ def kill_chain_test():
@stix2.CustomObject('x-custom-type',
properties=[
("phases", stix2.properties.ListProperty(stix2.KillChainPhase)),
("test", stix2.properties.IntegerProperty())
("something_else", stix2.properties.IntegerProperty())
]
)
class CustomClass:
Expand All @@ -183,7 +187,7 @@ def custom_obj():
"phase_name": "the phase name"
}
],
test=5
something_else=5
)
return obj

Expand Down

0 comments on commit aa8c9a1

Please sign in to comment.