Michael Chisholm
ac8e46f491
Improve customization detection in the face of
...
toplevel-property-extension style extensions. If an unregistered
extension of that type is encountered, all unrecognized toplevel
props will now be considered extension properties (not custom).
It will no longer turn on the allow_custom flag, which would
allow customizations everywhere.
Also, if all extensions of the aforementioned type are registered,
their properties are now used to properly distinguish between
extension and custom properties. There need not be any ambiguity
in that case.
2021-06-30 20:20:29 -04:00
Michael Chisholm
d87718c15c
Bug fixes, hackage removal, and some pre-commit stylistic
...
fixes.
- Fixed bugged logic in _STIXBase._check_at_least_one_property(),
and revamped the code to be simpler and clearer.
- Changed custom extension registration to auto-create an
"extension_type" property based on the attribute of that
name on the custom class, if present.
- The custom extension registration change above uncovered
what seemed like a bug in a unit test: a custom extension
was registered, but it was not given an extension type. The
test used the extension as extension_type="property-extension";
this now causes a standard error about an extra property. I
fixed the test to assign the custom extension the proper type.
2021-06-30 17:50:00 -04:00
Chris Lenk
94859a0daf
Fix tests, add a loophole to allow custom content
...
The "loophole" occurs when an object contains an unregistered top-level
extension. Since it's unregistered we can't tell if any custom
properties on the object were defined in that extension so we assume
that they are.
2021-06-14 17:34:06 -04:00
Chris Lenk
2528077eb0
Merge branch 'master' into dev-extensions-proposal
2021-06-13 01:48:33 -04:00
Emmanuelle Vargas-Gonzalez
5d83d44d0e
adding documentation on specific lines, typos, and a bit of extra code
2021-04-15 12:28:58 -04:00
Chris Lenk
a002c1736d
Update guide docs, remove outdated comments
2021-04-14 16:39:56 -04:00
Emmanuelle Vargas-Gonzalez
bc053da3c4
Merge branch 'master' of github.com:oasis-open/cti-python-stix2 into dev-extensions-proposal
2021-03-31 18:53:02 -04:00
Michael Chisholm
d2f960f2fc
Initial revamp of customization enforcement and detection.
2021-03-31 15:21:55 -04:00
Emmanuelle Vargas-Gonzalez
dd6b847b10
small tweaks and pre-commit changes
2021-03-31 12:44:15 -04:00
Emmanuelle Vargas-Gonzalez
9cc2e5bd3a
remove backwards compatible imports, remove pretty=True from _STIXBase.__str()__, and simplify _STIXBase.__repr()__ (breaking)
2021-03-31 11:02:05 -04:00
Emmanuelle Vargas-Gonzalez
bde9aaa13e
update some TODOs and clear out some backwards kept imports (breaking)
2021-03-30 22:40:41 -04:00
Emmanuelle Vargas-Gonzalez
922de111ed
minor tweaks to docstrings
2021-03-18 10:14:36 -04:00
Emmanuelle Vargas-Gonzalez
827f622c04
provide ability to stream STIX output to fp ``.write()`` file-like object
2021-03-17 15:01:49 -04:00
Emmanuelle Vargas-Gonzalez
479cff818a
few leftover changes...
2021-02-19 22:15:11 -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
ef2ef95c3a
`stix-extension` to `extension-definition`
2020-12-22 21:59:18 -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
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
ca56a74e12
update docstrings for _STIXBase method
2020-07-22 15:20:39 -04:00
Emmanuelle Vargas-Gonzalez
c760e04c9a
rename module to serialization.py
2020-07-22 14:31:26 -04:00
Emmanuelle Vargas-Gonzalez
853bd0da21
move classes and methods from base.py to serialize.py
2020-07-22 13:56:24 -04:00
Chris Lenk
55ea84ece2
Fix bug when adding custom obj to FileSystemSink
...
... if the object type hasn't been registered.
Related: #439 .
2020-07-20 00:04:32 -04:00
Chris Lenk
9d05c9d3e2
Merge pull request #401 from chisholm/fix_versionable_detection
...
Fix versionability detection
2020-06-10 10:22:59 -04:00
Michael Chisholm
00b78e7a47
Stylistic pre-commit junk
2020-06-08 17:51:13 -04:00
Michael Chisholm
5522050899
Improve versionability detection when creating new versions
...
of objects. Move versioning-related stuff out of stix2.utils
to its own module. Some misc versioning-related fixes.
2020-06-05 14:24:16 -04:00
Michael Chisholm
f17f782134
Bugfixes to the json un-escaping function. Added some unit tests
...
for that.
2020-06-05 14:14:44 -04:00
Michael Chisholm
2179028c91
Fix deterministic ID behavior when an empty "hashes" property is
...
given. Now, an exception is raised. Added a unit test for this.
2020-06-05 14:14:44 -04:00
Michael Chisholm
1f5e8defd3
Argh, I fixed an RFC URL but forgot to fix the comment which
...
described it and gave the RFC number...
2020-06-05 14:14:43 -04:00
Michael Chisholm
22c0d5806c
Trailing comma for the pre-commit hook
2020-06-05 14:14:43 -04:00
Michael Chisholm
e22c37a16b
Update a RFC URL to the latest version. I'd accidentally used
...
one which had been obsoleted by a newer one.
2020-06-05 14:14:43 -04:00
Michael Chisholm
6c2c4781e7
Revamp deterministic ID generation code to fix bugs.
2020-06-05 14:14:43 -04:00
Desai, Kartikey H
998b4c0725
Change streamlined_obj_vals list to streamlined_object dict
2020-05-13 12:45:16 -05:00
Desai, Kartikey H
65d4060e6a
Fixes #389
2020-05-13 11:23:26 -05:00
Desai, Kartikey H
0b1297b14a
Fixes #389
2020-05-13 11:22:51 -05:00
Desai, Kartikey H
de3fa99a12
Add property names to canonicalization for deterministic id gen
2020-05-13 11:20:16 -05: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
Rich Piazza
9e5e998c3d
don't allow leading '_' on custom properties, whenever allow_custom is true
2020-03-20 12:49:20 -04:00
Rich Piazza
6e4151aeeb
flaky
2020-03-19 16:49:46 -04:00
Rich Piazza
f60e4170fd
finish 365
2020-03-19 16:11:52 -04:00
Rich Piazza
9699c78ad8
issue-365
2020-03-19 10:40:35 -04:00
Desai, Kartikey H
796a4e20fa
Correct bug in recursive dict loop. Fixes #334
2020-02-21 15:26:19 -05:00
Desai, Kartikey H
1084c75d33
Fixes #334
2020-02-19 16:29:13 -05:00
Chris Lenk
6c0fba0e67
Add Python3.8 support, fix import
...
Uses try/catch to still support 2.7 too
2020-01-04 13:50:06 -05:00
Desai, Kartikey H
6df7da65b8
Fixes #308
2019-12-17 11:57:55 -05:00
Michael Chisholm
216b43d49e
Fix determinstic UUID handling when there are high-codepoint
...
unicode characters. Make compatible with both python 2 and 3.
2019-10-11 17:12:44 -04:00
Desai, Kartikey H
113d481e84
Make SCO deterministic ID namespace a global var for better software hygiene
2019-09-19 10:31:14 -04:00