Skip to content

Commit

Permalink
Fix packs to check for platform before including queries (osquery#7461)
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonL888 authored Feb 29, 2024
1 parent 0e2b8ed commit 01ed1f6
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tools/tests/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ def platform():


def queries_from_config(config_path):
spec_platform = platform()
config = {}
rmcomment = re.compile('\/\*[\*A-Za-z0-9\n\s\.\{\}\'\/\\\:]+\*\/|\s+\/\/.*|^\/\/.*|\x5c\x5c\x0a')
try:
Expand Down Expand Up @@ -100,6 +101,8 @@ def queries_from_config(config_path):
packcontent = rmcomment.sub('', packfile)
packqueries = json.loads(packcontent)
for queryname, query in packqueries["queries"].items():
if "platform" in query and query['platform'] != spec_platform:
continue
queries["pack_" + queryname] = query["query"]

return queries
Expand Down

0 comments on commit 01ed1f6

Please sign in to comment.