Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stage changes for v1.1.0 release #220

Merged
merged 146 commits into from
Dec 11, 2018
Merged
Changes from 1 commit
Commits
Show all changes
146 commits
Select commit Hold shift + click to select a range
5577686
Add new STIX2.1 SDOs and additional properties
emmanvg Oct 6, 2017
50f3d60
Update branch
emmanvg Oct 7, 2017
2ec8205
Implement confidence conversion scales
emmanvg Oct 9, 2017
b99d9e4
Update confidence docstrings
emmanvg Oct 11, 2017
c4c2fb9
Implement LanguageContent object. Update GranularMarking and other mi…
emmanvg Oct 11, 2017
f6e21d2
Merge branch 'master' of github.com:oasis-open/cti-python-stix2 into …
emmanvg Oct 11, 2017
a79f10e
Merge pull request #78 from emmanvg/stix2.1
gtback Oct 11, 2017
be3e841
New object test files
emmanvg Oct 18, 2017
ef98c38
Minor changes
emmanvg Oct 23, 2017
7b62366
Add new tests.
emmanvg Oct 23, 2017
d4db4f0
Define source code encoding
emmanvg Oct 24, 2017
bdb91c6
Update STIX 2.1 structure
emmanvg Nov 2, 2017
f6f7d0a
Merge branch 'master' of github.com:oasis-open/cti-python-stix2
emmanvg Nov 2, 2017
b83c5ac
Update README
emmanvg Nov 2, 2017
722d46c
Merge branch 'master' of github.com:oasis-open/cti-python-stix2 into …
emmanvg Dec 8, 2017
06974c7
Merge branch 'master' of github.com:oasis-open/cti-python-stix2 into …
emmanvg Feb 23, 2018
d51f101
Fix InstrusionSet 'last_seen' in 2.1
emmanvg Feb 23, 2018
b6c2201
Fix imports for test_location.py
emmanvg Feb 23, 2018
a780bcf
Merge pull request #130 from emmanvg/stix2.1
gtback Feb 26, 2018
3e159ab
WIP: Merge branch 'master' into stix2.1
gtback May 23, 2018
75e4783
Additional changes to match updates in v20 code.
gtback Jun 11, 2018
2e0dfc6
Merge remote-tracking branch 'origin/master' into stix2.1
gtback Jun 14, 2018
f211649
Made some minimal changes to support the STIX 2.1 Malware SDO,
chisholm Jun 9, 2018
ef8d457
Update many unit tests to work with the malware2.1 API changes
chisholm Jun 11, 2018
0c3f826
First cut at splitting the Bundle implementation into v20 and
chisholm Jun 14, 2018
3101584
Fix test_bundle to compare against stix2.1 relationships. The
chisholm Jun 14, 2018
486c588
Fix silly isort check errors..
chisholm Jun 14, 2018
240a758
Updated stix2.parse()-related docstrings. Its description of how
chisholm Jun 14, 2018
78c4d48
Merge pull request #191 from chisholm/malware2.1
gtback Jun 15, 2018
53a1a03
Merge branch 'master' into stix2.1
gtback Jun 15, 2018
abd172e
Merge branch 'master' of github.com:oasis-open/cti-python-stix2 into …
emmanvg Jun 25, 2018
0ddb7b3
Update observables.RasterImageExt 'image_weight' property to 'image_w…
emmanvg Jun 25, 2018
b852b91
Reformat methods documentation
emmanvg Jun 25, 2018
6b1da85
split properties out by spec version
treyka Jun 26, 2018
cc58a3a
2.1 removes 3 char limit on dict keys
treyka Jun 26, 2018
d44c2ab
2.1 spec (somewhat inexplicably) limits dict keys to 250 chars
treyka Jun 26, 2018
5cbe886
split properties out by spec version
treyka Jun 26, 2018
9baaad6
Sort imports.
emmanvg Jun 26, 2018
59fdd30
Update tests.
emmanvg Jun 26, 2018
9cc74e8
Merge pull request #198 from treyka/stix2.1
emmanvg Jun 26, 2018
7fd379d
Minor style changes.
emmanvg Jun 29, 2018
2e6bb74
Add spec version 2.1 to object missing the property.
emmanvg Jun 29, 2018
c2f5a40
Create new test subpackages
emmanvg Jun 30, 2018
da5b16d
Create v21 test package with new spec changes
emmanvg Jul 3, 2018
3100fa1
Move v20 tests to their own package
emmanvg Jul 3, 2018
04680d8
First pass at making sure everything uses v21 classes and representat…
emmanvg Jul 3, 2018
bfa86bf
Format objects in observed_data
emmanvg Jul 3, 2018
2c5ddc1
Update v21 tests for some missing methods, ensure we are calling and
emmanvg Jul 5, 2018
5be1636
Update v20 tests to ensure right methods and classes are used
emmanvg Jul 5, 2018
52c1850
Small addition to patterns.py
emmanvg Jul 6, 2018
21d5451
Small changes to tests
emmanvg Jul 6, 2018
8aeac36
Returning double quotes here... went overboard.
emmanvg Jul 9, 2018
546216c
Remove unnecessary 'True' in Memory datastore tests.
emmanvg Jul 9, 2018
646d941
Removed 'test_memory' file and moved all tests into 'test_datastore_m…
emmanvg Jul 9, 2018
0197f9f
Minor fixes to tests. Some datastore had strange parameters in calls.
emmanvg Jul 9, 2018
70a1e95
Add 'stix2_data' test directory for v20 tests
emmanvg Jul 9, 2018
edd7148
It appears we did not support the case when the Bundle contains 'utf-8'
emmanvg Jul 9, 2018
99e76c2
Update Tox test configuration
emmanvg Jul 10, 2018
645a258
Fix file indentation
emmanvg Jul 10, 2018
fe64fb0
Removed per version 'properties.py'
emmanvg Jul 10, 2018
7da6f1e
Add a package-wide 'properties.py'
emmanvg Jul 10, 2018
f669656
Removed 'ExtensionsProperty' from workbench.
emmanvg Jul 10, 2018
b76888c
Add a new 'custom.py' module to store and consolidate all custom code
emmanvg Jul 10, 2018
03e19f1
Moved STIXDomainObject and STIXRelationshipObject here, the observable
emmanvg Jul 10, 2018
78d7725
Add object mappings in the top of each version package
emmanvg Jul 10, 2018
5332d54
Refactor Bundle
emmanvg Jul 10, 2018
b722fdc
Remove duplicate register methods and CustomMarking code
emmanvg Jul 10, 2018
1177694
Adding docstrings to 2.1 objects
emmanvg Jul 10, 2018
54268ae
Remove observables and extension mappings, custom code and apply prop…
emmanvg Jul 10, 2018
023603d
Remove duplicate code from 'sdo.py', removed STIXDomainObject
emmanvg Jul 10, 2018
8d378fc
Remove STIXRelationshipObject from 'sro.py'
emmanvg Jul 10, 2018
b6fefc5
Fix call to collect STIX2 mappings, make parse_observable available
emmanvg Jul 10, 2018
9b8cb09
Remove 'version' from calls to parse since it is no longer necessary
emmanvg Jul 10, 2018
012eba4
Add new Bundle support for add_objects() request. Add encoding support.
emmanvg Jul 10, 2018
8cf6805
Remove str() as a way to serialize objects. Add support for encodings…
emmanvg Jul 10, 2018
ce42c02
Fix tests that use property objects to call in the right path
emmanvg Jul 10, 2018
4583da3
Sort imports
emmanvg Jul 10, 2018
d24cddb
Temporarily skip failing tests in workbench for v20, but the approach…
emmanvg Jul 10, 2018
48e0442
Fix tests in 'test_properties.py'
emmanvg Jul 10, 2018
c91bcd4
Fix location for test_object_property
emmanvg Jul 10, 2018
834ef2c
Fix check to collections.Mapping
emmanvg Jul 10, 2018
6bd797e
Fix 'test_memory_store_object_with_custom_property_in_bundle'
emmanvg Jul 10, 2018
e513c8d
Hide builder methods in 'custom.py' and update imports accordingly
emmanvg Jul 11, 2018
ee260b7
Sort import check
emmanvg Jul 11, 2018
a042970
Merge branch 'master' of github.com:oasis-open/cti-python-stix2 into …
emmanvg Jul 11, 2018
281dbfb
Align tests with news additions from 'master' branch.
emmanvg Jul 11, 2018
bdfc221
Update v21 properties to latest spec changes
emmanvg Jul 12, 2018
965d7fa
Update v20 and v21 tests
emmanvg Jul 12, 2018
7476456
Update isort.cfg and .pre-commit-config.yaml
emmanvg Jul 13, 2018
e0aa8ab
Update README.rst
emmanvg Jul 13, 2018
51a499c
Formatting changes made by the new pre-commit hook 'add trailing commas'
emmanvg Jul 13, 2018
ea15b6f
Empty commit, but signals the following work was completed
emmanvg Jul 13, 2018
40d656c
Minor changes to tests.
emmanvg Jul 25, 2018
af2a560
Add constraints to Location object
emmanvg Jul 25, 2018
21c84ac
Add missing properties to Relationship object and update tests
emmanvg Jul 25, 2018
303159a
pre-commit hooks changes
emmanvg Jul 25, 2018
ad76e71
MALWARE RESTORE POINT - Reverted changes to Malware based on STIX 2.1…
emmanvg Jul 25, 2018
5e71f92
Add regex approach to load mappings
emmanvg Jul 25, 2018
211b8d8
Add core tests and minor change to parse_observable()
emmanvg Jul 26, 2018
120e897
Update Indicator example to 2.1 representation.
emmanvg Jul 26, 2018
acd86c8
Update tests to new object constraints
emmanvg Oct 15, 2018
dec7508
Add new constrains parameters to IntegerProperty and FloatProperty
emmanvg Oct 15, 2018
b2ef77b
Merge branch 'master' of github.com:oasis-open/cti-python-stix2 into …
emmanvg Oct 17, 2018
f8a72b0
Custom builder code updated for 3.7 support.
emmanvg Oct 17, 2018
352749e
Add constrains to ObservedData and Sighting, tests updated.
emmanvg Oct 17, 2018
d614343
Rename tests with duplicate name.
emmanvg Oct 17, 2018
eff5369
Merge branch 'master' of github.com:oasis-open/cti-python-stix2 into …
emmanvg Nov 1, 2018
5e5d10e
Finish alignment of 2.1 components
emmanvg Nov 1, 2018
493bd65
Update README and refactor code to make 2.0 default. Update some tests
emmanvg Nov 1, 2018
700988c
Update CHANGELOG for v1.1.0
emmanvg Nov 1, 2018
5abe518
Bump version: 1.0.3 → 1.1.0
emmanvg Nov 1, 2018
8d24015
Update Memory datastore to allow for mapping objects
emmanvg Nov 1, 2018
7aad973
use stix2 version to update documentation
emmanvg Nov 28, 2018
e8b5ecc
download badge is back!
emmanvg Nov 28, 2018
aaddeb8
Merge branch 'master' of github.com:oasis-open/cti-python-stix2 into …
emmanvg Nov 28, 2018
c3031a0
fix typo on DNI scale
emmanvg Nov 28, 2018
97a21c3
my precious tables gone :(
emmanvg Nov 28, 2018
71a2aa2
update project documentation.
emmanvg Nov 28, 2018
e896812
minor code changes
emmanvg Nov 28, 2018
ee14a11
add new .rst documentation files
emmanvg Nov 28, 2018
682e90c
expose the confidence methods via `stix2.scales.<method>`
emmanvg Nov 28, 2018
79c9d85
make Memory datastore return path where data was saved to
emmanvg Nov 29, 2018
6f897bc
small enhancements, fix property for TLPMarking
emmanvg Nov 29, 2018
7f3a8b6
more tests to improve coverage
emmanvg Nov 29, 2018
e365de3
update setup.py information
emmanvg Nov 29, 2018
1b0fa01
pre-commit changes
emmanvg Nov 29, 2018
6e9312e
fix test memory datastore teardown
emmanvg Nov 29, 2018
63c22ab
fix path issues related to memory datastore
emmanvg Nov 29, 2018
f1490a9
remove full path from `constants` and fix directory resolution
emmanvg Nov 29, 2018
aa649d4
more pre-commit changes
emmanvg Nov 29, 2018
06716e3
remove redundant/unreachable code in core, add tests
emmanvg Nov 29, 2018
c62b9e9
revamp code in MockTAXIICollectionEndpoint, add more tests
emmanvg Nov 29, 2018
f76de87
Update test_datastore_taxii.py
emmanvg Nov 29, 2018
7ee7352
Update README.rst
emmanvg Nov 30, 2018
e1f7cc4
change "Notes" for "Note" to keep visual effect in documentation
emmanvg Nov 30, 2018
3d099be
Merge branch 'master' of github.com:oasis-open/cti-python-stix2 into …
emmanvg Dec 6, 2018
bfa49ce
Removed everything in test/v21/stix2_data/
emmanvg Dec 6, 2018
01df0cc
Add new files for the test/v2X/stix2_data/ directory
emmanvg Dec 6, 2018
96b81fc
pre-commit formatting changes
emmanvg Dec 6, 2018
c75a085
Merge branch 'master' of github.com:oasis-open/cti-python-stix2 into …
emmanvg Dec 11, 2018
ff098a1
update method _timestamp2filename() since it introduces timing precis…
emmanvg Dec 11, 2018
3f02925
add new pattern_expressions tests to proper locations
emmanvg Dec 11, 2018
f12cc82
incorporate feedback
emmanvg Dec 11, 2018
7d84c63
pre-commit formatting changes
emmanvg Dec 11, 2018
c8c48a3
Add future import to resolve compatibility problems
emmanvg Dec 11, 2018
6e50bf5
Formatting problems...
emmanvg Dec 11, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
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.
chisholm committed Jun 14, 2018
commit ef8d45723f61f13d386b30d751c18d23ded447fd
4 changes: 3 additions & 1 deletion stix2/test/constants.py
Original file line number Diff line number Diff line change
@@ -80,6 +80,7 @@
MALWARE_KWARGS = dict(
labels=['ransomware'],
name="Cryptolocker",
is_family=False
)

MALWARE_MORE_KWARGS = dict(
@@ -89,7 +90,8 @@
modified="2016-04-06T20:03:00.000Z",
labels=['ransomware'],
name="Cryptolocker",
description="A ransomware related to ..."
description="A ransomware related to ...",
is_family=False
)

OBSERVED_DATA_KWARGS = dict(
Original file line number Diff line number Diff line change
@@ -26,9 +26,10 @@
"object_marking_refs": [
"marking-definition--fa42a846-8d90-4e51-bc29-71d5b4802168"
],
"type": "malware"
"type": "malware",
"is_family": false
}
],
"spec_version": "2.0",
"spec_version": "2.1",
"type": "bundle"
}
Original file line number Diff line number Diff line change
@@ -26,9 +26,10 @@
"object_marking_refs": [
"marking-definition--fa42a846-8d90-4e51-bc29-71d5b4802168"
],
"type": "malware"
"type": "malware",
"is_family": false
}
],
"spec_version": "2.0",
"spec_version": "2.1",
"type": "bundle"
}
Original file line number Diff line number Diff line change
@@ -26,9 +26,10 @@
"object_marking_refs": [
"marking-definition--fa42a846-8d90-4e51-bc29-71d5b4802168"
],
"type": "malware"
"type": "malware",
"is_family": false
}
],
"spec_version": "2.0",
"spec_version": "2.1",
"type": "bundle"
}
Original file line number Diff line number Diff line change
@@ -26,9 +26,10 @@
"object_marking_refs": [
"marking-definition--fa42a846-8d90-4e51-bc29-71d5b4802168"
],
"type": "malware"
"type": "malware",
"is_family": false
}
],
"spec_version": "2.0",
"spec_version": "2.1",
"type": "bundle"
}
4 changes: 2 additions & 2 deletions stix2/test/test_datastore_filesystem.py
Original file line number Diff line number Diff line change
@@ -220,7 +220,7 @@ def test_filesystem_sink_add_stix_bundle_dict(fs_sink, fs_source):
bund = {
"type": "bundle",
"id": "bundle--112211b6-1112-4fb0-111b-b111107ca70a",
"spec_version": "2.0",
"spec_version": "2.1",
"objects": [
{
"name": "Atilla",
@@ -264,7 +264,7 @@ def test_filesystem_sink_add_json_stix_object(fs_sink, fs_source):
def test_filesystem_sink_json_stix_bundle(fs_sink, fs_source):
# add json-encoded stix bundle
bund2 = '{"type": "bundle", "id": "bundle--332211b6-1132-4fb0-111b-b111107ca70a",' \
' "spec_version": "2.0", "objects": [{"type": "campaign", "id": "campaign--155155b6-1112-4fb0-111b-b111107ca70a",' \
' "spec_version": "2.1", "objects": [{"type": "campaign", "id": "campaign--155155b6-1112-4fb0-111b-b111107ca70a",' \
' "created":"2017-05-31T21:31:53.197755Z", "name": "Spartacus", "objective": "Oppressive regimes of Africa and Middle East"}]}'
fs_sink.add(bund2)

3 changes: 2 additions & 1 deletion stix2/test/test_datastore_filters.py
Original file line number Diff line number Diff line change
@@ -14,7 +14,8 @@
],
"modified": "2017-01-27T13:49:53.997Z",
"name": "Poison Ivy",
"type": "malware"
"type": "malware",
"is_family": False
},
{
"created": "2014-05-08T09:00:00.000Z",
2 changes: 1 addition & 1 deletion stix2/test/test_datastore_taxii.py
Original file line number Diff line number Diff line change
@@ -224,7 +224,7 @@ def test_add_dict_bundle_object(collection):
ta = {
"type": "bundle",
"id": "bundle--860ccc8d-56c9-4fda-9384-84276fb52fb1",
"spec_version": "2.0",
"spec_version": "2.1",
"objects": [
{
"type": "threat-actor",
3 changes: 2 additions & 1 deletion stix2/test/test_environment.py
Original file line number Diff line number Diff line change
@@ -196,7 +196,8 @@ def test_parse_malware():
"name": "Cryptolocker",
"labels": [
"ransomware"
]
],
"is_family": false
}"""
mal = env.parse(data)

12 changes: 8 additions & 4 deletions stix2/test/test_malware.py
Original file line number Diff line number Diff line change
@@ -10,13 +10,15 @@

EXPECTED_MALWARE = """{
"type": "malware",
"spec_version": "2.1",
"id": "malware--fedcba98-7654-3210-fedc-ba9876543210",
"created": "2016-05-12T08:17:27.000Z",
"modified": "2016-05-12T08:17:27.000Z",
"name": "Cryptolocker",
"labels": [
"ransomware"
]
],
"is_family": false
}"""


@@ -30,6 +32,7 @@ def test_malware_with_all_required_properties():
modified=now,
labels=["ransomware"],
name="Cryptolocker",
is_family=False
)

assert str(mal) == EXPECTED_MALWARE
@@ -76,12 +79,12 @@ def test_malware_required_properties():
stix2.Malware()

assert excinfo.value.cls == stix2.Malware
assert excinfo.value.properties == ["labels", "name"]
assert excinfo.value.properties == ["is_family", "labels", "name"]


def test_malware_required_property_name():
with pytest.raises(stix2.exceptions.MissingPropertiesError) as excinfo:
stix2.Malware(labels=['ransomware'])
stix2.Malware(labels=['ransomware'], is_family=False)

assert excinfo.value.cls == stix2.Malware
assert excinfo.value.properties == ["name"]
@@ -112,6 +115,7 @@ def test_invalid_kwarg_to_malware():
"modified": "2016-05-12T08:17:27.000Z",
"labels": ["ransomware"],
"name": "Cryptolocker",
"is_family": False
},
])
def test_parse_malware(data):
@@ -156,6 +160,6 @@ def test_parse_malware_clean_kill_chain_phases():
"phase_name": 1
}
]"""
data = EXPECTED_MALWARE.replace('malware"', 'malware",%s' % kill_chain)
data = EXPECTED_MALWARE.replace('2.1"', '2.1",%s' % kill_chain)
mal = stix2.parse(data)
assert mal['kill_chain_phases'][0]['phase_name'] == "1"
3 changes: 3 additions & 0 deletions stix2/test/test_note.py
Original file line number Diff line number Diff line change
@@ -15,6 +15,7 @@

EXPECTED_NOTE = """{
"type": "note",
"spec_version": "2.1",
"id": "note--0c7b5b88-8ff7-4a4d-aa9d-feb398cd0061",
"created": "2016-05-12T08:17:27.000Z",
"modified": "2016-05-12T08:17:27.000Z",
@@ -36,6 +37,7 @@

EXPECTED_OPINION_REPR = "Note(" + " ".join(("""
type='note',
spec_version='2.1',
id='note--0c7b5b88-8ff7-4a4d-aa9d-feb398cd0061',
created='2016-05-12T08:17:27.000Z',
modified='2016-05-12T08:17:27.000Z',
@@ -76,6 +78,7 @@ def test_note_with_required_properties():
EXPECTED_NOTE,
{
"type": "note",
"spec_version": "2.1",
"id": "note--0c7b5b88-8ff7-4a4d-aa9d-feb398cd0061",
"created": "2016-05-12T08:17:27.000Z",
"modified": "2016-05-12T08:17:27.000Z",
1 change: 1 addition & 0 deletions stix2/test/test_relationship.py
Original file line number Diff line number Diff line change
@@ -10,6 +10,7 @@

EXPECTED_RELATIONSHIP = """{
"type": "relationship",
"spec_version": "2.1",
"id": "relationship--00000000-1111-2222-3333-444444444444",
"created": "2016-04-06T20:06:37.000Z",
"modified": "2016-04-06T20:06:37.000Z",
1 change: 1 addition & 0 deletions stix2/test/test_versioning.py
Original file line number Diff line number Diff line change
@@ -217,6 +217,7 @@ def test_revoke_invalid_cls():
def test_remove_custom_stix_property():
mal = stix2.Malware(name="ColePowers",
labels=["rootkit"],
is_family=False,
x_custom="armada",
allow_custom=True)