fluidattacks-core 5.0.0__tar.gz → 5.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/PKG-INFO +1 -1
- fluidattacks_core-5.1.0/fluidattacks_core/logging/filters.py +23 -0
- {fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/fluidattacks_core/logging/handlers.py +17 -2
- {fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/fluidattacks_core/semver/match_versions.py +2 -0
- {fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/fluidattacks_core.egg-info/PKG-INFO +1 -1
- {fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/pyproject.toml +4 -11
- fluidattacks_core-5.0.0/fluidattacks_core/logging/filters.py +0 -13
- {fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/README.md +0 -0
- {fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/fluidattacks_core/__init__.py +0 -0
- {fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/fluidattacks_core/aio/__init__.py +0 -0
- {fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/fluidattacks_core/aio/processes.py +0 -0
- {fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/fluidattacks_core/aio/runners.py +0 -0
- {fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/fluidattacks_core/aio/tasks.py +0 -0
- {fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/fluidattacks_core/aio/threads.py +0 -0
- {fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/fluidattacks_core/authz/__init__.py +0 -0
- {fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/fluidattacks_core/authz/py.typed +0 -0
- {fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/fluidattacks_core/authz/types.py +0 -0
- {fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/fluidattacks_core/cpg/__init__.py +0 -0
- {fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/fluidattacks_core/cpg/joern.py +0 -0
- {fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/fluidattacks_core/filesystem/__init__.py +0 -0
- {fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/fluidattacks_core/filesystem/defaults.py +0 -0
- {fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/fluidattacks_core/git/__init__.py +0 -0
- {fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/fluidattacks_core/git/classes.py +0 -0
- {fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/fluidattacks_core/git/clone.py +0 -0
- {fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/fluidattacks_core/git/codecommit_utils.py +0 -0
- {fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/fluidattacks_core/git/constants.py +0 -0
- {fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/fluidattacks_core/git/delete_files.py +0 -0
- {fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/fluidattacks_core/git/download_file.py +0 -0
- {fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/fluidattacks_core/git/download_repo.py +0 -0
- {fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/fluidattacks_core/git/https_utils.py +0 -0
- {fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/fluidattacks_core/git/py.typed +0 -0
- {fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/fluidattacks_core/git/remote.py +0 -0
- {fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/fluidattacks_core/git/ssh_utils.py +0 -0
- {fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/fluidattacks_core/git/utils.py +0 -0
- {fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/fluidattacks_core/git/warp.py +0 -0
- {fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/fluidattacks_core/http/__init__.py +0 -0
- {fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/fluidattacks_core/http/client.py +0 -0
- {fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/fluidattacks_core/http/validations.py +0 -0
- {fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/fluidattacks_core/logging/__init__.py +0 -0
- {fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/fluidattacks_core/logging/formatters.py +0 -0
- {fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/fluidattacks_core/logging/presets.py +0 -0
- {fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/fluidattacks_core/logging/sources/__init__.py +0 -0
- {fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/fluidattacks_core/logging/sources/types.py +0 -0
- {fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/fluidattacks_core/logging/sources/utils.py +0 -0
- {fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/fluidattacks_core/logging/utils.py +0 -0
- {fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/fluidattacks_core/py.typed +0 -0
- {fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/fluidattacks_core/sarif/__init__.py +0 -0
- {fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/fluidattacks_core/semver/__init__.py +0 -0
- {fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/fluidattacks_core/serializers/__init__.py +0 -0
- {fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/fluidattacks_core/serializers/snippet.py +0 -0
- {fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/fluidattacks_core/serializers/syntax.py +0 -0
- {fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/fluidattacks_core.egg-info/SOURCES.txt +0 -0
- {fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/fluidattacks_core.egg-info/dependency_links.txt +0 -0
- {fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/fluidattacks_core.egg-info/requires.txt +0 -0
- {fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/fluidattacks_core.egg-info/top_level.txt +0 -0
- {fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/setup.cfg +0 -0
- {fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/test/test_aio_tasks.py +0 -0
- {fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/test/test_extract_db.py +0 -0
- {fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/test/test_language_detection.py +0 -0
- {fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/test/test_logging.py +0 -0
- {fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/test/test_make_snippet.py +0 -0
- {fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/test/test_match_versions.py +0 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
|
|
3
|
+
from fluidattacks_core.logging.sources.utils import get_env_var, get_environment
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class NoProductionFilter(logging.Filter):
|
|
7
|
+
def filter(self, _record: logging.LogRecord) -> bool:
|
|
8
|
+
return get_environment() != "production"
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
class ProductionOnlyFilter(logging.Filter):
|
|
12
|
+
def filter(self, _record: logging.LogRecord) -> bool:
|
|
13
|
+
return get_environment() == "production"
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
class ErrorOnlyFilter(logging.Filter):
|
|
17
|
+
def filter(self, _record: logging.LogRecord) -> bool:
|
|
18
|
+
return _record.levelno >= logging.ERROR
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class EnabledTelemetryFilter(logging.Filter):
|
|
22
|
+
def filter(self, _record: logging.LogRecord) -> bool:
|
|
23
|
+
return str(get_env_var("TELEMETRY_OPT_OUT")).lower() != "true"
|
|
@@ -7,7 +7,12 @@ from typing import TextIO
|
|
|
7
7
|
|
|
8
8
|
import simplejson as json
|
|
9
9
|
|
|
10
|
-
from fluidattacks_core.logging.filters import
|
|
10
|
+
from fluidattacks_core.logging.filters import (
|
|
11
|
+
EnabledTelemetryFilter,
|
|
12
|
+
ErrorOnlyFilter,
|
|
13
|
+
NoProductionFilter,
|
|
14
|
+
ProductionOnlyFilter,
|
|
15
|
+
)
|
|
11
16
|
from fluidattacks_core.logging.formatters import ColorfulFormatter, CustomJsonFormatter
|
|
12
17
|
|
|
13
18
|
|
|
@@ -114,7 +119,14 @@ class DatadogLogsHandler(HTTPHandler):
|
|
|
114
119
|
|
|
115
120
|
|
|
116
121
|
class TelemetryAsyncHandler(CustomQueueHandler):
|
|
117
|
-
"""Logging handler for sending logs to telemetry services asynchronously.
|
|
122
|
+
"""Logging handler for sending logs to telemetry services asynchronously.
|
|
123
|
+
|
|
124
|
+
To enable telemetry, set the `TELEMETRY_OPT_OUT` environment variable different from `true`.
|
|
125
|
+
|
|
126
|
+
Includes:
|
|
127
|
+
- Filters: `ErrorOnlyFilter`, `EnabledTelemetryFilter`
|
|
128
|
+
- Formatter: `CustomJsonFormatter`
|
|
129
|
+
"""
|
|
118
130
|
|
|
119
131
|
def __init__(self, service: str, source: str, dd_client_token: str) -> None:
|
|
120
132
|
"""Initialize the TelemetryAsyncHandler.
|
|
@@ -125,6 +137,9 @@ class TelemetryAsyncHandler(CustomQueueHandler):
|
|
|
125
137
|
dd_client_token: The Datadog Client Token.
|
|
126
138
|
|
|
127
139
|
"""
|
|
140
|
+
self.addFilter(ErrorOnlyFilter())
|
|
141
|
+
self.addFilter(EnabledTelemetryFilter())
|
|
142
|
+
|
|
128
143
|
handler = DatadogLogsHandler(service, source, dd_client_token)
|
|
129
144
|
handler.setFormatter(CustomJsonFormatter())
|
|
130
145
|
|
{fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/fluidattacks_core/semver/match_versions.py
RENAMED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
import re
|
|
3
|
+
from functools import lru_cache
|
|
3
4
|
from itertools import (
|
|
4
5
|
zip_longest,
|
|
5
6
|
)
|
|
@@ -283,6 +284,7 @@ def match_version_ranges(dep_version: str, vulnerable_version: str) -> bool:
|
|
|
283
284
|
return False
|
|
284
285
|
|
|
285
286
|
|
|
287
|
+
@lru_cache(maxsize=100000)
|
|
286
288
|
def match_vulnerable_versions(dep_version: str, advisory_range: str | None) -> bool:
|
|
287
289
|
if advisory_range is None:
|
|
288
290
|
return False
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "fluidattacks-core"
|
|
3
|
-
version = "5.
|
|
3
|
+
version = "5.1.0"
|
|
4
4
|
description = "Fluid Attacks Core Library"
|
|
5
5
|
authors = [{ name = "Development", email = "development@fluidattacks.com" }]
|
|
6
6
|
license = { text = "MPL-2.0" }
|
|
@@ -29,17 +29,10 @@ git = [
|
|
|
29
29
|
"botocore>=1.40.18",
|
|
30
30
|
"GitPython>=3.1.41",
|
|
31
31
|
"pathspec>=0.12.1",
|
|
32
|
-
"urllib3>=2.6.1"
|
|
33
|
-
]
|
|
34
|
-
http = [
|
|
35
|
-
"aiohttp>=3.10.0",
|
|
36
|
-
"certifi>=2024.8.30",
|
|
37
|
-
"urllib3>=2.6.1"
|
|
38
|
-
]
|
|
39
|
-
logging = [
|
|
40
|
-
"simplejson>=3.20.1",
|
|
41
|
-
"python-json-logger>=3.3.0",
|
|
32
|
+
"urllib3>=2.6.1",
|
|
42
33
|
]
|
|
34
|
+
http = ["aiohttp>=3.10.0", "certifi>=2024.8.30", "urllib3>=2.6.1"]
|
|
35
|
+
logging = ["simplejson>=3.20.1", "python-json-logger>=3.3.0"]
|
|
43
36
|
serializers = [
|
|
44
37
|
"more-itertools>=10.0.0",
|
|
45
38
|
"tree-sitter-c-sharp>=0.23.1",
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import logging
|
|
2
|
-
|
|
3
|
-
from fluidattacks_core.logging.sources.utils import get_environment
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
class NoProductionFilter(logging.Filter):
|
|
7
|
-
def filter(self, _record: logging.LogRecord) -> bool:
|
|
8
|
-
return get_environment() != "production"
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
class ProductionOnlyFilter(logging.Filter):
|
|
12
|
-
def filter(self, _record: logging.LogRecord) -> bool:
|
|
13
|
-
return get_environment() == "production"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/fluidattacks_core/filesystem/__init__.py
RENAMED
|
File without changes
|
{fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/fluidattacks_core/filesystem/defaults.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/fluidattacks_core/git/codecommit_utils.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/fluidattacks_core/logging/sources/__init__.py
RENAMED
|
File without changes
|
{fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/fluidattacks_core/logging/sources/types.py
RENAMED
|
File without changes
|
{fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/fluidattacks_core/logging/sources/utils.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/fluidattacks_core/serializers/__init__.py
RENAMED
|
File without changes
|
{fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/fluidattacks_core/serializers/snippet.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/fluidattacks_core.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
|
File without changes
|
{fluidattacks_core-5.0.0 → fluidattacks_core-5.1.0}/fluidattacks_core.egg-info/top_level.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|