fluidattacks-core 2.16.0__tar.gz → 2.16.1__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-2.16.0 → fluidattacks_core-2.16.1}/PKG-INFO +1 -1
- fluidattacks_core-2.16.1/fluidattacks_core/git/constants.py +1 -0
- fluidattacks_core-2.16.1/fluidattacks_core/git/download_file.py +40 -0
- {fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/fluidattacks_core/git/download_repo.py +8 -1
- {fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/fluidattacks_core.egg-info/PKG-INFO +1 -1
- {fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/fluidattacks_core.egg-info/SOURCES.txt +1 -0
- {fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/pyproject.toml +1 -1
- fluidattacks_core-2.16.0/fluidattacks_core/git/download_file.py +0 -26
- {fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/README.md +0 -0
- {fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/fluidattacks_core/__init__.py +0 -0
- {fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/fluidattacks_core/aio/__init__.py +0 -0
- {fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/fluidattacks_core/aio/processes.py +0 -0
- {fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/fluidattacks_core/aio/runners.py +0 -0
- {fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/fluidattacks_core/aio/tasks.py +0 -0
- {fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/fluidattacks_core/aio/threads.py +0 -0
- {fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/fluidattacks_core/authz/__init__.py +0 -0
- {fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/fluidattacks_core/authz/py.typed +0 -0
- {fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/fluidattacks_core/authz/types.py +0 -0
- {fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/fluidattacks_core/bugsnag/__init__.py +0 -0
- {fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/fluidattacks_core/bugsnag/client.py +0 -0
- {fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/fluidattacks_core/cpg/__init__.py +0 -0
- {fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/fluidattacks_core/cpg/joern.py +0 -0
- {fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/fluidattacks_core/filesystem/__init__.py +0 -0
- {fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/fluidattacks_core/filesystem/defaults.py +0 -0
- {fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/fluidattacks_core/git/__init__.py +0 -0
- {fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/fluidattacks_core/git/classes.py +0 -0
- {fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/fluidattacks_core/git/clone.py +0 -0
- {fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/fluidattacks_core/git/codecommit_utils.py +0 -0
- {fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/fluidattacks_core/git/delete_files.py +0 -0
- {fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/fluidattacks_core/git/https_utils.py +0 -0
- {fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/fluidattacks_core/git/py.typed +0 -0
- {fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/fluidattacks_core/git/remote.py +0 -0
- {fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/fluidattacks_core/git/ssh_utils.py +0 -0
- {fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/fluidattacks_core/git/utils.py +0 -0
- {fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/fluidattacks_core/git/warp.py +0 -0
- {fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/fluidattacks_core/http/__init__.py +0 -0
- {fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/fluidattacks_core/http/client.py +0 -0
- {fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/fluidattacks_core/http/validations.py +0 -0
- {fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/fluidattacks_core/logging/__init__.py +0 -0
- {fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/fluidattacks_core/logging/filters.py +0 -0
- {fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/fluidattacks_core/logging/formatters.py +0 -0
- {fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/fluidattacks_core/logging/handlers.py +0 -0
- {fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/fluidattacks_core/logging/presets.py +0 -0
- {fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/fluidattacks_core/logging/types.py +0 -0
- {fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/fluidattacks_core/logging/utils.py +0 -0
- {fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/fluidattacks_core/py.typed +0 -0
- {fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/fluidattacks_core/sarif/__init__.py +0 -0
- {fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/fluidattacks_core/semver/__init__.py +0 -0
- {fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/fluidattacks_core/semver/match_versions.py +0 -0
- {fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/fluidattacks_core/serializers/__init__.py +0 -0
- {fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/fluidattacks_core/serializers/snippet.py +0 -0
- {fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/fluidattacks_core/serializers/syntax.py +0 -0
- {fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/fluidattacks_core.egg-info/dependency_links.txt +0 -0
- {fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/fluidattacks_core.egg-info/requires.txt +0 -0
- {fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/fluidattacks_core.egg-info/top_level.txt +0 -0
- {fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/setup.cfg +0 -0
- {fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/test/test_aio_tasks.py +0 -0
- {fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/test/test_extract_db.py +0 -0
- {fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/test/test_language_detection.py +0 -0
- {fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/test/test_logging.py +0 -0
- {fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/test/test_make_snippet.py +0 -0
- {fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/test/test_match_versions.py +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
DEFAULT_DOWNLOAD_BUFFER_SIZE = 64 * 1024 # 64KB
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
|
|
4
|
+
import aiofiles
|
|
5
|
+
import aiohttp
|
|
6
|
+
|
|
7
|
+
from .constants import DEFAULT_DOWNLOAD_BUFFER_SIZE
|
|
8
|
+
|
|
9
|
+
LOGGER = logging.getLogger(__name__)
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
async def download_file(
|
|
13
|
+
*,
|
|
14
|
+
url: str,
|
|
15
|
+
destination_path: str,
|
|
16
|
+
download_buffer_size: int = DEFAULT_DOWNLOAD_BUFFER_SIZE,
|
|
17
|
+
) -> bool:
|
|
18
|
+
timeout = aiohttp.ClientTimeout(total=60 * 60, connect=30)
|
|
19
|
+
async with aiohttp.ClientSession(timeout=timeout) as session: # noqa: SIM117
|
|
20
|
+
async with session.get(url) as response:
|
|
21
|
+
if response.status != 200:
|
|
22
|
+
LOGGER.error(
|
|
23
|
+
"Failed to download file: HTTP %s, for path %s",
|
|
24
|
+
response.status,
|
|
25
|
+
destination_path,
|
|
26
|
+
)
|
|
27
|
+
return False
|
|
28
|
+
|
|
29
|
+
async with aiofiles.open(destination_path, "wb") as file:
|
|
30
|
+
while True:
|
|
31
|
+
try:
|
|
32
|
+
chunk = await response.content.read(download_buffer_size)
|
|
33
|
+
except TimeoutError:
|
|
34
|
+
LOGGER.exception("Read timeout for path %s", destination_path)
|
|
35
|
+
return False
|
|
36
|
+
if not chunk:
|
|
37
|
+
break
|
|
38
|
+
await file.write(chunk)
|
|
39
|
+
|
|
40
|
+
return Path(destination_path).exists()
|
{fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/fluidattacks_core/git/download_repo.py
RENAMED
|
@@ -9,6 +9,7 @@ from git import GitError
|
|
|
9
9
|
from git.cmd import Git
|
|
10
10
|
from git.repo import Repo
|
|
11
11
|
|
|
12
|
+
from .constants import DEFAULT_DOWNLOAD_BUFFER_SIZE
|
|
12
13
|
from .delete_files import delete_out_of_scope_files
|
|
13
14
|
from .download_file import download_file
|
|
14
15
|
|
|
@@ -83,12 +84,18 @@ async def download_repo_from_s3(
|
|
|
83
84
|
download_url: str,
|
|
84
85
|
destination_path: Path,
|
|
85
86
|
git_ignore: list[str] | None = None,
|
|
87
|
+
*,
|
|
88
|
+
download_buffer_size: int = DEFAULT_DOWNLOAD_BUFFER_SIZE,
|
|
86
89
|
) -> bool:
|
|
87
90
|
destination_path.parent.mkdir(parents=True, exist_ok=True)
|
|
88
91
|
with tempfile.TemporaryDirectory(prefix="fluidattacks_", ignore_cleanup_errors=True) as tmpdir:
|
|
89
92
|
tmp_path = Path(tmpdir)
|
|
90
93
|
file_path = tmp_path / "repo.tar.gz"
|
|
91
|
-
result = await download_file(
|
|
94
|
+
result = await download_file(
|
|
95
|
+
url=download_url,
|
|
96
|
+
destination_path=str(file_path.absolute()),
|
|
97
|
+
download_buffer_size=download_buffer_size,
|
|
98
|
+
)
|
|
92
99
|
if not result:
|
|
93
100
|
LOGGER.error("Failed to download repository from %s", download_url)
|
|
94
101
|
return False
|
{fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/fluidattacks_core.egg-info/SOURCES.txt
RENAMED
|
@@ -25,6 +25,7 @@ fluidattacks_core/git/__init__.py
|
|
|
25
25
|
fluidattacks_core/git/classes.py
|
|
26
26
|
fluidattacks_core/git/clone.py
|
|
27
27
|
fluidattacks_core/git/codecommit_utils.py
|
|
28
|
+
fluidattacks_core/git/constants.py
|
|
28
29
|
fluidattacks_core/git/delete_files.py
|
|
29
30
|
fluidattacks_core/git/download_file.py
|
|
30
31
|
fluidattacks_core/git/download_repo.py
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import logging
|
|
2
|
-
from pathlib import Path
|
|
3
|
-
|
|
4
|
-
import aiofiles
|
|
5
|
-
import aiohttp
|
|
6
|
-
|
|
7
|
-
LOGGER = logging.getLogger(__name__)
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
async def download_file(url: str, destination_path: str) -> bool:
|
|
11
|
-
async with aiohttp.ClientSession(timeout=aiohttp.ClientTimeout(total=3600)) as session: # noqa: SIM117
|
|
12
|
-
async with session.get(url) as response:
|
|
13
|
-
if response.status == 200:
|
|
14
|
-
async with aiofiles.open(destination_path, "wb") as file:
|
|
15
|
-
while True:
|
|
16
|
-
try:
|
|
17
|
-
chunk = await response.content.read(1024 * 10)
|
|
18
|
-
except TimeoutError:
|
|
19
|
-
LOGGER.warning("Read timeout")
|
|
20
|
-
return False
|
|
21
|
-
if not chunk:
|
|
22
|
-
break
|
|
23
|
-
await file.write(chunk)
|
|
24
|
-
return Path(destination_path).exists()
|
|
25
|
-
|
|
26
|
-
return False
|
|
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-2.16.0 → fluidattacks_core-2.16.1}/fluidattacks_core/filesystem/__init__.py
RENAMED
|
File without changes
|
{fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/fluidattacks_core/filesystem/defaults.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/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
|
{fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/fluidattacks_core/logging/formatters.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
|
{fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/fluidattacks_core/semver/match_versions.py
RENAMED
|
File without changes
|
{fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/fluidattacks_core/serializers/__init__.py
RENAMED
|
File without changes
|
{fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/fluidattacks_core/serializers/snippet.py
RENAMED
|
File without changes
|
{fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/fluidattacks_core/serializers/syntax.py
RENAMED
|
File without changes
|
|
File without changes
|
{fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/fluidattacks_core.egg-info/requires.txt
RENAMED
|
File without changes
|
{fluidattacks_core-2.16.0 → fluidattacks_core-2.16.1}/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
|