Michael Chisholm
8bbf5fa461
Make extension instances work the same as other objects, with
...
respect to properties. Before, properties were declared on
toplevel-property-extension extensions as if they were going
to be used in the normal way (as actual properties on instances
of the extension), but they were not used that way, and there
was some ugly hackage to make it work. Despite the fact that
property instances were given during extension registration,
they were not used to typecheck, set defaults, etc on toplevel
property extension properties.
I changed how registration and object initialization works with
respect to properties associated with extensions. Now,
extensions work the same as any other object and code is
cleaner. Property instances associated with registered toplevel
extensions are used to enforce requirements like any other
object.
Added some unit tests specifically for property cleaning for
extensions.
Property order (for those contexts where it matters) is updated
to be spec-defined, toplevel extension, custom.
2021-07-06 14:27:40 -04:00
Michael Chisholm
93d2524d45
Remove excessive nested lists from CusomObservable decorator.
...
Remove iterable chaining from CustomObject decorator. If all
values are guaranteed lists now, it no longer makes sense to use
it. Simpler and clearer to use plain old list concatenation.
2021-07-02 21:10:52 -04:00
Michael Chisholm
b9eba77008
Move the CustomExtension decorator from the v21.observables module
...
to v21.common. Custom extensions are not specific to SCOs, so I
don't know why it was in that module. Now, ExtensionDefinition
and CustomExtension are together in the same module, just like
MarkingDefinition and CustomMarking are together. Made sense to
me.
2021-07-02 20:54:54 -04:00
Chris Lenk
2528077eb0
Merge branch 'master' into dev-extensions-proposal
2021-06-13 01:48:33 -04:00
Michael Chisholm
e735b537c7
Remove a workaround which was used in the 2.0 and 2.1 Report
...
objects, to structure object_refs type requirements as an empty
blacklist, instead of a whitelist. I think it was originally
necessary due to the older implementation of ReferenceProperty
which was in place at the time. With the implementation change
to invert whitelists with generics to blacklists when
allow_custom=True, a "full" whitelist is internally converted to
an empty blacklist anyway, so it winds up being the same thing.
But I think the full whitelist looks better in the code, so I
prefer that to the empty blacklist.
2021-03-31 20:56:31 -04:00
Emmanuelle Vargas-Gonzalez
af046beeb5
add new-sdo or new-sro option in CustomObject decorator, add a test, and example in guide
2021-03-31 18:46:37 -04:00
Michael Chisholm
c590de8ea5
Add proper customization enforcement for open vocabs. This adds
...
a new OpenVocabProperty class. It also requires a redesign of
HashesProperty and redoes general library support for hash
algorithms.
2021-03-31 16:20:28 -04:00
Michael Chisholm
387ce7e7cb
Fix Report SDO: I'd fixed ReferenceProperty to work the way I
...
thought it should, but forgot to fix Report to use
ReferenceProperty in the way I thought it should! Oops.
Added some tests to ensure Report is working property with
custom ID types in object_refs.
2021-03-31 15:22:00 -04:00
Michael Chisholm
d2f960f2fc
Initial revamp of customization enforcement and detection.
2021-03-31 15:21:55 -04:00
Emmanuelle Vargas-Gonzalez
d5e6226c82
update hyperlinks to STIX 2.1 CS 02
2021-02-19 23:27:41 -05:00
Emmanuelle Vargas-Gonzalez
9043a9dc8e
Merge branch 'master' of github.com:oasis-open/cti-python-stix2 into dev-extensions-proposal
2021-02-19 21:54:46 -05:00
Chris Lenk
b4a0a9ea10
Remove six dependency (backwards breaking)
...
We've already removed Python 2 from our test harness, but this removes
all python 2 compatibility code left in.
2021-02-18 12:38:35 -05:00
Emmanuelle Vargas-Gonzalez
82390ba648
Merge branch 'master' of github.com:oasis-open/cti-python-stix2 into dev-extensions-proposal
2021-01-15 13:01:30 -05:00
Emmanuelle Vargas-Gonzalez
85c14d1502
all changes from add-trailing-commas v2.0.2
2021-01-13 17:52:15 -05:00
Emmanuelle Vargas-Gonzalez
6a6f13c37b
rename the Class auto-naming from 'STIXExtension' to 'ExtensionDefinition'
2020-12-23 16:07:30 -05:00
Emmanuelle Vargas-Gonzalez
4127ea9afd
modify main codebase based on 7.3 Extension changes
2020-12-22 21:41:46 -05:00
Emmanuelle Vargas-Gonzalez
33a472d8f5
define Incident stub
2020-12-22 17:46:29 -05:00
Emmanuelle Vargas-Gonzalez
49985cc51d
fix ordering problem with Class definitions
2020-11-18 19:01:12 -05:00
Emmanuelle Vargas-Gonzalez
e4165f96aa
major changes to support the extension mechanism
...
moved some version specific logic into their area, changes to decorators to support Object Registration with Extension
2020-11-10 18:32:58 -05:00
Emmanuelle Vargas-Gonzalez
4340be13c4
changes to the ExtensionsProperty
2020-11-09 20:58:34 -05:00
Emmanuelle Vargas-Gonzalez
b17f502e8f
expose the "extensions" property on all object types
...
remove restriction on MarkingDefinition Object
2020-10-19 22:18:45 -04:00
Emmanuelle Vargas-Gonzalez
97dfe092f9
re-order properties
2020-10-19 19:23:30 -04:00
Emmanuelle Vargas-Gonzalez
9a0cb02ab3
nit-pick on v21 Indicator constructor
2020-06-30 13:58:19 -04:00
Chris Lenk
b2ee33208f
Set STIX 2.1 as default, fix indicator.valid_from
2020-06-26 16:43:19 -04:00
Chris Lenk
df92770d25
Merge pull request #384 from oasis-open/365-versioned-classes
...
Validate custom type/property name formats
2020-04-03 17:30:24 -04:00
Chris Lenk
9145bdf5e8
Merge pull request #374 from chisholm/version_precision
...
Support STIX 2.1 version precision
2020-04-03 15:52:42 -04:00
Chris Lenk
03cb225932
Merge branch 'master' into 365-versioned-classes
2020-04-02 06:02:20 -04:00
Chris Lenk
c494a2e477
Use TypeProperty.clean() to verify type format
2020-04-01 21:52:04 -04:00
Rich Piazza
46219bf072
add 2.1 links
2020-03-27 09:36:10 -04:00
Chris Lenk
01ba190525
Reorganize bases, use isinstance to check version
...
Renamed STIXDomainObject -> _DomainObject.
Renamed STIXRelationshipObject -> _RelationshipObject.
2020-03-27 02:40:42 -04:00
Chris Lenk
e31634c32b
Rework spec version detection for _STIXBase objs
2020-03-21 22:22:36 -04:00
Michael Chisholm
4aa69fa7c9
Add support for enforcing STIX 2.1 minimum precision requirement
...
on versioning timestamps.
2020-03-16 20:25:38 -04:00
Chris Lenk
5abc139e79
Merge branch 'khdesai-fix_issue_338'; Close #347
2020-03-12 09:30:52 -04:00
Chris Lenk
3dd9351d38
Bring back lang, confidence for Course of Action
2020-03-12 09:24:43 -04:00
Desai, Kartikey H
82517ae284
Fixes #338
2020-03-12 09:24:43 -04:00
Desai, Kartikey H
8885a757cb
Fix properties spec version back to 2.1, and re-adjust tests. Fixes #338
2020-03-12 09:24:43 -04:00
Desai, Kartikey H
36f7035785
Fixes #338
2020-03-12 09:24:43 -04:00
Chris Lenk
e782d095ea
Merge pull request #369 from chisholm/malware_os_refs
...
Change software SCO: os_execution_envs -> operating_system_refs
2020-03-11 23:47:14 -04:00
Chris Lenk
33fb31421b
Merge pull request #357 from chisholm/malware_analysis_result
...
Update malware-analysis SDO's av_result property
2020-03-11 09:16:34 -04:00
Chris Lenk
bdf7cab8fe
Merge pull request #356 from chisholm/malware_analysis_sample_ref
...
Add the "sample_ref" property to malware-analysis SDOs
2020-03-11 09:12:02 -04:00
Michael Chisholm
792cc570d7
Change the os_execution_envs property of software SCOs to
...
operating_system_refs, and add a test for it.
2020-03-06 19:43:47 -05:00
Michael Chisholm
d2bff4d411
Update malware-analysis SDO's av_result property: replace it with
...
result and result_name properties. Per:
https://github.com/oasis-tcs/cti-stix2/issues/213
2020-02-27 17:26:04 -05:00
Michael Chisholm
50eb188190
Add the "sample_ref" property to malware-analysis SDOs, per:
...
https://github.com/oasis-tcs/cti-stix2/issues/210
2020-02-27 16:40:56 -05:00
Michael Chisholm
31c37a9b12
Changed several *_types properties which were formerly required,
...
to be optional, due to a STIX spec change. Updated unit tests
accordingly.
2020-02-25 20:07:47 -05:00
Desai, Kartikey H
4350680e79
Introduce and relocate version-based pattern checking. Fixes #307
2020-01-04 10:24:17 -05:00
Desai, Kartikey H
a18612bdfb
Fixes #307
2020-01-04 10:24:17 -05:00
Chris Lenk
cde57ce8f7
Merge pull request #315 from khdesai/fix_issue_308
...
Fix issue 308
2019-12-17 12:13:25 -05:00
Desai, Kartikey H
6df7da65b8
Fixes #308
2019-12-17 11:57:55 -05:00
Desai, Kartikey H
3a46d42aaa
parse() handles observables in 2.1. Change mechanism for (in)valid_types in ReferenceProperty. Fix _custom_observable_builder to include ReferenceProperty instead of ObjectReferenceProperty, and added ID property to custom observables
2019-12-06 09:35:36 -05:00
Zach Rush
806c6c52d9
Added tests for other changes, and moved attribute defaults to an init function
2019-11-25 15:52:50 -05:00