Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisr3d committed Mar 5, 2025
2 parents 6255766 + b5ffcc1 commit 4b45b47
Show file tree
Hide file tree
Showing 50 changed files with 1,187 additions and 113 deletions.
7 changes: 4 additions & 3 deletions .github/workflows/python-ci-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.6, 3.7, 3.8, 3.9]
python-version: [3.8, 3.9, '3.10', '3.11', '3.12']

name: Python ${{ matrix.python-version }} Build
steps:
Expand All @@ -27,7 +27,8 @@ jobs:
run: |
tox
- name: Upload coverage information to Codecov
uses: codecov/codecov-action@v1
uses: codecov/codecov-action@v4.2.0
with:
fail_ci_if_error: true # optional (default = false)
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false # optional (default = false)
verbose: true # optional (default = false)
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ repos:
args:
- --max-line-length=160
- repo: https://github.com/PyCQA/isort
rev: 5.7.0
rev: 5.12.0
hooks:
- id: isort
name: Sort python imports (shows diff)
Expand Down
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div>
<h2><a id="openParticipation">Public Participation Invited</a></h2>

<p>This <a href="https://www.oasis-open.org/resources/open-repositories">OASIS TC Open Repository</a> ( <b><a href="https://github.com/oasis-open/cti-python-stix2">github.com/oasis-open/cti-python-stix2</a></b> ) is a community public repository that supports participation by anyone, whether affiliated with OASIS or not. Substantive contributions (repository "code") and related feedback is invited from all parties, following the common conventions for participation in GitHub public repository projects. Participation is expected to be consistent with the <a href="https://www.oasis-open.org/policies-guidelines/open-repositories">OASIS TC Open Repository Guidelines and Procedures</a>, the <a href="https://www.oasis-open.org/sites/www.oasis-open.org/files/BSD-3-Clause.txt">LICENSE</a> designated for this particular repository (BSD-3-Clause License), and the requirement for an <a href="https://www.oasis-open.org/resources/open-repositories/cla/individual-cla">Individual Contributor License Agreement</a>. Please see the repository <a href="https://github.com/oasis-open/cti-python-stix2/blob/master/README.md">README</a> document for other details.</p>
<p>This <a href="https://www.oasis-open.org/resources/open-repositories">OASIS TC Open Repository</a> ( <b><a href="https://github.com/oasis-open/cti-python-stix2">github.com/oasis-open/cti-python-stix2</a></b> ) is a community public repository that supports participation by anyone, whether affiliated with OASIS or not. Substantive contributions (repository "code") and related feedback is invited from all parties, following the common conventions for participation in GitHub public repository projects. Participation is expected to be consistent with the <a href="https://www.oasis-open.org/policies-guidelines/open-repositories">OASIS TC Open Repository Guidelines and Procedures</a>, the <a href="https://www.oasis-open.org/sites/www.oasis-open.org/files/BSD-3-Clause.txt">LICENSE</a> designated for this particular repository (BSD-3-Clause License), and the requirement for an <a href="https://cla-assistant.io/oasis-open/Open-Repo-admin">Individual Contributor License Agreement</a>. Please see the repository <a href="https://github.com/oasis-open/cti-python-stix2/blob/master/README.md">README</a> document for other details.</p>
</div>

<div>
Expand All @@ -17,7 +17,7 @@
<div>
<h2><a id="contributionDefined">Contributions Subject to Individual CLA</a></h2>

<p>Formally, <a id="openRepoContribution">"contribution"</a> to this TC Open Repository refers to content merged into the "Code" repository (repository changes represented by code <a href="https://github.com/oasis-open/cti-python-stix2/commits/master">commits</a>), following the GitHub definition of <i><a href="https://help.github.com/articles/github-glossary/#contributor">contributor</a></i>: "someone who has contributed to a project by having a pull request merged but does not have collaborator [<i>i.e.</i>, direct write] access." Anyone who signs the TC Open Repository <a href="https://www.oasis-open.org/resources/open-repositories/cla/individual-cla">Individual Contributor License Agreement (CLA)</a>, signifying agreement with the licensing requirement, may contribute substantive content &mdash; subject to evaluation of a GitHub pull request. The main web page for this repository, as with any GitHub public repository, displays a link to a document listing contributions to the repository's default branch (filtered by Commits, Additions, and Deletions).</p>
<p>Formally, <a id="openRepoContribution">"contribution"</a> to this TC Open Repository refers to content merged into the "Code" repository (repository changes represented by code <a href="https://github.com/oasis-open/cti-python-stix2/commits/master">commits</a>), following the GitHub definition of <i><a href="https://help.github.com/articles/github-glossary/#contributor">contributor</a></i>: "someone who has contributed to a project by having a pull request merged but does not have collaborator [<i>i.e.</i>, direct write] access." Anyone who signs the TC Open Repository <a href="https://cla-assistant.io/oasis-open/Open-Repo-admin">Individual Contributor License Agreement (CLA)</a>, signifying agreement with the licensing requirement, may contribute substantive content &mdash; subject to evaluation of a GitHub pull request. The main web page for this repository, as with any GitHub public repository, displays a link to a document listing contributions to the repository's default branch (filtered by Commits, Additions, and Deletions).</p>

<p>This TC Open Repository, as with GitHub public repositories generally, also accepts public feedback from any GitHub user. Public feedback includes opening issues, authoring and editing comments, participating in conversations, making wiki edits, creating repository stars, and making suggestions via pull requests. Such feedback does not constitute an OASIS TC Open Repository <a href="#openRepoContribution">contribution</a>. Some details are presented under "Read permissions" in the table of <a href="https://help.github.com/articles/repository-permission-levels-for-an-organization/">permission levels</a> for a GitHub organization. Technical content intended as a substantive contribution (repository "Code") to an TC Open Repository is subject to evaluation, and requires a signed Individual CLA.</p>

Expand Down
15 changes: 6 additions & 9 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -135,18 +135,15 @@ select additional or substitute Maintainers, per `consensus agreements

**Current Maintainers of this TC Open Repository**

- `Chris Lenk <mailto:[email protected]>`__; GitHub ID:
https://github.com/clenk/; WWW: `MITRE Corporation <http://www.mitre.org/>`__

- `Rich Piazza <mailto:[email protected]>`__; GitHub ID:
https://github.com/rpiazza/; WWW: `MITRE Corporation <https://www.mitre.org/>`__

- `Andy Chisholm <mailto:[email protected]>`__; GitHub ID:
https://github.com/chisholm/; WWW: `MITRE Corporation <https://www.mitre.org/>`__

- `Jason Keirstead <mailto:[email protected]>`__; GitHub ID:
https://github.com/JasonKeirstead; WWW: `IBM <http://www.ibm.com/>`__

- `Emily Ratliff <mailto:[email protected]>`__; GitHub ID:
https://github.com/ejratl; WWW: `IBM <http://www.ibm.com/>`__

- `Rich Piazza <mailto:[email protected]>`__; GitHub ID:
https://github.com/rpiazza; WWW: `MITRE <http://www.mitre.org/>`__

About OASIS TC Open Repositories
--------------------------------

Expand Down
17 changes: 17 additions & 0 deletions determinsitic-id-checker.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import json

import stix2


def main():
with open("sco-examples-bundle.json", "r", encoding="utf-8") as examples:
all_examples = json.load(examples)
for obj in all_examples:
existing_id = obj["id"]
del obj["id"]
stix_obj = stix2.parse(obj)
print(f"id {existing_id} should be {stix_obj['id']}")


if __name__ == "__main__":
main()
2 changes: 1 addition & 1 deletion docs/api/datastore/stix2.datastore.filesystem.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ filesystem
==========================

.. automodule:: stix2.datastore.filesystem
:members:
:members:
2 changes: 1 addition & 1 deletion docs/api/datastore/stix2.datastore.filters.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ filters
=======================

.. automodule:: stix2.datastore.filters
:members:
:members:
2 changes: 1 addition & 1 deletion docs/api/datastore/stix2.datastore.memory.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ memory
======================

.. automodule:: stix2.datastore.memory
:members:
:members:
2 changes: 1 addition & 1 deletion docs/api/datastore/stix2.datastore.taxii.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ taxii
=====================

.. automodule:: stix2.datastore.taxii
:members:
:members:
4 changes: 2 additions & 2 deletions docs/api/equivalence/stix2.equivalence.pattern.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pattern
==============
=========================

.. automodule:: stix2.equivalence.pattern
:members:
:members:
2 changes: 1 addition & 1 deletion docs/api/markings/stix2.markings.granular_markings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ granular_markings
================================

.. automodule:: stix2.markings.granular_markings
:members:
:members:
2 changes: 1 addition & 1 deletion docs/api/markings/stix2.markings.object_markings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ object_markings
==============================

.. automodule:: stix2.markings.object_markings
:members:
:members:
2 changes: 1 addition & 1 deletion docs/api/markings/stix2.markings.utils.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ utils
====================

.. automodule:: stix2.markings.utils
:members:
:members:
4 changes: 2 additions & 2 deletions docs/api/stix2.confidence.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
confidence
confidence
================

.. automodule:: stix2.confidence
:members:
:members:
4 changes: 2 additions & 2 deletions docs/api/stix2.datastore.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
datastore
datastore
===============

.. automodule:: stix2.datastore
:members:
:members:
4 changes: 2 additions & 2 deletions docs/api/stix2.environment.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
environment
environment
=================

.. automodule:: stix2.environment
:members:
:members:
6 changes: 3 additions & 3 deletions docs/api/stix2.equivalence.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
equivalence
==============
equivalence
=================

.. automodule:: stix2.equivalence
:members:
:members:
4 changes: 2 additions & 2 deletions docs/api/stix2.exceptions.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
exceptions
exceptions
================

.. automodule:: stix2.exceptions
:members:
:members:
4 changes: 2 additions & 2 deletions docs/api/stix2.markings.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
markings
markings
==============

.. automodule:: stix2.markings
:members:
:members:
6 changes: 3 additions & 3 deletions docs/api/stix2.parsing.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
parsing
===============
parsing
=============

.. automodule:: stix2.parsing
:members:
:members:
6 changes: 3 additions & 3 deletions docs/api/stix2.pattern_visitor.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
pattern_visitor
================
pattern_visitor
=====================

.. automodule:: stix2.pattern_visitor
:members:
:members:
4 changes: 2 additions & 2 deletions docs/api/stix2.patterns.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
patterns
patterns
==============

.. automodule:: stix2.patterns
:members:
:members:
4 changes: 2 additions & 2 deletions docs/api/stix2.properties.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
properties
properties
================

.. automodule:: stix2.properties
:members:
:members:
6 changes: 3 additions & 3 deletions docs/api/stix2.serialization.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
serialization
================
serialization
===================

.. automodule:: stix2.serialization
:members:
:members:
4 changes: 2 additions & 2 deletions docs/api/stix2.utils.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
utils
utils
===========

.. automodule:: stix2.utils
:members:
:members:
4 changes: 2 additions & 2 deletions docs/api/stix2.v20.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
v20
v20
=========

.. automodule:: stix2.v20
:members:
:members:
4 changes: 2 additions & 2 deletions docs/api/stix2.v21.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
v21
v21
=========

.. automodule:: stix2.v21
:members:
:members:
6 changes: 3 additions & 3 deletions docs/api/stix2.versioning.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
versioning
===============
versioning
================

.. automodule:: stix2.versioning
:members:
:members:
4 changes: 2 additions & 2 deletions docs/api/stix2.workbench.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
workbench
workbench
===============

.. automodule:: stix2.workbench
:members:
:members:
5 changes: 2 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@
version = __version__
release = __version__

language = None
exclude_patterns = ['_build', '_templates', 'Thumbs.db', '.DS_Store', 'guide/.ipynb_checkpoints']
pygments_style = 'sphinx'
todo_include_todos = False
Expand Down Expand Up @@ -102,8 +101,8 @@ def can_document_member(cls, member, membername, isattr, parent):
issubclass(member, _STIXBase) and \
hasattr(member, '_properties')

def add_content(self, more_content, no_docstring=False):
ClassDocumenter.add_content(self, more_content, no_docstring)
def add_content(self, more_content):
ClassDocumenter.add_content(self, more_content)

obj = self.object
self.add_line(':Properties:', '<stixattr>')
Expand Down
6 changes: 3 additions & 3 deletions docs/guide/custom.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -1482,7 +1482,7 @@
"source": [
"### Custom Cyber Observable Extensions\n",
"\n",
"Finally, custom extensions to existing Cyber Observable types can also be created. Just use the @[CustomExtension](../api/v21/stix2.v21.observables.rst#stix2.v21.observables.CustomExtension) decorator. Note that you must provide the Cyber Observable class to which the extension applies. Again, any extra validation of the properties can be implemented by providing an ``__init__()`` but it is not required. Let's say we want to make an extension to the ``File`` Cyber Observable Object:"
"Finally, custom extensions to existing Cyber Observable types can also be created. Just use the @[CustomExtension](../api/v21/stix2.v21.common.rst#stix2.v21.common.CustomExtension) decorator. Note that you must provide the Cyber Observable class to which the extension applies. Again, any extra validation of the properties can be implemented by providing an ``__init__()`` but it is not required. Let's say we want to make an extension to the ``File`` Cyber Observable Object:"
]
},
{
Expand Down Expand Up @@ -1803,7 +1803,7 @@
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
Expand All @@ -1817,7 +1817,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.1"
"version": "3.9.2"
}
},
"nbformat": 4,
Expand Down
7 changes: 3 additions & 4 deletions docs/guide/ts_support.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@
"\n",
"Imports can be used in different ways depending on the use case and support levels.\n",
"\n",
"People who want to support the latest version of STIX 2 without having to make changes, can implicitly use the latest version:",
"<div class=\"alert alert-warning\">\n",
"People who want to support the latest version of STIX 2 without having to make changes, can implicitly use the latest version:<div class=\"alert alert-warning\">\n",
"\n",
"**Warning**\n",
"\n",
Expand Down Expand Up @@ -372,7 +371,7 @@
"source": [
"### How custom content works\n",
"\n",
"[CustomObject](../api/v21/stix2.v21.sdo.rst#stix2.v21.sdo.CustomObject), [CustomObservable](../api/v21/stix2.v21.observables.rst#stix2.v21.observables.CustomObservable), [CustomMarking](../api/v21/stix2.v21.common.rst#stix2.v21.common.CustomMarking) and [CustomExtension](../api/v21/stix2.v21.observables.rst#stix2.v21.observables.CustomExtension) must be registered explicitly by STIX version. This is a design decision since properties or requirements may change as the STIX Technical Specification advances.\n",
"[CustomObject](../api/v21/stix2.v21.sdo.rst#stix2.v21.sdo.CustomObject), [CustomObservable](../api/v21/stix2.v21.observables.rst#stix2.v21.observables.CustomObservable), [CustomMarking](../api/v21/stix2.v21.common.rst#stix2.v21.common.CustomMarking) and [CustomExtension](../api/v21/stix2.v21.common.rst#stix2.v21.common.CustomExtension) must be registered explicitly by STIX version. This is a design decision since properties or requirements may change as the STIX Technical Specification advances.\n",
"\n",
"You can perform this by:"
]
Expand Down Expand Up @@ -416,7 +415,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.0a6"
"version": "3.9.2"
}
},
"nbformat": 4,
Expand Down
4 changes: 2 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
bumpversion
ipython
nbconvert<6
nbconvert
nbsphinx==0.8.6
pre-commit
pygments<3,>=2.4.1
pytest
pytest-cov
sphinx<2
sphinx<6
sphinx-prompt
tox

Expand Down
Loading

0 comments on commit 4b45b47

Please sign in to comment.