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

2.3.32 #120

Merged
merged 3 commits into from
Jan 18, 2024
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 firepit/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

__author__ = """IBM Security"""
__email__ = 'pcoccoli@us.ibm.com'
__version__ = '2.3.31'
__version__ = '2.3.32'


import re
Expand Down
9 changes: 6 additions & 3 deletions firepit/stix20.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,14 @@ def comp2sql(sco_type, prop, op, value, dialect):
_, from_type, ref_name, to_type = link
if ref_name.endswith('_refs'):
# Handle reflists
tmp = (f'JOIN "__reflist" AS "r" ON "{from_type}"."id" = "r"."source_ref"'
f' WHERE "r"."target_ref"')
tmp = (f'"id" IN (SELECT "id" FROM "{from_type}" JOIN "__reflist" AS "r"'
f' ON "{from_type}"."id" = "r"."source_ref" AND "r"."ref_name" = \'{ref_name}\''
f' AND "r"."target_ref"')
end = ')'
else:
tmp = f'"{ref_name}"'
result = f' {tmp} IN (SELECT "id" FROM "{to_type}" WHERE {result})'
end = ''
result = f' {tmp} IN (SELECT "id" FROM "{to_type}" WHERE {result}){end}'

return result

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 = 2.3.31
current_version = 2.3.32
commit = True
tag = True

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,6 @@
test_suite='tests',
tests_require=test_requirements,
url='https://github.com/opencybersecurityalliance/firepit',
version='2.3.31',
version='2.3.32',
zip_safe=False,
)
5 changes: 3 additions & 2 deletions tests/test_stix_patterns.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,9 @@ def _normalize_ws(s):
"\"src_ref\" IN (SELECT \"id\" FROM \"ipv4-addr\" WHERE \"value\" = '127.0.0.1')"),
('email-message',
"[email-message:to_refs[*].value = 'name@example.com']",
("JOIN \"__reflist\" AS \"r\" ON \"email-message\".\"id\" = \"r\".\"source_ref\""
" WHERE \"r\".\"target_ref\" IN (SELECT \"id\" FROM \"email-addr\" WHERE \"value\" = 'name@example.com')")),
("\"id\" IN (SELECT \"id\" FROM \"email-message\" JOIN \"__reflist\" AS \"r\""
" ON \"email-message\".\"id\" = \"r\".\"source_ref\" AND \"r\".\"ref_name\" = 'to_refs'"
" AND \"r\".\"target_ref\" IN (SELECT \"id\" FROM \"email-addr\" WHERE \"value\" = 'name@example.com'))")),
('file',
"[file:hashes.'SHA-256' = 'whatever']",
"\"hashes.'SHA-256'\" = 'whatever'"),
Expand Down
Loading