Skip to content

Commit cfd2dd1

Browse files
committed
remove --report from cycode scan
1 parent a89cf47 commit cfd2dd1

File tree

5 files changed

+11
-55
lines changed

5 files changed

+11
-55
lines changed

README.md

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,9 @@ This guide walks you through both installation and usage.
2121
1. [Options](#options)
2222
1. [Severity Threshold](#severity-option)
2323
2. [Monitor](#monitor-option)
24-
3. [Report](#report-option)
25-
4. [Package Vulnerabilities](#package-vulnerabilities-option)
26-
5. [License Compliance](#license-compliance-option)
27-
6. [Lock Restore](#lock-restore-option)
24+
3. [Package Vulnerabilities](#package-vulnerabilities-option)
25+
4. [License Compliance](#license-compliance-option)
26+
5. [Lock Restore](#lock-restore-option)
2827
2. [Repository Scan](#repository-scan)
2928
1. [Branch Option](#branch-option)
3029
3. [Path Scan](#path-scan)
@@ -301,7 +300,6 @@ The Cycode CLI application offers several types of scans so that you can choose
301300
| `--severity-threshold [INFO\|LOW\|MEDIUM\|HIGH\|CRITICAL]` | Show only violations at the specified level or higher. |
302301
| `--sca-scan` | Specify the SCA scan you wish to execute (`package-vulnerabilities`/`license-compliance`). The default is both. |
303302
| `--monitor` | When specified, the scan results will be recorded in the knowledge graph. Please note that when working in `monitor` mode, the knowledge graph will not be updated as a result of SCM events (Push, Repo creation). (Supported for SCA scan type only). |
304-
| `--report` | When specified, a violations report will be generated. A URL link to the report will be printed as an output to the command execution. |
305303
| `--no-restore` | When specified, Cycode will not run restore command. Will scan direct dependencies ONLY! |
306304
| `--gradle-all-sub-projects` | When specified, Cycode will run gradle restore command for all sub projects. Should run from root project directory ONLY! |
307305
| `--help` | Show options for given command. |
@@ -339,28 +337,6 @@ When using this option, the scan results from this scan will appear in the knowl
339337
> [!WARNING]
340338
> You must be an `owner` or an `admin` in Cycode to view the knowledge graph page.
341339
342-
#### Report Option
343-
344-
> [!NOTE]
345-
> This option is not available to IaC scans.
346-
347-
To push scan results tied to the [SCA policies](https://docs.cycode.com/docs/sca-policies) found in the Repository scan to Cycode, add the argument `--report` to the scan command.
348-
349-
`cycode scan -t sca --report repository ~/home/git/codebase`
350-
351-
In the same way, you can push scan results of Secrets and SAST scans to Cycode by adding the `--report` option to the scan command.
352-
353-
When using this option, the scan results from this scan will appear in the On-Demand Scans section of Cycode. To get to this page, click the link that appears after the printed results:
354-
355-
> [!WARNING]
356-
> You must be an `owner` or an `admin` in Cycode to view this page.
357-
358-
![cli-report](https://raw.githubusercontent.com/cycodehq/cycode-cli/main/images/sca_report_url.png)
359-
360-
The report page will look something like below:
361-
362-
![](https://raw.githubusercontent.com/cycodehq/cycode-cli/main/images/scan_details.png)
363-
364340
#### Package Vulnerabilities Option
365341
366342
> [!NOTE]

cycode/cli/apps/scan/code_scanner.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -323,7 +323,7 @@ def scan_documents(
323323
scan_batch_thread_func, scan_type, documents_to_scan, progress_bar=progress_bar
324324
)
325325

326-
aggregation_report_url = _try_get_aggregation_report_url_if_needed(scan_parameters, ctx.obj['client'], scan_type)
326+
aggregation_report_url = _try_get_aggregation_report_url(scan_parameters, ctx.obj['client'], scan_type)
327327
_set_aggregation_report_url(ctx, aggregation_report_url)
328328

329329
progress_bar.set_section_length(ScanProgressBarSection.GENERATE_REPORT, 1)
@@ -641,7 +641,6 @@ def parse_pre_receive_input() -> str:
641641
def _get_default_scan_parameters(ctx: typer.Context) -> dict:
642642
return {
643643
'monitor': ctx.obj.get('monitor'),
644-
'report': ctx.obj.get('report'),
645644
'package_vulnerabilities': ctx.obj.get('package-vulnerabilities'),
646645
'license_compliance': ctx.obj.get('license-compliance'),
647646
'command_type': ctx.info_name.replace('-', '_'), # save backward compatibility
@@ -957,7 +956,7 @@ def _get_scan_result(
957956
did_detect=True,
958957
detections_per_file=_map_detections_per_file_and_commit_id(scan_type, scan_raw_detections),
959958
scan_id=scan_id,
960-
report_url=_try_get_aggregation_report_url_if_needed(scan_parameters, cycode_client, scan_type),
959+
report_url=_try_get_aggregation_report_url(scan_parameters, cycode_client, scan_type),
961960
)
962961

963962

@@ -973,12 +972,9 @@ def _set_aggregation_report_url(ctx: typer.Context, aggregation_report_url: Opti
973972
ctx.obj['aggregation_report_url'] = aggregation_report_url
974973

975974

976-
def _try_get_aggregation_report_url_if_needed(
975+
def _try_get_aggregation_report_url(
977976
scan_parameters: dict, cycode_client: 'ScanClient', scan_type: str
978977
) -> Optional[str]:
979-
if not scan_parameters.get('report', False):
980-
return None
981-
982978
aggregation_id = scan_parameters.get('aggregation_id')
983979
if aggregation_id is None:
984980
return None

cycode/cli/apps/scan/scan_command.py

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,6 @@ def scan_command(
4545
'--sync', help='Run scan synchronously (INTERNAL FOR IDEs).', show_default='asynchronously', hidden=True
4646
),
4747
] = False,
48-
report: Annotated[
49-
bool,
50-
typer.Option(
51-
'--report',
52-
help='When specified, generates a violations report. '
53-
'A link to the report will be displayed in the console output.',
54-
),
55-
] = False,
5648
show_secret: Annotated[
5749
bool, typer.Option('--show-secret', help='Show Secrets in plain text.', rich_help_panel=_SECRET_RICH_HELP_PANEL)
5850
] = False,
@@ -133,7 +125,6 @@ def scan_command(
133125
ctx.obj['sync'] = sync
134126
ctx.obj['severity_threshold'] = severity_threshold
135127
ctx.obj['monitor'] = monitor
136-
ctx.obj['report'] = report
137128

138129
if export_file:
139130
console_printer = ctx.obj['console_printer']

cycode/cyclient/scan_client.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import json
2-
from copy import deepcopy
32
from typing import TYPE_CHECKING, Union
43
from uuid import UUID
54

@@ -74,11 +73,6 @@ def zipped_file_scan_sync(
7473
is_git_diff: bool = False,
7574
) -> models.ScanResultsSyncFlow:
7675
files = {'file': ('multiple_files_scan.zip', zip_file.read())}
77-
78-
scan_parameters = deepcopy(scan_parameters) # avoid mutating the original dict
79-
if 'report' in scan_parameters:
80-
del scan_parameters['report'] # BE raises validation error instead of ignoring it
81-
8276
response = self.scan_cycode_client.post(
8377
url_path=self.get_zipped_file_scan_sync_url_path(scan_type),
8478
data={

tests/test_code_scanner.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
from cycode.cli import consts
88
from cycode.cli.apps.scan.code_scanner import (
9-
_try_get_aggregation_report_url_if_needed,
9+
_try_get_aggregation_report_url,
1010
)
1111
from cycode.cli.cli_types import ScanTypeOption
1212
from cycode.cli.files_collector.excluder import _is_relevant_file_to_scan
@@ -29,16 +29,15 @@ def test_try_get_aggregation_report_url_if_no_report_command_needed_return_none(
2929
) -> None:
3030
aggregation_id = uuid4().hex
3131
scan_parameter = {'aggregation_id': aggregation_id}
32-
result = _try_get_aggregation_report_url_if_needed(scan_parameter, scan_client, scan_type)
32+
result = _try_get_aggregation_report_url(scan_parameter, scan_client, scan_type)
3333
assert result is None
3434

3535

3636
@pytest.mark.parametrize('scan_type', list(ScanTypeOption))
3737
def test_try_get_aggregation_report_url_if_no_aggregation_id_needed_return_none(
3838
scan_type: ScanTypeOption, scan_client: ScanClient
3939
) -> None:
40-
scan_parameter = {'report': True}
41-
result = _try_get_aggregation_report_url_if_needed(scan_parameter, scan_client, scan_type)
40+
result = _try_get_aggregation_report_url({}, scan_client, scan_type)
4241
assert result is None
4342

4443

@@ -48,12 +47,12 @@ def test_try_get_aggregation_report_url_if_needed_return_result(
4847
scan_type: ScanTypeOption, scan_client: ScanClient, api_token_response: responses.Response
4948
) -> None:
5049
aggregation_id = uuid4()
51-
scan_parameter = {'report': True, 'aggregation_id': aggregation_id}
50+
scan_parameter = {'aggregation_id': aggregation_id}
5251
url = get_scan_aggregation_report_url(aggregation_id, scan_client, scan_type)
5352
responses.add(api_token_response) # mock token based client
5453
responses.add(get_scan_aggregation_report_url_response(url, aggregation_id))
5554

5655
scan_aggregation_report_url_response = scan_client.get_scan_aggregation_report_url(str(aggregation_id), scan_type)
5756

58-
result = _try_get_aggregation_report_url_if_needed(scan_parameter, scan_client, scan_type)
57+
result = _try_get_aggregation_report_url(scan_parameter, scan_client, scan_type)
5958
assert result == scan_aggregation_report_url_response.report_url

0 commit comments

Comments
 (0)