Skip to content

Add --skip-default-filter flag to scan create command(AST-154378) - #1532

Open
cx-atish-jadhav wants to merge 3 commits into
mainfrom
bug/AST-154378-skipDefaultFilter
Open

Add --skip-default-filter flag to scan create command(AST-154378)#1532
cx-atish-jadhav wants to merge 3 commits into
mainfrom
bug/AST-154378-skipDefaultFilter

Conversation

@cx-atish-jadhav

Copy link
Copy Markdown
Contributor

Introduce a new --skip-default-filter flag to bypass the CLI's base include/exclude file filters. Changes:

  • Add flag constant and usage (internal/params/flags.go).
  • Wire the flag into scan create command and log when set (internal/commands/scan.go).
  • Extend compressFolder and related helpers to accept skipDefaultFilter and honor it when building include/exclude filters; callers updated accordingly. Also adjust unzip condition to preserve container-local-resolution behavior when skipping defaults.
  • Add unit tests covering filter behavior and zip compression permutations (internal/commands/scan_test.go).
  • Add integration tests to verify the flag path and log output (test/integration/scan_test.go).

This preserves existing behavior by default and enables users to include files normally excluded by base filters (e.g., node_modules, binaries) when explicitly requested.

By submitting this pull request, you agree to the terms within the Checkmarx Code of Conduct. Please review the contributing guidelines for guidance on creating high-quality pull requests.

Description

Introduce --skip-default-filter flag for cx scan create command to skip applying default base-included and base-excluded file filters. When this flag is NOT passed, the command behaves exactly as today (backward compatible). When passed, only user-provided filters apply — no base filters are appended.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Related Issues

Link any related issues or tickets.

Checklist

  • I have performed a self-review of my code
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • Any dependent changes have been merged and published in downstream modules
  • I have updated the CLI help for new/changed functionality in this PR (if applicable)
  • All active GitHub checks for tests, formatting, and security are passing
  • The correct base branch is being used

Screenshots (if applicable)

Add screenshots to help explain your changes.

Additional Notes

Add any other relevant information.

Introduce a new --skip-default-filter flag to bypass the CLI's base include/exclude file filters. Changes:

- Add flag constant and usage (internal/params/flags.go).
- Wire the flag into scan create command and log when set (internal/commands/scan.go).
- Extend compressFolder and related helpers to accept skipDefaultFilter and honor it when building include/exclude filters; callers updated accordingly. Also adjust unzip condition to preserve container-local-resolution behavior when skipping defaults.
- Add unit tests covering filter behavior and zip compression permutations (internal/commands/scan_test.go).
- Add integration tests to verify the flag path and log output (test/integration/scan_test.go).

This preserves existing behavior by default and enables users to include files normally excluded by base filters (e.g., node_modules, binaries) when explicitly requested.
Introduce executeCommandWithTimeout in test/integration/util_command.go and update TestRunScaRealtimeScan in test/integration/scan_test.go to use it with a 15-minute timeout. This avoids flaky failures/timeouts during SCA resolver downloads by allowing longer execution time while preserving the existing error+output buffer behavior.
@cx-atish-jadhav cx-atish-jadhav changed the title Add --skip-default-filter flag to scan create command Add --skip-default-filter flag to scan create command(AST-154378) Jul 31, 2026
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