Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .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.8, 3.9, '3.10', '3.11', '3.12']
python-version: ['3.10', '3.11', '3.12', '3.13', '3.14']

name: Python ${{ matrix.python-version }} Build
steps:
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ repos:
hooks:
- id: add-trailing-comma
- repo: https://github.com/PyCQA/flake8
rev: 3.8.4
rev: 7.1.0
hooks:
- id: flake8
name: Check project styling
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 3.0.1
current_version = 3.0.2
commit = True
tag = True

Expand Down
8 changes: 4 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,20 +38,20 @@ def get_long_description():
'Topic :: Security',
'License :: OSI Approved :: BSD License',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Programming Language :: Python :: 3.10',
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
'Programming Language :: Python :: 3.13',
'Programming Language :: Python :: 3.14',
],
keywords='stix stix2 json cti cyber threat intelligence',
packages=find_packages(exclude=['*.test', '*.test.*']),
python_requires='>=3.8',
python_requires='>=3.10',
install_requires=[
'pytz',
'requests',
'simplejson',
'stix2-patterns>=1.2.0',
'stix2-patterns>=2.1.2',
],
project_urls={
'Documentation': 'https://stix2.readthedocs.io/',
Expand Down
16 changes: 8 additions & 8 deletions stix2/test/v20/test_pattern_equivalence.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
@pytest.mark.parametrize(
"patt1, patt2", [
(
"[a:b=1] START '1993-06-29T15:24:42Z' STOP '2000-07-30T19:29:58Z'",
"[a:b=1 OR (a:c=2 AND a:b=1)] START '1993-06-29T15:24:42Z' STOP '2000-07-30T19:29:58Z'",
"[a:b=1] START t'1993-06-29T15:24:42Z' STOP t'2000-07-30T19:29:58Z'",
"[a:b=1 OR (a:c=2 AND a:b=1)] START t'1993-06-29T15:24:42Z' STOP t'2000-07-30T19:29:58Z'",
),
(
"[a:b=1] START '1993-06-29T15:24:42Z' STOP '2000-07-30T19:29:58Z' WITHIN 2 SECONDS",
"[a:b=1 OR (a:c=2 AND a:b=1)] START '1993-06-29T15:24:42Z' STOP '2000-07-30T19:29:58Z' WITHIN 2 SECONDS",
"[a:b=1] START t'1993-06-29T15:24:42Z' STOP t'2000-07-30T19:29:58Z' WITHIN 2 SECONDS",
"[a:b=1 OR (a:c=2 AND a:b=1)] START t'1993-06-29T15:24:42Z' STOP t'2000-07-30T19:29:58Z' WITHIN 2 SECONDS",
),
(
"[a:b=1] REPEATS 2 TIMES REPEATS 2 TIMES",
Expand All @@ -30,12 +30,12 @@ def test_startstop_equivalent(patt1, patt2):
@pytest.mark.parametrize(
"patt1, patt2", [
(
"[a:b!=1] START '1993-06-29T15:24:42Z' STOP '2000-07-30T19:29:58Z'",
"[a:b!=1] START '1977-09-29T07:41:03Z' STOP '1996-09-18T22:46:07Z'",
"[a:b!=1] START t'1993-06-29T15:24:42Z' STOP t'2000-07-30T19:29:58Z'",
"[a:b!=1] START t'1977-09-29T07:41:03Z' STOP t'1996-09-18T22:46:07Z'",
),
(
"[a:b<1] REPEATS 2 TIMES START '1993-06-29T15:24:42Z' STOP '2000-07-30T19:29:58Z'",
"[a:b<1] REPEATS 2 TIMES START '1977-09-29T07:41:03Z' STOP '1996-09-18T22:46:07Z'",
"[a:b<1] REPEATS 2 TIMES START t'1993-06-29T15:24:42Z' STOP t'2000-07-30T19:29:58Z'",
"[a:b<1] REPEATS 2 TIMES START t'1977-09-29T07:41:03Z' STOP t'1996-09-18T22:46:07Z'",
),
(
"[a:b=1] REPEATS 2 TIMES REPEATS 2 TIMES",
Expand Down
13 changes: 7 additions & 6 deletions stix2/test/v20/test_pattern_expressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import pytest
import pytz
from stix2patterns.exceptions import ParseException

import stix2
from stix2.pattern_visitor import create_pattern_object
Expand Down Expand Up @@ -551,11 +552,11 @@ def test_parsing_qualified_expression():


def test_parsing_start_stop_qualified_expression():
patt_obj = create_pattern_object("[ipv4-addr:value = '1.2.3.4'] START '2016-06-01T00:00:00Z' STOP '2017-03-12T08:30:00Z'", version="2.0")
patt_obj = create_pattern_object("[ipv4-addr:value = '1.2.3.4'] START t'2016-06-01T00:00:00Z' STOP t'2017-03-12T08:30:00Z'", version="2.0")

assert str(
patt_obj,
) == "[ipv4-addr:value = '1.2.3.4'] START '2016-06-01T00:00:00Z' STOP '2017-03-12T08:30:00Z'"
) == "[ipv4-addr:value = '1.2.3.4'] START t'2016-06-01T00:00:00Z' STOP t'2017-03-12T08:30:00Z'"


def test_parsing_mixed_boolean_expression_1():
Expand Down Expand Up @@ -585,8 +586,8 @@ def test_parsing_quoted_second_path_component():


def test_parsing_illegal_start_stop_qualified_expression():
with pytest.raises(ValueError):
create_pattern_object("[ipv4-addr:value = '1.2.3.4'] START '2016-06-01' STOP '2017-03-12T08:30:00Z'", version="2.0")
with pytest.raises(ParseException):
create_pattern_object("[ipv4-addr:value = '1.2.3.4'] START t'2016-06-01' STOP t'2017-03-12T08:30:00Z'", version="2.0")


def test_list_constant():
Expand Down Expand Up @@ -631,7 +632,7 @@ def test_ast_class_override_string_constant():

def test_ast_class_override_startstop_qualifier():
patt_ast = create_pattern_object(
"[a:b=1] START '1993-01-20T01:33:52.592Z' STOP '2001-08-19T23:50:23.129Z'",
"[a:b=1] START t'1993-01-20T01:33:52.592Z' STOP t'2001-08-19T23:50:23.129Z'",
"Testing", "stix2.test.v20.pattern_ast_overrides", version="2.0",
)

Expand All @@ -646,4 +647,4 @@ def test_ast_class_override_startstop_qualifier():
assert isinstance(
patt_ast.qualifier, StartStopQualifierForTesting,
)
assert str(patt_ast) == "[a:b = 1] START '1993-01-20T01:33:52.592Z' STOP '2001-08-19T23:50:23.129Z'"
assert str(patt_ast) == "[a:b = 1] START t'1993-01-20T01:33:52.592Z' STOP t'2001-08-19T23:50:23.129Z'"
4 changes: 2 additions & 2 deletions stix2/test/v21/test_timestamp_precision.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
parse_into_datetime, to_enum,
)

_DT = datetime.datetime.utcnow()
_DT = datetime.datetime.now(datetime.timezone.utc)
# intentionally omit microseconds from the following. We add it in as
# needed for each test.
_DT_STR = _DT.strftime("%Y-%m-%dT%H:%M:%S")
Expand Down Expand Up @@ -55,7 +55,7 @@ def test_stix_datetime_now():


def test_stix_datetime():
dt = datetime.datetime.utcnow()
dt = datetime.datetime.now(datetime.timezone.utc)

sdt = STIXdatetime(dt, precision=Precision.SECOND)
assert sdt.precision is Precision.SECOND
Expand Down
2 changes: 1 addition & 1 deletion stix2/version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__version__ = "3.0.1"
__version__ = "3.0.2"

DEFAULT_VERSION = '2.1' # Default version will always be the latest STIX 2.X version
9 changes: 5 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[tox]
envlist = py38,py39,py310,py311,py312,packaging,pre-commit-check
envlist = py310,py311,py312,py313,py314,packaging,pre-commit-check

[testenv]
deps =
Expand All @@ -19,6 +19,7 @@ passenv = GITHUB_*
[testenv:packaging]
deps =
twine
setuptools
commands =
python setup.py sdist bdist_wheel --universal
twine check dist/*
Expand All @@ -31,8 +32,8 @@ commands =

[gh-actions]
python =
3.8: py38
3.9: py39
3.10: py310
3.11: py311, packaging, pre-commit-check
3.11: py311
3.12: py312
3.13: py313
3.14: py314, packaging, pre-commit-check