diff --git a/cycode/cli/commands/report/report_command.py b/cycode/cli/commands/report/report_command.py index 4722a6b2..7bfb73c6 100644 --- a/cycode/cli/commands/report/report_command.py +++ b/cycode/cli/commands/report/report_command.py @@ -1,7 +1,6 @@ import click from cycode.cli.commands.report.sbom.sbom_command import sbom_command -from cycode.cli.utils.get_api_client import get_report_cycode_client from cycode.cli.utils.progress_bar import SBOM_REPORT_PROGRESS_BAR_SECTIONS, get_progress_bar @@ -16,8 +15,5 @@ def report_command( context: click.Context, ) -> int: """Generate report.""" - - context.obj['client'] = get_report_cycode_client(hide_response_log=False) # TODO disable log context.obj['progress_bar'] = get_progress_bar(hidden=False, sections=SBOM_REPORT_PROGRESS_BAR_SECTIONS) - return 1 diff --git a/cycode/cli/commands/report/sbom/sbom_path_command.py b/cycode/cli/commands/report/sbom/sbom_path_command.py index 36b9c4d9..23062cab 100644 --- a/cycode/cli/commands/report/sbom/sbom_path_command.py +++ b/cycode/cli/commands/report/sbom/sbom_path_command.py @@ -8,6 +8,7 @@ from cycode.cli.files_collector.path_documents import get_relevant_document from cycode.cli.files_collector.sca.sca_code_scanner import perform_pre_scan_documents_actions from cycode.cli.files_collector.zip_documents import zip_documents +from cycode.cli.utils.get_api_client import get_report_cycode_client from cycode.cli.utils.progress_bar import SbomReportProgressBarSection @@ -15,7 +16,7 @@ @click.argument('path', nargs=1, type=click.Path(exists=True, resolve_path=True), required=True) @click.pass_context def sbom_path_command(context: click.Context, path: str) -> None: - client = context.obj['client'] + client = get_report_cycode_client() report_parameters = context.obj['report_parameters'] output_format = report_parameters.output_format output_file = context.obj['output_file'] diff --git a/cycode/cli/commands/report/sbom/sbom_repository_url_command.py b/cycode/cli/commands/report/sbom/sbom_repository_url_command.py index a3cb2570..4d5ee4a3 100644 --- a/cycode/cli/commands/report/sbom/sbom_repository_url_command.py +++ b/cycode/cli/commands/report/sbom/sbom_repository_url_command.py @@ -4,6 +4,7 @@ from cycode.cli.commands.report.sbom.common import create_sbom_report, send_report_feedback from cycode.cli.commands.report.sbom.handle_errors import handle_report_exception +from cycode.cli.utils.get_api_client import get_report_cycode_client from cycode.cli.utils.progress_bar import SbomReportProgressBarSection @@ -15,7 +16,7 @@ def sbom_repository_url_command(context: click.Context, uri: str) -> None: progress_bar.start() progress_bar.set_section_length(SbomReportProgressBarSection.PREPARE_LOCAL_FILES) - client = context.obj['client'] + client = get_report_cycode_client() report_parameters = context.obj['report_parameters'] output_file = context.obj['output_file'] output_format = report_parameters.output_format diff --git a/cycode/cyclient/client_creator.py b/cycode/cyclient/client_creator.py index da62bd5a..45911589 100644 --- a/cycode/cyclient/client_creator.py +++ b/cycode/cyclient/client_creator.py @@ -18,6 +18,6 @@ def create_scan_client(client_id: str, client_secret: str, hide_response_log: bo return ScanClient(client, scan_config, hide_response_log) -def create_report_client(client_id: str, client_secret: str, hide_response_log: bool) -> ReportClient: +def create_report_client(client_id: str, client_secret: str, _: bool) -> ReportClient: client = CycodeDevBasedClient(DEV_CYCODE_API_URL) if dev_mode else CycodeTokenBasedClient(client_id, client_secret) - return ReportClient(client, hide_response_log) + return ReportClient(client) diff --git a/cycode/cyclient/report_client.py b/cycode/cyclient/report_client.py index ade7d850..fa8e0c3f 100644 --- a/cycode/cyclient/report_client.py +++ b/cycode/cyclient/report_client.py @@ -37,9 +37,8 @@ class ReportClient: DOWNLOAD_REPORT_PATH: str = 'files/api/v1/file/sbom/{file_name}' # not in the report service - def __init__(self, client: CycodeClientBase, hide_response_log: bool = True) -> None: + def __init__(self, client: CycodeClientBase) -> None: self.client = client - self._hide_response_log = hide_response_log def request_sbom_report_execution( self, params: ReportParameters, zip_file: InMemoryZip = None, repository_url: Optional[str] = None @@ -55,7 +54,6 @@ def request_sbom_report_execution( request_args = { 'url_path': url_path, 'data': request_data, - 'hide_response_content_log': self._hide_response_log, } if zip_file: @@ -84,7 +82,9 @@ def get_report_execution(self, report_execution_id: int) -> models.ReportExecuti def get_file_content(self, file_name: str) -> str: response = self.client.get( - url_path=self.DOWNLOAD_REPORT_PATH.format(file_name=file_name), params={'include_hidden': True} + url_path=self.DOWNLOAD_REPORT_PATH.format(file_name=file_name), + params={'include_hidden': True}, + hide_response_content_log=True, ) return response.text