Skip to content

fix: error when executing the version flag#332

Merged
cx-leonardo-fontes merged 13 commits intomasterfrom
fix-2ms-version-flag
Sep 24, 2025
Merged

fix: error when executing the version flag#332
cx-leonardo-fontes merged 13 commits intomasterfrom
fix-2ms-version-flag

Conversation

@cx-leonardo-fontes
Copy link
Copy Markdown
Contributor

No description provided.

@github-actions
Copy link
Copy Markdown

kics-logo

KICS version: v1.7.13

Category Results
HIGH HIGH 0
MEDIUM MEDIUM 0
LOW LOW 0
INFO INFO 0
TRACE TRACE 0
TOTAL TOTAL 0
Metric Values
Files scanned placeholder 13
Files parsed placeholder 13
Files failed to scan placeholder 0
Total executed queries placeholder 53
Queries failed to execute placeholder 0
Execution time placeholder 1

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Sep 23, 2025

Logo
Checkmarx One – Scan Summary & Detailsb99b2687-215e-4097-92ee-06886410b8a1

Great job! No new security vulnerabilities introduced in this pull request

@cx-leonardo-fontes cx-leonardo-fontes marked this pull request as ready for review September 24, 2025 09:13
@cx-leonardo-fontes cx-leonardo-fontes requested a review from a team as a code owner September 24, 2025 09:13
Comment thread cmd/main.go
if engineInstance == nil {
return 0, fmt.Errorf("engine was not initialized")
if engineInstance != nil {
return engineInstance.GetReport().GetTotalSecretsFound(), nil
Copy link
Copy Markdown
Contributor

@cx-rogerio-dalot cx-rogerio-dalot Sep 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line always confused me, are we using this? Because this is the exit code of a command which is supposed to have a particular meaning, but I never knew if we were using for anything.

https://www2.microstrategy.com/producthelp/current/CommandManager/WebHelp/Lang_1033/content/html/command_line_error_codes.htm

Copy link
Copy Markdown
Contributor Author

@cx-leonardo-fontes cx-leonardo-fontes Sep 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not saying I agree with the current system, but TL;DR: by default, errors add 1 to the exit code, and if 2ms finds at least one result, it adds 2. For example, if 2ms finds at least one secret and an error occurs, it exits with code 3; if no secrets are found and there are no errors, it exits 0; if results are found and there are no errors, it exits 2. We also have a flag to control this behavior "ignore-on-exit": https://github.com/Checkmarx/2ms?tab=readme-ov-file#global-flags

@cx-leonardo-fontes cx-leonardo-fontes merged commit c10b67d into master Sep 24, 2025
12 checks passed
@cx-leonardo-fontes cx-leonardo-fontes deleted the fix-2ms-version-flag branch September 24, 2025 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants