fluidattacks-core 2.2.2__tar.gz → 2.2.3__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.
Files changed (24) hide show
  1. {fluidattacks_core-2.2.2 → fluidattacks_core-2.2.3}/PKG-INFO +2 -2
  2. {fluidattacks_core-2.2.2 → fluidattacks_core-2.2.3}/fluidattacks_core/git/__init__.py +16 -3
  3. {fluidattacks_core-2.2.2 → fluidattacks_core-2.2.3}/fluidattacks_core/git/clone.py +6 -2
  4. {fluidattacks_core-2.2.2 → fluidattacks_core-2.2.3}/fluidattacks_core/git/codecommit_utils.py +10 -4
  5. {fluidattacks_core-2.2.2 → fluidattacks_core-2.2.3}/fluidattacks_core/git/https_utils.py +12 -3
  6. {fluidattacks_core-2.2.2 → fluidattacks_core-2.2.3}/fluidattacks_core/git/remote.py +3 -0
  7. {fluidattacks_core-2.2.2 → fluidattacks_core-2.2.3}/pyproject.toml +2 -2
  8. {fluidattacks_core-2.2.2 → fluidattacks_core-2.2.3}/README.md +0 -0
  9. {fluidattacks_core-2.2.2 → fluidattacks_core-2.2.3}/fluidattacks_core/__init__.py +0 -0
  10. {fluidattacks_core-2.2.2 → fluidattacks_core-2.2.3}/fluidattacks_core/authz/__init__.py +0 -0
  11. {fluidattacks_core-2.2.2 → fluidattacks_core-2.2.3}/fluidattacks_core/authz/py.typed +0 -0
  12. {fluidattacks_core-2.2.2 → fluidattacks_core-2.2.3}/fluidattacks_core/authz/types.py +0 -0
  13. {fluidattacks_core-2.2.2 → fluidattacks_core-2.2.3}/fluidattacks_core/git/classes.py +0 -0
  14. {fluidattacks_core-2.2.2 → fluidattacks_core-2.2.3}/fluidattacks_core/git/delete_files.py +0 -0
  15. {fluidattacks_core-2.2.2 → fluidattacks_core-2.2.3}/fluidattacks_core/git/download_file.py +0 -0
  16. {fluidattacks_core-2.2.2 → fluidattacks_core-2.2.3}/fluidattacks_core/git/download_repo.py +0 -0
  17. {fluidattacks_core-2.2.2 → fluidattacks_core-2.2.3}/fluidattacks_core/git/py.typed +0 -0
  18. {fluidattacks_core-2.2.2 → fluidattacks_core-2.2.3}/fluidattacks_core/git/ssh_utils.py +0 -0
  19. {fluidattacks_core-2.2.2 → fluidattacks_core-2.2.3}/fluidattacks_core/git/utils.py +0 -0
  20. {fluidattacks_core-2.2.2 → fluidattacks_core-2.2.3}/fluidattacks_core/git/warp.py +0 -0
  21. {fluidattacks_core-2.2.2 → fluidattacks_core-2.2.3}/fluidattacks_core/http/__init__.py +0 -0
  22. {fluidattacks_core-2.2.2 → fluidattacks_core-2.2.3}/fluidattacks_core/http/client.py +0 -0
  23. {fluidattacks_core-2.2.2 → fluidattacks_core-2.2.3}/fluidattacks_core/http/validations.py +0 -0
  24. {fluidattacks_core-2.2.2 → fluidattacks_core-2.2.3}/fluidattacks_core/py.typed +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: fluidattacks-core
3
- Version: 2.2.2
3
+ Version: 2.2.3
4
4
  Summary: Fluid Attacks Core Library
5
5
  License: MPL-2.0
6
6
  Author: Development
@@ -16,7 +16,7 @@ Classifier: Programming Language :: Python :: 3.12
16
16
  Classifier: Topic :: Software Development :: Libraries
17
17
  Requires-Dist: GitPython (>=3.1.41)
18
18
  Requires-Dist: aiofiles (>=23.2.1)
19
- Requires-Dist: aiohttp (>=3.9.2)
19
+ Requires-Dist: aiohttp (>=3.11.4)
20
20
  Requires-Dist: boto3 (>=1.34)
21
21
  Requires-Dist: certifi (>=2024.8.30)
22
22
  Requires-Dist: pathspec (>=0.12.1)
@@ -89,7 +89,8 @@ async def disable_quotepath(git_path: str) -> None:
89
89
 
90
90
 
91
91
  async def get_last_commit_info_new(
92
- repo_path: str, filename: str
92
+ repo_path: str,
93
+ filename: str,
93
94
  ) -> CommitInfo | None:
94
95
  proc = await asyncio.create_subprocess_exec(
95
96
  "git",
@@ -192,7 +193,9 @@ async def get_modified_filenames(repo_path: str, commit_sha: str) -> list[str]:
192
193
 
193
194
 
194
195
  async def is_commit_in_branch(
195
- repo_path: str, branch: str, commit_sha: str
196
+ repo_path: str,
197
+ branch: str,
198
+ commit_sha: str,
196
199
  ) -> bool:
197
200
  proc = await asyncio.create_subprocess_exec(
198
201
  "git",
@@ -260,7 +263,13 @@ def rebase(
260
263
  except (UnicodeDecodeError, UnicodeEncodeError) as exc:
261
264
  if ignore_errors:
262
265
  LOGGER.exception(
263
- exc, extra={"extra": {"path": path, "new_path": new_path}}
266
+ exc,
267
+ extra={
268
+ "extra": {
269
+ "path": path,
270
+ "new_path": new_path,
271
+ }
272
+ },
264
273
  )
265
274
  return None
266
275
 
@@ -313,6 +322,7 @@ async def clone(
313
322
  is_pat: bool = False,
314
323
  arn: str | None = None,
315
324
  org_external_id: str | None = None,
325
+ follow_redirects: bool = True,
316
326
  ) -> tuple[str | None, str | None]:
317
327
  if credential_key:
318
328
  return await ssh_clone(
@@ -329,6 +339,7 @@ async def clone(
329
339
  temp_dir=temp_dir,
330
340
  token=None,
331
341
  user=user,
342
+ follow_redirects=follow_redirects,
332
343
  )
333
344
  if token is not None:
334
345
  return await https_clone(
@@ -340,6 +351,7 @@ async def clone(
340
351
  user=None,
341
352
  provider=provider,
342
353
  is_pat=is_pat,
354
+ follow_redirects=follow_redirects,
343
355
  )
344
356
  if arn is not None and org_external_id is not None:
345
357
  return await call_codecommit_clone(
@@ -356,6 +368,7 @@ async def clone(
356
368
  branch=repo_branch,
357
369
  repo_url=repo_url,
358
370
  temp_dir=temp_dir,
371
+ follow_redirects=follow_redirects,
359
372
  )
360
373
 
361
374
  raise InvalidParameter()
@@ -80,6 +80,7 @@ async def https_clone(
80
80
  user: str | None = None,
81
81
  provider: str | None = None,
82
82
  is_pat: bool = False,
83
+ follow_redirects: bool = True,
83
84
  ) -> tuple[str | None, str | None]:
84
85
  url = format_url(
85
86
  repo_url=repo_url,
@@ -95,7 +96,7 @@ async def https_clone(
95
96
  "-c",
96
97
  "http.sslVerify=false",
97
98
  "-c",
98
- "http.followRedirects=true",
99
+ f"http.followRedirects={follow_redirects}",
99
100
  *(
100
101
  [
101
102
  "-c",
@@ -131,6 +132,7 @@ async def codecommit_clone(
131
132
  branch: str,
132
133
  repo_url: str,
133
134
  temp_dir: str,
135
+ follow_redirects: bool = True,
134
136
  ) -> tuple[str | None, str | None]:
135
137
  folder_to_clone_root = f"{temp_dir}/{uuid.uuid4()}"
136
138
  proc = await asyncio.create_subprocess_exec(
@@ -138,7 +140,7 @@ async def codecommit_clone(
138
140
  "-c",
139
141
  "http.sslVerify=false",
140
142
  "-c",
141
- "http.followRedirects=true",
143
+ f"http.followRedirects={follow_redirects}",
142
144
  "clone",
143
145
  "--branch",
144
146
  branch,
@@ -167,6 +169,7 @@ async def call_codecommit_clone(
167
169
  temp_dir: str,
168
170
  arn: str,
169
171
  org_external_id: str,
172
+ follow_redirects: bool = True,
170
173
  ) -> tuple[str | None, str | None]:
171
174
  original_access_key = os.environ.get("AWS_ACCESS_KEY_ID")
172
175
  original_secret_key = os.environ.get("AWS_SECRET_ACCESS_KEY")
@@ -191,6 +194,7 @@ async def call_codecommit_clone(
191
194
  branch=branch,
192
195
  repo_url=repo_url,
193
196
  temp_dir=temp_dir,
197
+ follow_redirects=follow_redirects,
194
198
  )
195
199
 
196
200
  except ClientError as exc:
@@ -24,6 +24,7 @@ async def assume_role_and_execute_git(
24
24
  repo_url: str,
25
25
  branch: str,
26
26
  org_external_id: str,
27
+ follow_redirects: bool = True,
27
28
  ) -> str | None:
28
29
  original_access_key = os.environ.get("AWS_ACCESS_KEY_ID")
29
30
  original_secret_key = os.environ.get("AWS_SECRET_ACCESS_KEY")
@@ -44,7 +45,9 @@ async def assume_role_and_execute_git(
44
45
  os.environ["AWS_SESSION_TOKEN"] = credentials["SessionToken"]
45
46
  os.environ["AWS_DEFAULT_REGION"] = extract_region(repo_url)
46
47
 
47
- return await codecommit_ls_remote(repo_url=repo_url, branch=branch)
48
+ return await codecommit_ls_remote(
49
+ repo_url=repo_url, branch=branch, follow_redirects=follow_redirects
50
+ )
48
51
 
49
52
  except ClientError as exc:
50
53
  LOGGER.exception(
@@ -81,14 +84,14 @@ async def assume_role_and_execute_git(
81
84
 
82
85
 
83
86
  async def _execute_git_command(
84
- url: str, branch: str
87
+ url: str, branch: str, follow_redirects: bool = True
85
88
  ) -> tuple[bytes, bytes, int | None]:
86
89
  proc = await asyncio.create_subprocess_exec(
87
90
  "git",
88
91
  "-c",
89
92
  "http.sslVerify=false",
90
93
  "-c",
91
- "http.followRedirects=true",
94
+ f"http.followRedirects={follow_redirects}",
92
95
  "ls-remote",
93
96
  "--",
94
97
  url,
@@ -104,10 +107,11 @@ async def _execute_git_command(
104
107
  async def codecommit_ls_remote(
105
108
  repo_url: str,
106
109
  branch: str = "HEAD",
110
+ follow_redirects: bool = True,
107
111
  ) -> str | None:
108
112
  try:
109
113
  stdout, _stderr, return_code = await _execute_git_command(
110
- repo_url, branch
114
+ repo_url, branch, follow_redirects
111
115
  )
112
116
  if _stderr and return_code != 0:
113
117
  LOGGER.error(
@@ -136,10 +140,12 @@ async def call_codecommit_ls_remote(
136
140
  arn: str,
137
141
  branch: str,
138
142
  org_external_id: str,
143
+ follow_redirects: bool = True,
139
144
  ) -> str | None:
140
145
  return await assume_role_and_execute_git(
141
146
  repo_url=repo_url,
142
147
  arn=arn,
143
148
  branch=branch,
144
149
  org_external_id=org_external_id,
150
+ follow_redirects=follow_redirects,
145
151
  )
@@ -12,14 +12,18 @@ LOGGER = logging.getLogger(__name__)
12
12
 
13
13
 
14
14
  async def _execute_git_command(
15
- url: str, branch: str, is_pat: bool, token: str | None = None
15
+ url: str,
16
+ branch: str,
17
+ is_pat: bool,
18
+ token: str | None = None,
19
+ follow_redirects: bool = True,
16
20
  ) -> tuple[bytes, bytes, int | None]:
17
21
  proc = await asyncio.create_subprocess_exec(
18
22
  "git",
19
23
  "-c",
20
24
  "http.sslVerify=false",
21
25
  "-c",
22
- "http.followRedirects=true",
26
+ f"http.followRedirects={follow_redirects}",
23
27
  *(
24
28
  [
25
29
  "-c",
@@ -50,6 +54,7 @@ async def https_ls_remote(
50
54
  branch: str = "HEAD",
51
55
  provider: str | None = None,
52
56
  is_pat: bool = False,
57
+ follow_redirects: bool = True,
53
58
  ) -> str | None:
54
59
  url = format_url(
55
60
  repo_url=repo_url,
@@ -62,7 +67,7 @@ async def https_ls_remote(
62
67
 
63
68
  try:
64
69
  stdout, _stderr, return_code = await _execute_git_command(
65
- url, branch, is_pat, token
70
+ url, branch, is_pat, token, follow_redirects
66
71
  )
67
72
  if _stderr and return_code != 0:
68
73
  LOGGER.error(
@@ -96,6 +101,7 @@ async def call_https_ls_remote(
96
101
  branch: str,
97
102
  provider: str | None,
98
103
  is_pat: bool,
104
+ follow_redirects: bool = True,
99
105
  ) -> str | None:
100
106
  if user is not None and password is not None:
101
107
  return await https_ls_remote(
@@ -103,6 +109,7 @@ async def call_https_ls_remote(
103
109
  user=user,
104
110
  password=password,
105
111
  branch=branch,
112
+ follow_redirects=follow_redirects,
106
113
  )
107
114
  if token is not None:
108
115
  return await https_ls_remote(
@@ -111,10 +118,12 @@ async def call_https_ls_remote(
111
118
  branch=branch,
112
119
  provider=provider or "",
113
120
  is_pat=is_pat,
121
+ follow_redirects=follow_redirects,
114
122
  )
115
123
  if repo_url.startswith("http"):
116
124
  return await https_ls_remote(
117
125
  repo_url=repo_url,
118
126
  branch=branch,
127
+ follow_redirects=follow_redirects,
119
128
  )
120
129
  raise InvalidParameter()
@@ -24,6 +24,7 @@ async def ls_remote(
24
24
  is_pat: bool = False,
25
25
  arn: str | None = None,
26
26
  org_external_id: str | None = None,
27
+ follow_redirects: bool = True,
27
28
  ) -> str | None:
28
29
  last_commit: str | None = None
29
30
  if credential_key is not None:
@@ -36,6 +37,7 @@ async def ls_remote(
36
37
  arn,
37
38
  repo_branch,
38
39
  org_external_id=org_external_id,
40
+ follow_redirects=follow_redirects,
39
41
  )
40
42
  else:
41
43
  last_commit = await call_https_ls_remote(
@@ -46,6 +48,7 @@ async def ls_remote(
46
48
  branch=repo_branch,
47
49
  provider=provider,
48
50
  is_pat=is_pat,
51
+ follow_redirects=follow_redirects,
49
52
  )
50
53
 
51
54
  return last_commit
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "fluidattacks-core"
3
- version = "2.2.2"
3
+ version = "2.2.3"
4
4
  description = "Fluid Attacks Core Library"
5
5
  authors = ["Development <development@fluidattacks.com>"]
6
6
  license = "MPL-2.0"
@@ -17,7 +17,7 @@ classifiers = [
17
17
  [tool.poetry.dependencies]
18
18
  python = "^3.11"
19
19
  aiofiles = ">=23.2.1"
20
- aiohttp = ">=3.9.2"
20
+ aiohttp = ">=3.11.4"
21
21
  boto3 = ">=1.34"
22
22
  certifi = ">=2024.8.30"
23
23
  GitPython = ">=3.1.41"