conviso-ast 3.0.0rc0__py3-none-any.whl → 3.0.1rc0__py3-none-any.whl

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.
@@ -1,22 +1,22 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: conviso-ast
3
- Version: 3.0.0rc0
3
+ Version: 3.0.1rc0
4
4
  Maintainer: Conviso
5
5
  Maintainer-email: development@convisoappsec.com
6
6
  Project-URL: Source, https://github.com/convisoappsec/convisocli/
7
7
  Requires-Python: >=3.9
8
8
  Description-Content-Type: text/markdown
9
- Requires-Dist: GitPython==3.1.45
9
+ Requires-Dist: GitPython==3.1.46
10
10
  Requires-Dist: click==8.1.8
11
11
  Requires-Dist: requests==2.32.5
12
- Requires-Dist: urllib3==2.4.0
12
+ Requires-Dist: urllib3==2.6.3
13
13
  Requires-Dist: semantic-version==2.10.0
14
14
  Requires-Dist: docker==7.1.0
15
15
  Requires-Dist: PyYAML==6.0.3
16
16
  Requires-Dist: click-log==0.4.0
17
17
  Requires-Dist: transitions==0.9.2
18
18
  Requires-Dist: jsonschema==4.25.1
19
- Requires-Dist: giturlparse<=0.12.0
19
+ Requires-Dist: giturlparse<=0.14.0
20
20
  Requires-Dist: jmespath==1.0.1
21
21
  Requires-Dist: setuptools==78.1.0
22
22
  Dynamic: description
@@ -1,9 +1,9 @@
1
- conviso_ast-3.0.0rc0.data/scripts/flow_bash_completer.sh,sha256=9q3HPuXq_FCUUV3IFGcOefsOLhPWatUkLY7txiBM7Uo,624
2
- conviso_ast-3.0.0rc0.data/scripts/flow_fish_completer.fish,sha256=-wiuarawDJkms5N-rh99brIOzhy-ktsM1mi1ohQ3Mtg,147
3
- conviso_ast-3.0.0rc0.data/scripts/flow_zsh_completer.sh,sha256=cAtTDGUs5sY4NAA7AjscmLWj0dbNZ9iZhLP6BTz6dEQ,844
1
+ conviso_ast-3.0.1rc0.data/scripts/flow_bash_completer.sh,sha256=9q3HPuXq_FCUUV3IFGcOefsOLhPWatUkLY7txiBM7Uo,624
2
+ conviso_ast-3.0.1rc0.data/scripts/flow_fish_completer.fish,sha256=-wiuarawDJkms5N-rh99brIOzhy-ktsM1mi1ohQ3Mtg,147
3
+ conviso_ast-3.0.1rc0.data/scripts/flow_zsh_completer.sh,sha256=cAtTDGUs5sY4NAA7AjscmLWj0dbNZ9iZhLP6BTz6dEQ,844
4
4
  convisoappsec/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
5
  convisoappsec/logger.py,sha256=aTNebqOau9nEadBySMTXtnbGkOkJ_q2kyFlX1mzizeg,1132
6
- convisoappsec/version.py,sha256=9gp4Vg_loI9Lz2KnSpDM8dOpi0NKtBfy6zh8unbdBNM,27
6
+ convisoappsec/version.py,sha256=XQZN3PFL4dzmOOXcRAOwL-jhvbqNPyD_qwGmptoO1VQ,27
7
7
  convisoappsec/common/__init__.py,sha256=QN7tV2C_jhTiWUrJHv2jbeq6ae3MssgLUWpQZwe8O2s,105
8
8
  convisoappsec/common/box.py,sha256=WTtPF3YWxkcdblPmFTzrzQlPPPUwVsDt2zoi6xFMy1U,7561
9
9
  convisoappsec/common/cleaner.py,sha256=Iy8BWCXj_v51oovcYzI_uhaJzLL-fCUyDxrbBglfwEs,2680
@@ -44,13 +44,8 @@ convisoappsec/flow/graphql_api/v1/models/project.py,sha256=CDZlufsT-_iQIOgpOPAtd
44
44
  convisoappsec/flow/graphql_api/v1/schemas/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
45
45
  convisoappsec/flow/graphql_api/v1/schemas/mutations/__init__.py,sha256=R9LgniQyj694h1MD7cn1-HJRDjI4PLiOrCmsqjp16ho,3251
46
46
  convisoappsec/flow/graphql_api/v1/schemas/resolvers/__init__.py,sha256=2jAgzA-8te6HyyV8RVAx0BnLDeZhFulZynbxm5JR8Sc,2713
47
- convisoappsec/flow/source_code_scanner/__init__.py,sha256=UvfLXNR1B8Fy6LuUwesQMXV0oMkLjVMhPs0SJ5nDR0k,227
48
- convisoappsec/flow/source_code_scanner/exceptions.py,sha256=6ehUyZaFfMIRMzKdh0MND8gfyTNyHY_wsprmxkxSJD0,57
49
- convisoappsec/flow/source_code_scanner/scc.py,sha256=O_kdWsw2x0czuKcLORD3gP5wbXsizj4Bb2Sbsk5n_Sw,1645
50
- convisoappsec/flow/source_code_scanner/source_code_scanner.py,sha256=L9LVZnUO-o_JvT8dHUxBXcbxQlxSqRP8CVUBgTUEV7s,4726
51
- convisoappsec/flow/util/__init__.py,sha256=rpu69qnn68rqrK3rhPcgrVYWCIW9WVSrQ5FyCeHxng4,160
47
+ convisoappsec/flow/util/__init__.py,sha256=32E3AbPrBf0stKOzCIvz7BeWtBjAScIt7FNyERjN-p4,99
52
48
  convisoappsec/flow/util/ci_provider.py,sha256=VYDESwNFbtrRcWDtTEb8tYDN5qbnLksmQI_ntsciJ4I,2093
53
- convisoappsec/flow/util/metrics.py,sha256=4qGBMMR02OZN4ezFiB9iqtCuUYO8bXYqeUNDFRDpQaw,480
54
49
  convisoappsec/flow/util/source_code_compressor.py,sha256=b2iA8Exf8wVbxR1mnvwTbruDjdpYyVloUmSlyYLSJQU,508
55
50
  convisoappsec/flow/version_searchers/__init__.py,sha256=rJkVGlmWiiDHegvQl7d900RvnglzICXpTxuUiLlHSz0,294
56
51
  convisoappsec/flow/version_searchers/sorted_by_versioning_style.py,sha256=xLjaHy-WDOgY5jrASnaK-uM0UL-9sL3BALwzmM5PgSA,2657
@@ -89,8 +84,8 @@ convisoappsec/flowcli/deploy/create/with_/tag_tracker/context.py,sha256=IZjsKSze
89
84
  convisoappsec/flowcli/deploy/create/with_/tag_tracker/entrypoint.py,sha256=MUrx_fqAFQeJ2oUaAxRDPfk_qlgyNHKFMNZqmiDFWrU,675
90
85
  convisoappsec/flowcli/deploy/create/with_/tag_tracker/sort_by/__init__.py,sha256=c1sggCq3RGdgyq0tqdxx_yGW1iOeBti2aoNsoiMxKnc,56
91
86
  convisoappsec/flowcli/deploy/create/with_/tag_tracker/sort_by/entrypoint.py,sha256=J5dSGo0P__fKlPpeaVcAmyFnnAtZPi0E2y4Hv_U-ZQM,382
92
- convisoappsec/flowcli/deploy/create/with_/tag_tracker/sort_by/time_.py,sha256=Ipkz0bVXfJlbYHfPFICY3VUZYwlL2gxuHUqVVtvSyzQ,2721
93
- convisoappsec/flowcli/deploy/create/with_/tag_tracker/sort_by/versioning_style.py,sha256=-FJF4BOLzzpcJqYHlYJovRuvoUut7gLoxDWKnT6CzH0,3416
87
+ convisoappsec/flowcli/deploy/create/with_/tag_tracker/sort_by/time_.py,sha256=Up4tgYC5UFoDCjLYUo-6dPkmhVlJqx_eg6zioNegjI8,2608
88
+ convisoappsec/flowcli/deploy/create/with_/tag_tracker/sort_by/versioning_style.py,sha256=-BRqdRK-LFNjA6XiOrfoMKDo-ACetdsQaGEPQBTRcDo,3303
94
89
  convisoappsec/flowcli/findings/__init__.py,sha256=0wiNMaThYuum1QA9s9-LGtcmWFxUY-mWiYMtTSuaDqY,58
95
90
  convisoappsec/flowcli/findings/entrypoint.py,sha256=foc6wgD2BsoFZkJQiIuis260Zt-3DkTLsxej7cHv9Ko,344
96
91
  convisoappsec/flowcli/findings/create/__init__.py,sha256=l7eIySVkTKr3auZ8Fwe7G6AG6-pM06vnl3aZcEclVP4,54
@@ -121,8 +116,8 @@ convisoappsec/flowcli/vulnerability/run.py,sha256=6flmvr55cKxj-duX3w4PAFwJgC5AJ0
121
116
  convisoappsec/sast/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
122
117
  convisoappsec/sast/decision.py,sha256=d7dcNr9yZMzyccpFS_peAmDo0ZtfsE1qXDdYrvCux2U,1025
123
118
  convisoappsec/sast/sastbox.py,sha256=hXZLiYh_F3f6yd1ydPYVOMKg-tNOQOZiBvKmWyedagI,11031
124
- conviso_ast-3.0.0rc0.dist-info/METADATA,sha256=HLpKpasKgYGBa4s6Ug1p8yNyPmu7oJsxHmM7oHG5ric,1078
125
- conviso_ast-3.0.0rc0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
126
- conviso_ast-3.0.0rc0.dist-info/entry_points.txt,sha256=0IvamweR_V0uG4O5Fo9NpVHTHfpZRwUE9kn7KEVZ668,109
127
- conviso_ast-3.0.0rc0.dist-info/top_level.txt,sha256=ju5r0RSCF1HA7m9JOG10jrQS4SnqQEJzl6-YMCxbSl4,14
128
- conviso_ast-3.0.0rc0.dist-info/RECORD,,
119
+ conviso_ast-3.0.1rc0.dist-info/METADATA,sha256=7EqX7hWY5OxoLwAA98_zNjNZY6aACLf4E1CRpCWeCiI,1078
120
+ conviso_ast-3.0.1rc0.dist-info/WHEEL,sha256=In9FTNxeP60KnTkGw7wk6mJPYd_dQSjEZmXdBdMCI-8,91
121
+ conviso_ast-3.0.1rc0.dist-info/entry_points.txt,sha256=0IvamweR_V0uG4O5Fo9NpVHTHfpZRwUE9kn7KEVZ668,109
122
+ conviso_ast-3.0.1rc0.dist-info/top_level.txt,sha256=ju5r0RSCF1HA7m9JOG10jrQS4SnqQEJzl6-YMCxbSl4,14
123
+ conviso_ast-3.0.1rc0.dist-info/RECORD,,
@@ -1,7 +1,5 @@
1
1
  from .source_code_compressor import SourceCodeCompressor
2
- from .metrics import project_metrics
3
2
 
4
3
  __all__ = [
5
- 'SourceCodeCompressor',
6
- 'project_metrics',
4
+ 'SourceCodeCompressor'
7
5
  ]
@@ -1,6 +1,5 @@
1
1
  import click
2
2
  # TODO: refactoring. all deploy create share some behavior
3
- from convisoappsec.flow.util import project_metrics
4
3
  from convisoappsec.flow.version_searchers import TimeBasedVersionSearcher
5
4
  from convisoappsec.flow.version_control_system_adapter import GitAdapter
6
5
  from convisoappsec.flowcli.context import pass_flow_context
@@ -72,7 +71,6 @@ def time_(flow_context, create_context, tag_tracker_context, attach_diff):
72
71
  previous_version=previous_version,
73
72
  diff_content=diff_content,
74
73
  metrics=deploy_metrics,
75
- project_metrics=project_metrics(repository_dir),
76
74
  commit_authors=authors_data
77
75
  )
78
76
 
@@ -1,6 +1,5 @@
1
1
  import click
2
2
  # TODO: refactoring. all deploy create share some behavior
3
- from convisoappsec.flow.util import project_metrics
4
3
  from convisoappsec.flowcli.context import pass_flow_context
5
4
  from convisoappsec.flow.version_searchers import SortedByVersioningStyle
6
5
  from convisoappsec.flow.version_control_system_adapter import GitAdapter
@@ -103,7 +102,6 @@ def versioning_style(
103
102
  previous_version=previous_version,
104
103
  diff_content=diff_content,
105
104
  metrics=deploy_metrics,
106
- project_metrics=project_metrics(repository_dir),
107
105
  commit_authors=authors_data
108
106
  )
109
107
 
convisoappsec/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = '3.0.0-rc.0'
1
+ __version__ = '3.0.1-rc.0'
@@ -1,9 +0,0 @@
1
- from .source_code_scanner import SourceCodeScanner # noqa
2
- from .exceptions import SourceCodeScannerException # noqa
3
- from .scc import SCC # noqa
4
-
5
- __all_ = [
6
- 'SourceCodeScanner',
7
- 'SourceCodeScannerException',
8
- 'SCC'
9
- ]
@@ -1,2 +0,0 @@
1
- class SourceCodeScannerException(RuntimeError):
2
- pass
@@ -1,68 +0,0 @@
1
- import yaml
2
- import tempfile
3
-
4
- from .source_code_scanner import SourceCodeScanner
5
- from .exceptions import SourceCodeScannerException
6
-
7
-
8
- class SCC(SourceCodeScanner):
9
-
10
- def __init__(
11
- self,
12
- source_code_dir,
13
- container_source_dir = '/code',
14
- create_source_code_volume = True
15
- ):
16
- super().__init__(
17
- source_code_dir,
18
- create_source_code_volume=create_source_code_volume
19
- )
20
- self.__scan_result = {}
21
- self.__container_source_dir = container_source_dir
22
-
23
- @property
24
- def repository(self):
25
- return 'convisoappsec/scc'
26
-
27
- @property
28
- def tag(self):
29
- return 'latest'
30
-
31
- @property
32
- def container_source_dir(self):
33
- return self.__container_source_dir
34
-
35
- def _read_scan_stdout(self, stdout_generator):
36
- with tempfile.TemporaryFile() as yaml_output:
37
- for chunk in stdout_generator:
38
- yaml_output.write(chunk)
39
-
40
- yaml_output.seek(0)
41
-
42
- self.__scan_result = yaml.load(
43
- yaml_output,
44
- Loader=yaml.FullLoader
45
- )
46
-
47
- @property
48
- def summary(self):
49
- summary = self.__scan_result.get('SUM')
50
- if not summary:
51
- raise SourceCodeScannerException(
52
- 'Unexpected error retrienving source code summary metrics'
53
- )
54
-
55
- return summary
56
-
57
- @property
58
- def total_source_code_lines(self):
59
- return self.summary.get('code')
60
-
61
- @property
62
- def command(self):
63
- return [
64
- '--no-cocomo',
65
- '--no-complexity',
66
- '--format',
67
- 'cloc-yaml'
68
- ]
@@ -1,177 +0,0 @@
1
- import docker
2
- from contextlib import suppress
3
- import tempfile
4
- from uuid import uuid4
5
-
6
- from convisoappsec.flow.util import SourceCodeCompressor
7
- from .exceptions import SourceCodeScannerException
8
-
9
-
10
- class SourceCodeScanner(object):
11
- SUCCESS_EXIT_CODE = 0
12
- '''
13
- hooks:
14
- def _pre_pull(self):
15
- :return: void
16
-
17
- def _capture_stdout(self, stdout_bytes)
18
- :param stdout_bytes: chunks generated by stdout
19
- :paramtype stdout_bytes: bytes
20
- :return: void
21
- _pre_scan
22
- _scan_stdout
23
- _post_scan
24
- '''
25
-
26
- def __init__(self, source_code_dir, create_source_code_volume = True):
27
- uuid = str(uuid4())
28
- self.docker = docker.from_env(version="auto")
29
- self.__container_name = "source_code_scanner_{0}".format(
30
- uuid
31
- )
32
- self.__source_code_dir = source_code_dir
33
- self.__create_source_code_volume = create_source_code_volume
34
-
35
- if self.__create_source_code_volume:
36
- self.__source_code_volume_name = "source_code_scanner_src_{0}".format(
37
- uuid
38
- )
39
- else:
40
- self.__source_code_volume_name = None
41
-
42
- @property
43
- def repository(self):
44
- raise Exception('Not implemented yet!')
45
-
46
- @property
47
- def tag(self):
48
- raise Exception('Not implemented yet!')
49
-
50
- @property
51
- def command(self):
52
- raise Exception('Not implemented yet!')
53
-
54
- @property
55
- def container_source_dir(self):
56
- raise Exception('Not implemented yet!')
57
-
58
- @property
59
- def image(self):
60
- return "{repository}:{tag}".format(
61
- repository=self.repository,
62
- tag=self.tag,
63
- )
64
-
65
- @property
66
- def volumes(self):
67
- if not self.__create_source_code_volume:
68
- return {}
69
-
70
- return {
71
- self.__source_code_volume_name: {
72
- 'bind': self.container_source_dir,
73
- 'mode': 'rw',
74
- }
75
- }
76
-
77
- def __get_container(self):
78
- return self.docker.containers.get(
79
- self.__container_name
80
- )
81
-
82
- def __get_source_code_volume(self):
83
- return self.docker.volumes.get(
84
- self.__source_code_volume_name
85
- )
86
-
87
- @property
88
- def __container(self):
89
- try:
90
- return self.__get_container()
91
- except docker.errors.NotFound:
92
- return self.__create_container()
93
-
94
- def __create_container(self):
95
- return self.docker.containers.create(
96
- self.image,
97
- name=self.__container_name,
98
- volumes=self.volumes,
99
- detach=True,
100
- command=self.command,
101
- working_dir=self.container_source_dir if self.container_source_dir != '/code' else '/code'
102
- )
103
-
104
- def __pull_image(self):
105
- if self.has_pre_pull:
106
- self._pre_pull()
107
-
108
- self.docker.images.pull(self.repository, self.tag)
109
-
110
- def __load_source_code(self):
111
- container = self.__container
112
-
113
- with tempfile.TemporaryFile() as fileobj:
114
- compressor = SourceCodeCompressor(
115
- self.__source_code_dir
116
- )
117
-
118
- compressor.write_to(fileobj)
119
- fileobj.seek(0)
120
-
121
- container.put_archive(
122
- self.container_source_dir,
123
- fileobj
124
- )
125
-
126
- def scan(self):
127
- self.__pull_image()
128
- self.__load_source_code()
129
- container = self.__container
130
-
131
- container.start()
132
-
133
- if self.has_read_scan_stderr:
134
- self._read_scan_stderr(
135
- container.logs(
136
- stream=True, stdout=False, stderr=True
137
- )
138
- )
139
-
140
- if self.has_read_scan_stdout:
141
- self._read_scan_stdout(
142
- container.logs(
143
- stream=True, stdout=True, stderr=False
144
- )
145
- )
146
-
147
- wait_result = container.wait()
148
- status_code = wait_result.get('StatusCode')
149
-
150
- if not status_code == self.SUCCESS_EXIT_CODE:
151
- raise SourceCodeScannerException(
152
- 'Source code scanning fail'
153
- )
154
-
155
- def __has_method(self, method_name):
156
- return hasattr(self, method_name)
157
-
158
- @property
159
- def has_read_scan_stdout(self):
160
- return self.__has_method('_read_scan_stdout')
161
-
162
- @property
163
- def has_read_scan_stderr(self):
164
- return self.__has_method('_read_scan_stderr')
165
-
166
- @property
167
- def has_pre_pull(self):
168
- return self.__has_method('_pre_pull')
169
-
170
- def __del__(self):
171
- with suppress(Exception):
172
- container = self.__get_container()
173
- container.remove()
174
-
175
- with suppress(Exception):
176
- source_code_volume = self.__get_source_code_volume()
177
- source_code_volume.remove()
@@ -1,16 +0,0 @@
1
- from convisoappsec.flow.source_code_scanner import SCC
2
- from convisoappsec.logger import LOGGER
3
- import docker
4
-
5
- def project_metrics(source_code_dir):
6
- try:
7
- scanner = SCC(source_code_dir, create_source_code_volume=False)
8
- scanner.scan()
9
- return {
10
- 'total_lines': scanner.total_source_code_lines
11
- }
12
- except docker.errors.APIError as e:
13
- LOGGER.error('Error on fetch project metrics')
14
- LOGGER.exception(e)
15
- return {}
16
-