Commit Graph

749 Commits (631460f45f83a7b50b7db221c60edaa9c0cc89d5)

Author SHA1 Message Date
Michael Chisholm 9693c16cd1 Adjust import order to satisfy tox import check 2018-11-27 15:24:07 -05:00
Michael Chisholm 428a18ded2 Implemented clenk's suggested changes in multi-version filesystem
store:
- Use utils.get_type_from_id() instead of my own (I didn't know it
  was already there)
- Use dict-style instead of attribute-style access to get stix
  object properties
- Convert timezone-aware timestamps to UTC in _timestamp2filename()
  to ensure that different times always result in different
  filenames.

Also added a couple new tests for _timestamp2filename(), which
exercises the timezone conversion code.
2018-11-27 15:24:07 -05:00
Michael Chisholm 0096835cfc Add multi-version support to the filesystem datastore.
Factored out the _is_marking() function from the memory datastore
module to utils so it can be reused, and changed both filesystem
and memory datastore modules to import and use it.
2018-11-27 15:24:07 -05:00
Chris Lenk c4668f5dc1
Revert "Multi version filesystem store" 2018-11-07 10:10:06 -05:00
Chris Lenk 150457c1bb
Merge pull request #222 from chisholm/multi_version_filesystem_store
Multi version filesystem store
2018-11-06 16:32:07 -05:00
Michael Chisholm b235e5773c Added some tests for adding markings to sinks and stores. 2018-11-06 16:15:33 -05:00
Michael Chisholm 9f83f2140b Ran trailing-whitespace pre-commit hook. It changed a bunch of
files, in ways we don't completely understand...
2018-11-06 15:10:40 -05:00
Michael Chisholm a8d9aef673 Add some newer versions of a couple of object IDs in the stix2
test data corpus.  Updated filesystem store tests accordingly:
- Remove comments from all_versions tests stating that multiple
  versions are not supported.  Improve the tests to ensure that
  all versions are in fact retrieved.
- Update the get() test to assure that it gets only the latest
  version, when there is more than one version.
- Update some count checks, since there are more objects now
- Fix some typos
2018-11-01 20:25:00 -04:00
Michael Chisholm e2d9325356 Adjust import order to satisfy tox import check 2018-11-01 20:25:00 -04:00
Michael Chisholm ee57596d6a Implemented clenk's suggested changes in multi-version filesystem
store:
- Use utils.get_type_from_id() instead of my own (I didn't know it
  was already there)
- Use dict-style instead of attribute-style access to get stix
  object properties
- Convert timezone-aware timestamps to UTC in _timestamp2filename()
  to ensure that different times always result in different
  filenames.

Also added a couple new tests for _timestamp2filename(), which
exercises the timezone conversion code.
2018-11-01 20:25:00 -04:00
Michael Chisholm 9486b46f77 Add multi-version support to the filesystem datastore.
Factored out the _is_marking() function from the memory datastore
module to utils so it can be reused, and changed both filesystem
and memory datastore modules to import and use it.
2018-11-01 20:25:00 -04:00
Chris Lenk 3b297c17b5 Use consistent errors for observable extensions
Whether or not the Observable type is in the EXT_MAP already, using a
custom extension without also using allow_custom=True should result in
the same behavior/error message.
2018-11-01 17:23:55 -04:00
Emmanuelle Vargas-Gonzalez 493bd65ead Update README and refactor code to make 2.0 default. Update some tests 2018-11-01 09:21:02 -04:00
Emmanuelle Vargas-Gonzalez 5e5d10e7aa Finish alignment of 2.1 components 2018-11-01 08:17:34 -04:00
Emmanuelle Vargas-Gonzalez eff5369670 Merge branch 'master' of github.com:oasis-open/cti-python-stix2 into stix2.1 2018-11-01 07:57:09 -04:00
Chris Lenk 3542604b02
Merge pull request #209 from chisholm/taxii_api_updates
Fixed a test fixture to call the cti-taxii-client Collection constructor correctly
2018-10-31 12:04:34 -04:00
Chris Lenk db300d1f21 Fix `created` millisecond precision in TLPs
A marking definition's `created` property doesn't require millisecond
preprecision, but for TLP markings the TLP instances provided in the
spec must be used and they all use millisecond precision.
2018-10-25 13:58:21 -04:00
Michael Chisholm cbe8d22d0a Added support to multi-version memory stores for markings. Also
added some more unit tests which test storing/retrieving markings
from the stores.
2018-10-17 20:54:53 -04:00
Emmanuelle Vargas-Gonzalez d614343910 Rename tests with duplicate name. 2018-10-17 07:56:10 -04:00
Emmanuelle Vargas-Gonzalez 352749edb0 Add constrains to ObservedData and Sighting, tests updated. 2018-10-17 07:47:25 -04:00
Emmanuelle Vargas-Gonzalez f8a72b0937 Custom builder code updated for 3.7 support.
Updated properties to support more constrains.
Make all regexes literal strings.
Update tests to align to new constrains.
Workbench problem. _check_object_constraints() uses instance class to
perform proper class resolution calls.
2018-10-17 07:34:15 -04:00
Michael Chisholm 864ba05b71 Fix import order to satisfy isort-check 2018-10-15 19:23:28 -04:00
Michael Chisholm d9f6a213c1 Fixed Memory source/sink/store so that it supports multiple versions
of objects.  Fixed several bugs too.
2018-10-15 18:02:49 -04:00
Emmanuelle Vargas-Gonzalez acd86c80dd Update tests to new object constraints 2018-10-15 14:48:52 -04:00
Michael Chisholm 541c682bf6 Fixed a test fixture to call the cti-taxii-client Collection
constructor correctly.  It had been recently changed to address
issue #39 in that library.
2018-09-07 17:47:24 -04:00
mbastian1135 5648d2bc45 added to pattern guide; reverting pattern str conversion (as was already proper) 2018-08-30 11:57:20 -04:00
Emmanuelle Vargas-Gonzalez 211b8d8cee Add core tests and minor change to parse_observable() 2018-07-25 20:53:53 -04:00
Emmanuelle Vargas-Gonzalez ad76e7155c MALWARE RESTORE POINT - Reverted changes to Malware based on STIX 2.1 CSD01
Use this commit to restore Malware changes.
2018-07-25 13:34:56 -04:00
Emmanuelle Vargas-Gonzalez 21c84acc8f Add missing properties to Relationship object and update tests 2018-07-25 12:44:46 -04:00
Emmanuelle Vargas-Gonzalez af2a5605ce Add constraints to Location object 2018-07-25 12:43:57 -04:00
Emmanuelle Vargas-Gonzalez 40d656c94c Minor changes to tests. 2018-07-25 12:43:08 -04:00
Emmanuelle Vargas-Gonzalez 51a499cb33 Formatting changes made by the new pre-commit hook 'add trailing commas'
closes #189
2018-07-13 11:10:05 -04:00
Emmanuelle Vargas-Gonzalez 965d7fa788 Update v20 and v21 tests
In v20, only minor stuff that was addressing wrong spec. In v21, align tests with new/changed properties in the specs
2018-07-12 14:33:00 -04:00
Emmanuelle Vargas-Gonzalez 281dbfb0f4 Align tests with news additions from 'master' branch. 2018-07-11 09:43:37 -04:00
Emmanuelle Vargas-Gonzalez a042970a1f Merge branch 'master' of github.com:oasis-open/cti-python-stix2 into stix2.1 2018-07-11 09:41:42 -04:00
Emmanuelle Vargas-Gonzalez 6bd797e258 Fix 'test_memory_store_object_with_custom_property_in_bundle'
Since Bundles objects are now added instead of the Bundle itself, it now works as intended.
2018-07-10 16:19:40 -04:00
Emmanuelle Vargas-Gonzalez c91bcd43f6 Fix location for test_object_property 2018-07-10 16:11:07 -04:00
Emmanuelle Vargas-Gonzalez 48e0442439 Fix tests in 'test_properties.py' 2018-07-10 16:10:01 -04:00
Emmanuelle Vargas-Gonzalez d24cddb547 Temporarily skip failing tests in workbench for v20, but the approach needs to be fixed 2018-07-10 16:08:36 -04:00
Emmanuelle Vargas-Gonzalez 4583da3ef2 Sort imports 2018-07-10 16:05:30 -04:00
Emmanuelle Vargas-Gonzalez ce42c02cee Fix tests that use property objects to call in the right path 2018-07-10 15:56:22 -04:00
Emmanuelle Vargas-Gonzalez 645a258c62 Fix file indentation 2018-07-10 14:46:46 -04:00
Emmanuelle Vargas-Gonzalez edd7148e3c It appears we did not support the case when the Bundle contains 'utf-8' 2018-07-09 15:26:57 -04:00
Emmanuelle Vargas-Gonzalez 70a1e9522b Add 'stix2_data' test directory for v20 tests 2018-07-09 15:22:08 -04:00
Emmanuelle Vargas-Gonzalez 0197f9fd17 Minor fixes to tests. Some datastore had strange parameters in calls.
Fix error values for CustomMarking and fix incorrect test data
2018-07-09 15:20:04 -04:00
Emmanuelle Vargas-Gonzalez 646d941032 Removed 'test_memory' file and moved all tests into 'test_datastore_memory'
The tests under 'test_memory' were moved into a new file called 'test_datastore_composite' to make clear what we are testing.
2018-07-09 15:15:29 -04:00
Emmanuelle Vargas-Gonzalez 546216c396 Remove unnecessary 'True' in Memory datastore tests. 2018-07-09 15:07:05 -04:00
Emmanuelle Vargas-Gonzalez 21d5451d1c Small changes to tests 2018-07-06 14:11:59 -04:00
Greg Back 49c1931b4b
Merge pull request #203 from oasis-open/200-filter-contains
Add "contains" filter
2018-07-05 15:47:09 -05:00
Emmanuelle Vargas-Gonzalez 5be1636b10 Update v20 tests to ensure right methods and classes are used 2018-07-05 15:23:25 -04:00
Emmanuelle Vargas-Gonzalez 2c5ddc14af Update v21 tests for some missing methods, ensure we are calling and
using the right classes.
2018-07-05 15:21:09 -04:00
Greg Back 25409b2099 GH-188: Update error message for invalid IDs. 2018-07-05 11:25:48 -05:00
Emmanuelle Vargas-Gonzalez bfa86bf87e Format objects in observed_data 2018-07-03 10:32:04 -04:00
Emmanuelle Vargas-Gonzalez 04680d8a3d First pass at making sure everything uses v21 classes and representations 2018-07-03 09:40:51 -04:00
Emmanuelle Vargas-Gonzalez 3100fa1fb8 Move v20 tests to their own package 2018-07-03 07:02:57 -04:00
Emmanuelle Vargas-Gonzalez da5b16dc2f Create v21 test package with new spec changes 2018-07-03 07:00:18 -04:00
Chris Lenk f47809eaaf Add "contains" filter
This allows filtering on, for example, observed-data objects that
contain a specific cyber observable.
2018-07-02 18:28:27 -04:00
Emmanuelle Vargas-Gonzalez c2f5a40986 Create new test subpackages 2018-06-30 19:36:54 -04:00
Greg Back a2e2407025 GH-188: Fixes for old Python syntax. 2018-06-27 12:49:00 -05:00
Greg Back d2f703b9d0 Reuse reference regex to match IDs as well.
Note that this means that UUIDs will no longer be converted, even when
there's an unambiguous mapping.
2018-06-27 12:27:44 -05:00
Greg Back e749218f9b GH-188: Test that references are always valid UUID v4. 2018-06-27 12:02:13 -05:00
Greg Back e5903f1832 Sort constants. 2018-06-27 11:36:17 -05:00
Greg Back 845625c174 GH-188: WIP: Converting all IDs to be valid UUID v4. 2018-06-27 11:35:55 -05:00
Emmanuelle Vargas-Gonzalez 59fdd3082e Update tests. 2018-06-26 12:29:20 -04:00
Emmanuelle Vargas-Gonzalez abd172eb3f Merge branch 'master' of github.com:oasis-open/cti-python-stix2 into stix2.1 2018-06-25 08:25:57 -04:00
Greg Back b2c6acfbf6 GH-188: Restrict valid UUID values. 2018-06-22 14:40:30 -05:00
Greg Back fdf5937a71 GH-194: Remove unnecessary allow_custom kwarg. 2018-06-21 12:15:28 -05:00
Greg Back 7baeb153fa Correct "image_weight" to "image_width".
Fix #194.
2018-06-20 15:24:27 -05:00
Greg Back 53a1a0329a Merge branch 'master' into stix2.1 2018-06-15 10:04:00 -05:00
Michael Chisholm f09960d7ff Revamp code related to "pretty" JSON serialization, fix lurking
crash bugs.
2018-06-14 21:29:50 -04:00
Michael Chisholm 486c588306 Fix silly isort check errors.. 2018-06-14 15:56:02 -04:00
Michael Chisholm 3101584b3d Fix test_bundle to compare against stix2.1 relationships. The
fixture those particular tests use creates 2.1 relationships.
2018-06-14 15:56:02 -04:00
Michael Chisholm 0c3f826c24 First cut at splitting the Bundle implementation into v20 and
v21 variants.  Also fixed up unit tests and got them passing
again.
2018-06-14 15:56:02 -04:00
Michael Chisholm ef8d45723f Update many unit tests to work with the malware2.1 API changes
I made.  The bundle tests and Bundle itself have not been fixed
yet in this commit.
2018-06-14 15:56:01 -04:00
Greg Back 2e0dfc6592 Merge remote-tracking branch 'origin/master' into stix2.1 2018-06-14 12:42:06 -05:00
Greg Back 858a9752df
Merge pull request #185 from LiamSennitt/master
fix custom STIX objects with nested dictionary error #184
2018-06-12 14:40:55 -05:00
Emmanuelle Vargas-Gonzalez fcffb165ad Add tests for `find_property_index` and `iterate_over_values` 2018-06-12 14:38:35 -04:00
Emmanuelle Vargas-Gonzalez 94d6610ca1 Merge branch 'master' of github.com:LiamSennitt/cti-python-stix2 2018-06-12 12:58:01 -04:00
Emmanuelle Vargas-Gonzalez 9be819ea6a Minor tweaks to return immediately after recursive call. Ensure dicts are matched alphabetically 2018-06-12 12:57:25 -04:00
Liam Sennitt bdec14937d fix flake8 errors in new test 2018-06-12 17:45:48 +01:00
Liam Sennitt 02894b5be6 add test for nested dictionary case 2018-06-12 17:32:46 +01:00
Michael Chisholm 5a9f627669 Pickle-proof stix objects 2018-06-06 15:30:45 -04:00
Greg Back 3e159abd4d WIP: Merge branch 'master' into stix2.1 2018-05-23 10:43:52 -05:00
Greg Back d67f2da0ea
Merge pull request #181 from oasis-open/http_error
Http error
2018-05-22 12:53:29 -05:00
= e484b7c25f formatting 2018-05-18 11:45:40 -04:00
= 6004ec597c solution to get 404 mocking problem 2018-05-18 11:19:05 -04:00
Chris Lenk ddc09f70c7 Set allow_custom if using a custom_properties dict
Fixes #179.
2018-05-17 09:04:44 -04:00
Chris Lenk cf972479ed Pass allow_custom to object dicts in a Bundle 2018-05-16 15:37:30 -04:00
= 8fc421e7d4 think the mock client was erroneous for get_object(), couldnt get object by id, just returned random object 2018-05-16 15:17:34 -04:00
= a3313bc08f creating native DataSourceError exception class to wrap taxii client and server errors 2018-05-16 13:23:50 -04:00
Chris Lenk 69c31ca3fc Pass allow_custom to ExtensionsProperty
Also fix bug caused by _properties being a class variable rather than an
instance variable. If you created an object with allow_custom,
allow_custom would be set for all future instances.
2018-05-16 12:14:33 -04:00
= 2b4c5bf264 handling and modifying exception messages in a manner acceptable by all python versions 2018-05-15 17:42:19 -04:00
= 0d3f80f2fe removing taxii 503 error test as not reproducible in Travis environment 2018-05-15 15:41:46 -04:00
= 2392912533 handle TAXII client/server errors according to decided policy 2018-05-15 11:28:34 -04:00
Chris Lenk 06e5a33639 Pass allow_custom when adding to ObservedData 2018-05-11 17:28:55 -04:00
Chris Lenk 4229c380a2 Fix make_constant when value is already a constant
Fixes #171.
2018-04-26 10:20:46 -04:00
Emmanuelle Vargas-Gonzalez c15267971d Remove 'real_stix_objs1' as it is unused in the tests 2018-04-23 14:55:06 -04:00
Emmanuelle Vargas-Gonzalez 2043a514e1 Add two more tests for the `dict` case in TAXIICollectionSink 2018-04-23 14:47:32 -04:00
Emmanuelle Vargas-Gonzalez 7e5c8a9409 Sort import statements in tests. 2018-04-23 14:27:36 -04:00
Emmanuelle Vargas-Gonzalez 2fe9a0f297 Finish adding new tests for TAXII datastore. closes #148 2018-04-23 14:15:02 -04:00
Emmanuelle Vargas-Gonzalez e4a226cae6 Finish merging all the changes from @mbastian1135 2018-04-23 14:14:16 -04:00
Emmanuelle Vargas-Gonzalez 488012d39d Add support for 'real_stix_objs' for test cases 2018-04-23 14:12:54 -04:00
Emmanuelle Vargas-Gonzalez 99a8f9e871 Merge branch 'master' into issue-148
# Conflicts:
#	stix2/test/test_datastore.py
#	tox.ini
2018-04-23 11:04:28 -04:00
Emmanuelle Vargas-Gonzalez 988dad79b9 WIP: Mock TAXIIClient Collection Endpoint 2018-04-23 09:11:59 -04:00
Emmanuelle Vargas-Gonzalez 84c09d7a8f Rename stix object fixture 2018-04-23 09:08:29 -04:00
Chris Lenk 14dce03616 Provide default for revoked, sighting:summary.
This allows filter on un-revoked objects. Changes default JSONEncoder to
drop optional properties with default values in the spec if set to the
default value. They can be included by passing
include_optional_defaults=True to serialize().
2018-04-16 14:37:07 -04:00
Chris Lenk 14d3543906
Merge branch 'master' into invalid-type-names 2018-04-13 16:38:17 -04:00
Chris Lenk f127d145c4
Merge pull request #166 from oasis-open/139-dict-filter-value
139 dict filter value
2018-04-13 16:35:32 -04:00
= 6df23e7268 removed unecessary checks, (clearly I need to review python ref model) 2018-04-13 16:06:31 -04:00
Chris Lenk a475fc6dbd Disallow invalid type names in custom classes 2018-04-13 14:52:00 -04:00
Chris Lenk a8b8bfe88b
Merge pull request #165 from oasis-open/161-dictionaryproperty-fixes
Allow dictionaries in a ListProperty
2018-04-13 14:39:04 -04:00
= a614a78e22 rm testing lines 2018-04-13 14:21:44 -04:00
= eba1844535 tweak to filter property checking to make sure original object property is not altered; added tests for this as well 2018-04-13 14:01:33 -04:00
Chris Lenk 58be98104f
Merge pull request #164 from oasis-open/157-allow-generic-custom-observables
Allow generic custom observables and custom observable extensions
2018-04-13 12:38:02 -04:00
= abe252e248 Merge branch 'master' of https://github.com/oasis-open/cti-python-stix2 into 139-dict-filter-value 2018-04-13 12:35:47 -04:00
= 61e091baf3 added FilterSet class for internal use; modified certain parsing processes to make deepcopies or suppled values(dicts) so as to taint original user passed data; added Filter logic to handle datetime objects; added/adjusted tests accordingly 2018-04-13 12:25:12 -04:00
Chris Lenk fc6a33b23e Disallow missing 'type' property with allow_custom
There was a bug where if you allowed custom content the library would parse an
object without the required 'type' property.
2018-04-13 11:18:56 -04:00
= 1a1e5e1616 WIP- getting close though 2018-04-13 11:08:03 -04:00
Emmanuelle Vargas-Gonzalez a8b7be88d0 Add support for pretty print case list of dictionaries. 2018-04-13 11:04:07 -04:00
Chris Lenk d08be151f7 Allow a ListProperty of DictionaryProperties 2018-04-12 21:26:48 -04:00
Chris Lenk 91376586d4 Simplify allowing custom observables/extensions 2018-04-12 16:33:08 -04:00
Chris Lenk 9ef5b395a8 Fix allowing custom observables and extensions 2018-04-12 14:20:24 -04:00
= 31fc1c369a still WIP 2018-04-12 12:03:07 -04:00
= 333fea4d18 merge conflicts 2018-04-11 21:08:37 -04:00
= ba6fa595c6 WIP - finding more issues with allowing dicts as filters 2018-04-11 20:54:16 -04:00
Chris Lenk 3e048ef325 Fix deprecated 3.6 backslash-character pairs
(https://docs.python.org/3/whatsnew/3.6.html#deprecated-python-behavior)
2018-04-11 15:46:17 -04:00
Chris Lenk b633fd3785 WIP: Allow custom observables, extensions 2018-04-10 12:54:27 -04:00
Chris Lenk 5c5ca1f21c Move 'extensions' property to custom Observables
... from custom Observable extensions (an extension doesn't need an
'extensions' property).
2018-04-09 15:35:08 -04:00
Chris Lenk b851afba01 Req. custom extension properties as list of tuples 2018-04-09 15:34:39 -04:00
Emmanuelle Vargas-Gonzalez 1ff640de3c Moved some test methods here 2018-04-06 14:24:15 -04:00
Emmanuelle Vargas-Gonzalez cd85683f2b WIP: Cleaned test_datastore to only include base store tests 2018-04-06 14:23:48 -04:00
Emmanuelle Vargas-Gonzalez 0d1729bbd7 Deleted test_filesystem in favor of test_datastore_filesystem.py 2018-04-06 14:20:39 -04:00
Emmanuelle Vargas-Gonzalez 80e4706ac4 Add some test objs previously in test_datastore.py 2018-04-06 14:19:51 -04:00
Emmanuelle Vargas-Gonzalez c2e7cbb3e3 Moved from test_datastore.py -> new file test_datastore_taxii.py 2018-04-06 14:18:05 -04:00
Emmanuelle Vargas-Gonzalez 59ff0c4f26 Moved from test_datastore.py -> new file test_datastore_memory.py 2018-04-06 14:17:49 -04:00
Emmanuelle Vargas-Gonzalez 5c4472cbbd Moved from test_datastore.py -> new file test_datastore_filters.py 2018-04-06 14:17:19 -04:00
Emmanuelle Vargas-Gonzalez 8f58f29358 Moved from test_datastore.py -> new file test_datastore_filesystem.py 2018-04-06 14:16:04 -04:00
Greg Back a1ad90d43f
Merge pull request #150 from oasis-open/38-workbench
Create Workbench layer
2018-04-05 10:09:23 -05:00
Chris Lenk e3bbc39353 Fix bug with mutable default parameter 2018-04-05 10:07:35 -04:00
Chris Lenk 589c00064b Remove query_by_type
It's not that much of a shortcut and we can add it back in later if it
makes sense.
2018-04-04 14:09:54 -04:00
Greg Back f61bc5e5ee
Merge pull request #154 from oasis-open/code-coverage
Increase code coverage, fix patterning bugs
2018-04-03 15:11:15 -05:00
Chris Lenk dd8f0f5c72 Increase code coverage slightly
An Environment will always have a CompositeDataSource, so there was no way
those exceptions could get raised.
2018-04-02 16:44:57 -04:00
Chris Lenk 3abfe7868a Add more patterning tests
... and fix bugs detected in doing so
2018-04-02 16:38:04 -04:00
= 90834c5b95 docs and tests for parse() mod 2018-03-30 13:21:07 -04:00
Chris Lenk d453bf6f1a Add a couple granular markings tests 2018-03-30 13:12:51 -04:00
Chris Lenk 4a2ac6df3a Add/fix workbench docs, rename add() -> save() 2018-03-30 12:04:31 -04:00
Chris Lenk b9bbd03481 Update workbench imports and documentation
Import a bunch of stuff so users can just "from stix2.workbench import *" and
not need to import other stuff (e.g. MarkingDefinition, Cyber Observable
Object classes, etc.) from stix2.
2018-03-30 12:04:31 -04:00
Chris Lenk e48e0886a8 Improve code coverage slightly
Environment will always have a CompositeDataSource, so the try/catches
in add_filter/s did not make sense.
2018-03-30 12:02:27 -04:00
Chris Lenk 4fb24f14de Allow passing add'l filters to related_to() 2018-03-30 12:02:27 -04:00
Chris Lenk 61733ad899 Add functions to set ObjectFactory default values 2018-03-30 12:02:27 -04:00
Chris Lenk fd6d9f74e9 Move query_by_type() to DataStoreMixin 2018-03-30 12:02:27 -04:00
Chris Lenk 53c2d4fadf Allow add'l filters in workbench query functions 2018-03-30 12:02:27 -04:00
Chris Lenk e91b71f300 Test adding a data source to the workbench 2018-03-30 12:02:27 -04:00
Chris Lenk 5285934034 Make Workbench use implicit ObjectFactory
This is needed to implement functions like `set_default_creator`.

The changes to Tox are so that the wrapping we do in workbench doesn't
affect the rest of our tests. If we test them all in one go, pytest will
import all the tests before running any of them. This will cause the
workbench versions of the SDO classes to be used in all tests.
2018-03-30 12:02:27 -04:00
Chris Lenk b2613ca62c Add Workbench wrapper functions 2018-03-30 12:02:27 -04:00
Chris Lenk aeff8f4bc0 Create Workbench layer
Contains a default implicit Environment and functions to get all objects
a specific type.
2018-03-30 12:02:27 -04:00
= 89cf4bc38f WIP:allow unknown custom objects to be processed by parse; WIP: splitting up parse utility into components; found bug in tests that wasnt providing for proper teardown cleaning, fixed 2018-03-29 11:49:30 -04:00
Greg Back e92db2417a
Merge pull request #147 from oasis-open/119-taxii-filters
119 taxii filters
2018-03-28 15:24:28 -05:00
= 51dcd6c184 same as last commit 2018-03-22 11:46:49 -04:00
= b1579ae265 same as last commit 2018-03-22 11:36:35 -04:00
= 9f19245c8a modify tests for python 3.x acceptance 2018-03-22 11:23:48 -04:00
= 536e56836c adding Filter check when the Filter property is 'type', checks the value has no underscores (issue #136) 2018-03-22 10:59:07 -04:00
= 7880e4a89b passing TAXII query params in correct format to taxii2client; patching bug where TAXII query filters were being applied again locally to STIX objects via Filters (which doesnt work) 2018-03-21 17:19:05 -04:00
Chris Lenk 4e5eb88458 Increase versioning code coverage slightly 2018-03-16 16:38:29 -04:00
= 2fbde05e6c putting test files in stix type folder that exists on git (bc there are files in it) 2018-03-14 19:34:07 -04:00
= f4558c0958 pre-commit errors 2018-03-14 19:09:25 -04:00
= af14cd4f88 more type checking of filesystem json files; added corresponding tests 2018-03-14 16:28:44 -04:00
Chris Lenk 5a71ef2e64 Fix allow_custom in functions calling new_version 2018-03-02 11:32:07 -05:00
Chris Lenk 1eab9b2832 Assume custom properties allowable in add_markings 2018-03-02 10:21:51 -05:00
Chris Lenk 5f703509be Rename "sources" subpackage to "datastore"
Fix #114.
2018-03-01 09:04:42 -05:00
Chris Lenk 7bdf786f89 Remove deprecated tests 2018-02-27 12:17:26 -05:00
Chris Lenk 57eb709c48 Merge branch 'master' into taxii_collection_source_404 2018-02-26 17:08:28 -05:00
Emmanuelle Vargas-Gonzalez b6c22010bb Fix imports for test_location.py 2018-02-23 08:52:34 -05:00
Emmanuelle Vargas-Gonzalez 06974c72f5 Merge branch 'master' of github.com:oasis-open/cti-python-stix2 into stix2.1 2018-02-23 08:21:16 -05:00
Chris Lenk 5427e79d71 Fix pycodestyle/isort issues 2018-02-19 15:03:20 -05:00
Chris Lenk 845934033e Avoid checking valid refs when deepcopying
Using `deepcopy` on an Observable object that referenced another (e.g.
domain name -> resolves to -> IPv4 address) would fail because no
`_valid_refs` were available. Assuming that the references have
already been checked and are valid when using `deepcopy`, we can use a
special value ('*') to skip the valid_refs check.

This will also allow creating new versions of ObservedData objects that
contain related objects, since `new_version` calls `deepcopy`.
2018-02-19 14:44:28 -05:00
Emmanuelle Vargas-Gonzalez 722d46c6c5 Merge branch 'master' of github.com:oasis-open/cti-python-stix2 into stix2.1 2017-12-08 09:36:59 -05:00
Greg Back 126094106e Merge branch 'master' into taxii_collection_source_404 2017-11-29 22:13:16 +00:00
= 742d249ee0 trying to fix timing bug 2017-11-29 12:50:13 -05:00
= 52a052d4dd removing debug lines; attemting to fix a Travis test error 2017-11-29 12:27:20 -05:00
= 2399ee62ec adjusting tests 2017-11-29 12:03:10 -05:00
Greg Back 98ca928dea
Merge pull request #111 from oasis-open/89-relationships
Support de-referencing relationships
2017-11-27 14:19:29 +00:00
Chris Lenk 6446be310c Clean up relationships code 2017-11-21 15:57:35 -05:00
Chris Lenk 92f7e706bf Improve error handling in relationships/related_to 2017-11-21 10:29:57 -05:00
Greg Back f481788e1e
Merge pull request #112 from samcornwell/get_type_from_id
Add get_type_from_id utility function
2017-11-20 15:19:24 +00:00
Sam Cornwell 78612530ff added tests for get_type_from_id 2017-11-19 22:27:31 -05:00
Emmanuelle Vargas-Gonzalez c03ecb5230 Update test modules 2017-11-17 08:50:40 -05:00
Chris Lenk 515ff1e53f Clean up test 2017-11-16 16:50:27 -05:00
Chris Lenk cfa18bfd0d Improve Environment tests 2017-11-16 16:43:27 -05:00
Chris Lenk 29dec997a0 Add related_to()
Function for calling relationships() but instead of just returning the
Relationship objects, returns the STIX objects being refered to in those
Relationships.
2017-11-16 14:58:59 -05:00
Chris Lenk 1b816c3d84 Test relationships() functions 2017-11-15 16:34:07 -05:00
Emmanuelle Vargas-Gonzalez e6a8b555d3 Add test for CustomMarking. closes #109 2017-11-15 13:12:00 -05:00
Chris Lenk f9ad7ceb65 Add relationships() function to Environment 2017-11-13 11:09:56 -05:00
Emmanuelle Vargas-Gonzalez da66f10147 Make DataStore a regular class, remove unwanted overrides, update tests. Remove CustomProperty since it is no longer needed 2017-11-08 13:53:21 -05:00
Emmanuelle Vargas-Gonzalez 489e45ad1b Merge branch 'master' of github.com:oasis-open/cti-python-stix2 into issue-98 2017-11-08 10:31:49 -05:00
Greg Back 5aa8c66bfc
Merge pull request #97 from oasis-open/memory-tests
Test MemoryStore saving/loading to/from file
2017-11-08 14:59:27 +00:00
Emmanuelle Vargas-Gonzalez 19818c8573 Remove stray print() 2017-11-06 14:21:29 -05:00
Emmanuelle Vargas-Gonzalez 0d5859b906 Test other CompositeDataSource operations 2017-11-03 15:13:00 -04:00
Emmanuelle Vargas-Gonzalez 79475586d8 Revert object_properties() to #85 fix. Update tests accordingly 2017-11-03 14:17:36 -04:00
Emmanuelle Vargas-Gonzalez d6c14139f3 Extend object serialization options for _STIXBase 2017-11-03 08:02:32 -04:00
Emmanuelle Vargas-Gonzalez cd6c7982af Update tests related to Datastores 2017-11-02 21:31:56 -04:00
Emmanuelle Vargas-Gonzalez f6f7d0aed8 Merge branch 'master' of github.com:oasis-open/cti-python-stix2 2017-11-02 07:48:37 -04:00
Greg Back 37e9049536
Merge pull request #93 from emmanvg/issue-91
Update stix2 Package Structure
2017-11-01 20:09:15 +00:00
Greg Back f029a01f9a
Merge pull request #95 from oasis-open/filters
Change filters to allow filtering all properties
2017-11-01 20:04:48 +00:00
Emmanuelle Vargas-Gonzalez a17d770d34 Merge master 2017-11-01 14:17:41 -04:00
Chris Lenk 7dd222b202 Test MemoryStore saving/loading to/from file
Python 3 dict.values() returns a view, not a list. See
https://stackoverflow.com/a/17431716/

Fix #65.
2017-11-01 12:51:04 -04:00
Chris Lenk c2d1e9777b Clean up filters
- Simplify an if statement since split() with no matches returns single
  item list
- Rename _all_filter -> _check_property and make it a method on Filter
- Raise an error instead of returning -1
- s/field/property
2017-11-01 10:40:10 -04:00
Chris Lenk d93bf44c00
Merge branch 'master' into 76-filesystem-bundles 2017-10-31 14:10:29 -04:00
Chris Lenk 924c72e98a Change filters to allow filtering all properties
(Not just common properties)
2017-10-30 17:25:32 -04:00
Emmanuelle Vargas-Gonzalez a514c5a3df Add test for _register_type() 2017-10-29 00:09:13 -04:00
Chris Lenk 612f2fbab8 Increase code coverage for filesystem datastore
Found a couple bugs in the process and fixed them, too.
2017-10-27 15:50:43 -04:00
Chris Lenk f103084439 Add `bundlify` parameter to FileSystemStore/Sink
This brings back the option (disabled by default) to wrap objects in a bundle
when saving them to the filesystem.
2017-10-27 12:23:57 -04:00
Emmanuelle Vargas-Gonzalez 8c56adda21 Update package structure 2017-10-26 11:39:45 -04:00
Chris Lenk 5dffe74867 Clean up creator_of
(renamed from created_by)
2017-10-24 14:20:42 -04:00
Emmanuelle Vargas-Gonzalez d4db4f0ab8 Define source code encoding 2017-10-24 12:53:53 -04:00
Chris Lenk 47b11453fa Increase test coverage for memory datastore 2017-10-24 12:43:30 -04:00
Emmanuelle Vargas-Gonzalez 7b6236674c Add new tests. 2017-10-23 08:06:29 -04:00
Chris Lenk e1e368c0d2 Add created_by() function to Environment 2017-10-20 09:13:04 -04:00
Chris Lenk c6d5eee083 Separate out Memory datatstore tests
Makes sure custom content can be added to a MemoryStore.
2017-10-18 18:31:46 -04:00
Chris Lenk e1d8c2872e Don't Bundlify data in FileSystemStore
Don't wrap objects in a Bundle when adding them to a FileSystemStore,
but still support getting objects from FileSystemStore that were saved
in a bundle.

Also:
- Add option to allow custom content in FileSystemStore
- Simplify an if statement
- Improve FileSystem docstrings
- Remove an unnecessary parse() call in FileSystemSource.get()
2017-10-18 15:46:45 -04:00
Emmanuelle Vargas-Gonzalez be3e841ecb New object test files 2017-10-18 13:58:24 -04:00
Chris Lenk 84094e9f79 Separate out filesystem tests 2017-10-18 08:27:12 -04:00
Emmanuelle Vargas-Gonzalez 6deaddc04e Make sure custom properties are returned by object. closes #85 2017-10-12 14:08:32 -04:00
Chris Lenk 134267bfd6 Add FileSystem test fixture, test adding bundle 2017-10-12 11:20:20 -04:00
Greg Back 374539a6cc Don't try to re-parse STIX Objects when adding to Bundle. 2017-10-12 14:38:25 +00:00
Chris Lenk 2b6023e7bb Allow objects with custom properties in bundles 2017-10-09 17:33:12 -04:00
Chris Lenk 2f58d7888b Merge branch 'master' of https://github.com/oasis-open/cti-python-stix2 2017-10-06 15:09:35 -04:00
Chris Lenk e57c36f525 Check custom extension properties is not empty 2017-10-06 15:05:39 -04:00
Chris Lenk d0f3fb0b47 Merge pull request #62 from oasis-open/documentation
Documentation: Fixes #53.
2017-10-06 14:33:14 -04:00
Emmanuelle Vargas-Gonzalez 2b65f7205b Mutex 'name' is required. Bunch of formatting, update test 2017-10-06 14:24:46 -04:00
Chris Lenk 23e3b3cc20 Fix FileSystemSource.all_versions bug
If `get()` returned a single STIX object, `all_versions()` would return a
list of the properties/values of that object.
2017-10-06 14:02:25 -04:00
Chris Lenk 1821cdb197 Merge pull request #71 from oasis-open/more_ds_tests
FileSystem tests
2017-10-06 13:31:50 -04:00
Chris Lenk 63e9d6af70 Merge pull request #69 from emmanvg/master
Update required properties in SDOs
2017-10-06 13:30:14 -04:00
Chris Lenk 79902f361e Merge pull request #61 from oasis-open/list_comp
frivolous list comprehensions converted to list()
2017-10-06 13:29:22 -04:00
= a36922990f removing list comps 2017-10-06 11:20:18 -04:00
= a26e9b589f FileSystem tests, and test directory of sample stix2 data 2017-10-06 10:56:24 -04:00
Emmanuelle Vargas-Gonzalez 24bc282d7e Update required properties, indicator label and tests. closes #68 2017-10-06 10:29:30 -04:00
Greg Back 1414035e8d Isolate TimestampConstant in test. 2017-10-05 21:54:58 +00:00
Greg Back f3431c97da nested summaries for sources 2017-10-05 18:45:31 +00:00
Richard Piazza 0dc3226048 added test for Timestamp_Constant 2017-10-05 13:43:56 -04:00
Chris Lenk 233ee7924e Merge branch 'master' into documentation 2017-10-04 10:38:40 -04:00
Chris Lenk 2bdf83401a Add a shortcut for marking functions
So marking functions like `add_markings()` can be directly called as methods on
SDO/SRO classes. Note that they return new versions of the objects
because objects are immutable.
2017-10-03 10:28:58 -04:00
Chris Lenk 035f1a6c73 Support MarkingDefinition objs, not just ID strs
(when passed into `add_markings()` or `remove_markings()`)
2017-10-02 12:28:47 -04:00
= 4af665bf81 merge conflicts 2017-09-29 15:47:39 -04:00
Greg Back b31b4f29f8 Handle inconsistent error messages between Python 2 and Python 3. 2017-09-29 18:45:15 +00:00
= ffa2242878 code changes brought about by discussion of pull request of 'bug_fixes' branch 2017-09-29 11:24:19 -04:00
= 55943847fa updated corresponding tests that would have broke 2017-09-22 11:49:54 -04:00
Chris Lenk 21d978acc8 Fix errors when instantiating custom classes
Defining a custom object/observable/extension class with no custom
__init__() function would result in an `AttributeError` or `TypeError`,
depending on if the class sub-classed `object` or not.
2017-09-21 09:11:01 -04:00
Chris Lenk be07c32500 Add parse() to Environment layer
The Environment layer does not keep its own mapping of custom object types.
If we think it likely that users will want to maintain separate lists of
custom object types between two or more Environments, we can add this
later.
2017-09-08 12:40:01 -04:00
Chris Lenk 4dfb5d2365 Test Environment layer 2017-09-08 09:01:12 -04:00
Greg Back adac43708b Merge pull request #46 from oasis-open/markings
Marking Support
2017-09-05 19:08:45 +00:00
Chris Lenk 42962e6675 Improve markings tests
- Test markings functions with both dictionaries and our _STIXBase-derived
  classes as input.
- Slightly improve test coverage.
- Drop Python 2.6 support.
2017-09-01 16:41:16 -04:00
Chris Lenk cc66e1a492 Make markings function signatures consistent
Put `marking` before `selectors`. The granular marking version of
`is_marked` requires selectors to not be None.
2017-09-01 10:50:01 -04:00
Emmanuelle Vargas-Gonzalez 6f36ea8488 Merge remote-tracking branch 'oasis/master' into datastores 2017-09-01 10:13:57 -04:00
Emmanuelle Vargas-Gonzalez 13f2810b25 Remove name positional argument, clean memory.py redundant codeother minor changes. Increase coverage. 2017-09-01 08:15:50 -04:00
Greg Back 124da846c3 Merge branch 'master' into markings 2017-08-31 20:36:59 +00:00
Greg Back b1054e780a Merge remote-tracking branch 'origin/master' into datastores 2017-08-31 19:52:48 +00:00
Greg Back ba846f9501 Clean up some tests. 2017-08-31 18:23:08 +00:00
Greg Back 7b46283a5c Build filter function map 2017-08-31 18:21:29 +00:00
Chris Lenk 9d45a3dca2 Keep MALWARE_KWARGS to a minimal set
...but use an additional set with a description for marking tests.
2017-08-31 12:51:13 -04:00
Chris Lenk 15287959a4 Modify versioning API to work on dictionaries
This includes new_version() and revoke().
2017-08-31 12:28:07 -04:00
clenk 8a33cb7716 Touch up ObjectReferenceProperty checks
- reword "_refs" error
- check with isinstance instead of __class__.__name__
2017-08-30 16:15:05 -04:00
clenk 0e658255a8 Move check to when custom observable is defined
Catch properties named "_ref" or "_refs" that aren't
ObjectReferenceProperty when the custom observable is defined, not when
it is instantiated.
2017-08-30 15:33:28 -04:00
Emmanuelle Vargas-Gonzalez 8ca2c3390b Minor changes to DataSource.apply_common_filters(). Improve overall code coverage. 2017-08-29 15:15:32 -04:00
Emmanuelle Vargas-Gonzalez 415c53066f Code coverage changes, fix some tests. Add stix2-validator dependency. 2017-08-28 15:19:55 -04:00
Emmanuelle Vargas-Gonzalez aea076103c Update tests to improve coverage. 2017-08-28 14:33:12 -04:00
Emmanuelle Vargas-Gonzalez 07bbe23a98 Add some tests for custom objects. 2017-08-28 14:32:05 -04:00
clenk 095c5066d5 Touch up markings tests
Increase code coverage and s/tlo/sdo/
2017-08-25 15:56:39 -04:00
clenk 0cd75e3fba Increase code coverage 2017-08-24 17:53:43 -04:00
clenk 6fa3c84aa3 Improve tests and coverage for custom content
In ObservableProperty.clean(), parse_observable() will handle the issue
of non-cyber observable objects being presnt in an observable property.
The line raising a ValueError would not be reached so it was removed.
2017-08-24 15:46:36 -04:00
Emmanuelle Vargas-Gonzalez dd17e88ae0 Code refactor/clean-up, changed some exceptions. Update docstrings. 2017-08-24 12:47:14 -04:00
clenk ee49e78c72 Add custom extensions to cyber observables
Fix #31.
2017-08-23 18:36:24 -04:00
Emmanuelle Vargas-Gonzalez 8d4c1d55b5 Minor style changes. 2017-08-23 13:12:40 -04:00
Emmanuelle Vargas-Gonzalez f33427328b Update tests for object and granular markings. 2017-08-23 13:07:22 -04:00
Emmanuelle Vargas-Gonzalez f437a4df5b Merge branch 'datastores' of github.com:oasis-open/cti-python-stix2 into datastores 2017-08-22 10:47:23 -04:00
Emmanuelle Vargas-Gonzalez d060abbed5 Updated regex expressions. Thanks to @drothenberg for that contribution! 2017-08-22 10:47:13 -04:00
Greg Back 69eb09c32b Merge remote-tracking branch 'origin/master' into datastores 2017-08-21 22:40:07 +00:00
Greg Back 4cd99f04ea Use version of taxii2-client from PyPI. 2017-08-21 22:16:23 +00:00
clenk 8687521111 Change object markings for immutable SDOs 2017-08-21 13:57:01 -04:00
clenk d4edb8b0bc Validate patterns when creating Indicators 2017-08-18 14:22:57 -04:00
clenk c0d02fbfcd [WIP] Touch up marking code 2017-08-18 12:36:34 -04:00
clenk 14b922ba92 Merge remote-tracking branch 'emmanvg/marking-support' into markings 2017-08-17 12:26:46 -04:00
Emmanuelle Vargas-Gonzalez 681be1a5d9 Make CompositeDataStore subclass DataStore. Remove deduplicate() from CompositeDataSource. 2017-08-16 09:58:33 -04:00
Emmanuelle Vargas-Gonzalez 4ffc8edeeb Update all tests. Re-organize EXPECTED values, update some regex expressions. 2017-08-15 13:41:51 -04:00
Emmanuelle Vargas-Gonzalez cb5c4ad080 Merge pull request #42 from oasis-open/bundles Parse bundles correctly 2017-08-14 15:21:58 -04:00
Emmanuelle Vargas-Gonzalez 569ca34d78 Remove test skip for data_sources. 2017-08-14 15:02:26 -04:00
Emmanuelle Vargas-Gonzalez 226a41e0ff Merge pull request #41 from oasis-open/namedtuple-filters Use Namedtuples for Filters. 2017-08-14 15:01:07 -04:00
clenk ee8013d782 Parse bundles correctly
This required refactoring parts of the library. Code in __init__.py
merged into bundle.py, which was renamed core.py. Code in other.py was
merged into common.py.

Fixes #40.
2017-08-11 16:18:20 -04:00
Emmanuelle Vargas-Gonzalez 86fd3778f5 Formatting changes, replace deduplicate() code in DataSource, missing super() calls to initialize objects. 2017-08-11 08:10:20 -04:00
Greg Back 961dfdc984 Convert rest of code to use namedtuple Filters 2017-08-09 19:25:06 +00:00
Greg Back 87f7503c0a Convert filters to be NamedTuples 2017-08-09 18:49:06 +00:00
Emmanuelle Vargas-Gonzalez a4ead4f6e7 Formatting changes, skip add/remove filter test, change deduplicate() approach. 2017-08-09 13:31:07 -04:00
Greg Back b8c96e37a2 Update to get tests passing 2017-07-20 20:30:04 +00:00
Greg Back b82606ba38 Clean up TAXII Datastore to use latest TAXII client 2017-07-20 19:36:54 +00:00
Greg Back 55e92bc237 Update with correct class name
Also PEP-8 fixes
2017-07-19 21:30:29 +00:00
Greg Back bf9677094f Merge branch 'master' into datastores 2017-07-19 21:21:08 +00:00
Greg Back bac87465cb Merge pull request #35 from oasis-open/pattern_expressions
Pattern expressions
2017-07-19 14:17:57 +00:00
Richard Piazza a2aacc5e20 merge all classes into patterns.py 2017-07-19 14:03:43 +00:00
Greg Back 595ba10695 Merge pull request #34 from oasis-open/object-factory
Object factory
2017-07-19 13:54:24 +00:00
= 20958b908a more tests for TAXII data source 2017-07-18 20:42:43 +00:00
Richard Piazza 27af0c0d5b Fixed style errors 2017-07-18 20:34:39 +00:00
Richard Piazza 6fa009e509 added object_paths
added more tests for pattern expressions
added "set" comparison expressions
implemented make_constant
fixed type name for EmailAddress
2017-07-18 20:30:02 +00:00
Richard Piazza c1b07ef505 Introduce constant objects for literals in pattern expressions
fixed idioms
2017-07-18 20:26:46 +00:00
Richard Piazza c8bcece6f6 added tests for expressions
fix __str__ methods
2017-07-18 20:26:46 +00:00
Richard Piazza c0467da5f9 added classes for Pattern Expressions 2017-07-18 20:26:44 +00:00
clenk 4bdbb4a2f9 Deep-copy in Object Factory and allow appending multiple items to list
properties in ObjectFactory.create()
2017-07-18 12:05:19 -04:00
clenk 2e45cacd52 Add to list properties like `external_references`, but include option to
replace instead
2017-07-17 14:56:13 -04:00
clenk e233a424fb Drop granular markings from object factory for now 2017-07-14 16:11:48 -04:00
clenk 5c5903179d Fix import sort order 2017-07-14 16:02:29 -04:00
clenk 7ebf5ac7c7 Fix timestamp in test 2017-07-14 15:30:19 -04:00
clenk e1330692c8 Move ObservableProperty, ExtensionsProperty, and Observable parsing code
into observables.py to prevent circular imports and fix #23.
2017-07-14 15:10:12 -04:00
clenk 4dba41afc8 Add created to object factory, clean up code 2017-07-13 09:45:43 -04:00
Emmanuelle Vargas-Gonzalez 6d2cfcdedf [WIP] Update tests. 2017-07-13 07:57:33 -04:00
clenk 6ddad22810 Add external references to object factory 2017-07-12 16:11:51 -04:00
clenk 593f16662a Add granular markings to object factory 2017-07-12 15:22:50 -04:00
clenk 659ad3df89 Add object markings to object factory 2017-07-12 14:44:52 -04:00
clenk 0c47936ee0 Create ObjectFactory class
currently only supports created_by_ref
2017-07-12 11:36:15 -04:00
Greg Back 9bfc240008 Merge pull request #27 from oasis-open/issue26
Allow passing a list to Bundle constructor
2017-07-06 13:36:06 +00:00
clenk 1d3c59cc44 Move TLP constants up to stix2 namespace 2017-07-05 13:27:09 -04:00
clenk 1ea9671b68 Allow passing a list to Bundle constructor
Fix #26
2017-07-05 11:31:56 -04:00
clenk 29d9467ce0 Add more timestamp test cases, address suggestions 2017-06-28 15:55:23 -04:00
clenk e01ce132db Add timestamp precision for `created` and `modified`
Fix #24
2017-06-22 18:47:35 -04:00
clenk fdbb6ff337 Add custom Cyber Observables 2017-06-14 09:36:35 -04:00
clenk d4e92dd813 Allow adding validation to custom object types
_Custom.__init__() is a solution to recursion errors arising from using
a decorator. See https://stackoverflow.com/q/14739809/1013457
2017-06-13 10:27:31 -04:00
clenk bcfb13f23c Add custom STIX Object types 2017-06-12 16:22:16 -04:00
clenk 8f1ae4e6d3 Add custom properties via 'allow_custom'
Custom properties can be specified by passing them to a STIX object
constructor in the 'custom_properties' argument, or with the
'allow_custom' argument set to True, which will add any unrecognized
keyword arguments as properties on the object. The 'allow_custom'
argument can also be used with the parse() and parse_observable()
functions.
An error is now raised when attempting to parse objects without a 'type'
property, such as external references, kill chain phases, and granular
markings. The object which contains them is what should be parsed, not
these objects themselves.
2017-06-12 13:04:20 -04:00
Emmanuelle Vargas-Gonzalez 1f258551e1 Add and update tests for markings API. 2017-06-09 14:22:56 -04:00
clenk 9036c7f7b8 Add custom properties 2017-06-09 12:30:19 -04:00
Emmanuelle Vargas-Gonzalez c1c5c05f47 Some changes to Process and EmailMessage objects. Added tests. 2017-06-08 10:09:18 -04:00
clenk 860efcc230 Make object attribute access act like dictionary access, raising an
error for any property (including custom or optional) not set on the object.
2017-06-07 11:06:20 -04:00
Emmanuelle Vargas-Gonzalez 653eef4b95 Revert changes to test_file_example_encryption_error() 2017-06-02 13:47:08 -04:00
Emmanuelle Vargas-Gonzalez d579c12172 Update ImmutableError test cases. 2017-06-02 07:34:37 -04:00
Emmanuelle Vargas-Gonzalez e1e7bade3f Updated this test since setting the value to False should not be a reason to fail the test. 2017-06-01 15:25:46 -04:00
Emmanuelle Vargas-Gonzalez ad46474663 Update immutable tests. 2017-06-01 12:43:42 -04:00
Greg Back 53ddf32e8c Style/lint fixes 2017-05-31 08:58:14 -05:00
= 6c3a689f02 fixed indentation 2017-05-31 09:47:36 -04:00
= c65055bb0e tests for TAXII data source; some bug fixes 2017-05-30 16:56:27 -04:00
Greg Back fc1ce6d56d Add some tests 2017-05-25 12:31:45 -05:00
clenk b4dfa07a20 Improve coverage of utils.py
Also fix bugs this discovers. Fix #15.
2017-05-22 11:15:55 -04:00
Greg Back 41f2ceb8e5 Change remaining 'fields' to 'properties' 2017-05-19 12:51:59 -05:00
Greg Back a913d9d5ad Merge pull request #14 from oasis-open/parse-cyber-observables
Parse cyber observables
2017-05-19 09:15:00 -05:00
clenk 0d736509e2 Fix tests 2017-05-18 11:24:43 -04:00
clenk 931de31a10 Merge branch 'parse-cyber-observables' of https://github.com/oasis-open/cti-python-stix2 into parse-cyber-observables 2017-05-18 11:08:12 -04:00
Chris Lenk b6e22bcbdf Merge pull request #12 from rpiazza/cyber-observables
Cyber observables
2017-05-18 11:02:10 -04:00
Richard Piazza f56ea8e951 added tests for process and file extensions
if no properties are passed to _check_at_least_one_property assume its all properties
when extensions are involved always check them in _check_at_least_one_property (caused by raising the exception on the enclosing type)
added _check_object_constaints to extensions, where appropriate
2017-05-17 15:33:28 -04:00
clenk 3e0e80141b For object reference properties, check the type of the object
referenced, not only that it is included in the local scope.
2017-05-17 15:21:02 -04:00
Richard Piazza 7c71b9e577 added tests for File and Process extensions
fixed typo in WindowsPEOptionalHeaderType
2017-05-16 12:39:04 -04:00
clenk 9761c37f20 Replace 'field' with 'property' to be consistent
with the specification
2017-05-16 12:27:30 -04:00
clenk a520a67511 Add tests for the Network Traffic extension and
User Account extensions
2017-05-16 11:35:43 -04:00
clenk 2460fb75be Rework select properties to use get_dict(),
which automatically coerces values to a dictionary if possible
2017-05-16 09:25:08 -04:00