Skip to content

Conversation

@alexandru-manea-snyk
Copy link
Contributor

@alexandru-manea-snyk alexandru-manea-snyk commented Jan 8, 2026

What does this PR do?

This PR implements the --exclude flag for the secrets-extension CLI. This implementation is designed to be consistent with the existing behavior in snyk test by using basename global matching: docs.

Implementation Details:

  • Basename matching: Only file or directory names are accepted. The implementation strictly forbids paths (/ or \) to ensure the flag remains easy to use and consistent with existing --exclude implementations.
  • Automatic globbing: The logic automatically wraps provided names in **/ patterns (dist becomes **/dist and **/dist/**), ensuring the item is excluded regardless of its depth in the project tree.
  • Argument validation: Added validation to catch and report invalid path-based inputs early in the scan process.

Where should the reviewer start?

  • buildExclusionGlobs: Review the logic that transforms raw string inputs into global glob patterns.
  • Test_buildExclusionGlobs: Check the unit tests covering empty inputs, multiple entries, and the rejection of slashes.
  • README.md: Review the updated documentation and examples for user-facing instructions.

How should this be manually tested?

  1. Run go run cmd/develop/main.go secrets --exclude=mocks and verify that any file or folder named mocks is skipped throughout the entire project.
  2. Run go run cmd/develop/main.go secrets --exclude="testshim,snykclient" and verify all are ignored.
  3. Run go run cmd/develop/main.go secrets --exclude="internal/mocks". It should return a clear error stating that paths are not allowed, consistent with the basename-only requirement.

What are the relevant tickets?

mihai-snyk and others added 12 commits September 29, 2025 13:16
)

* feat: file filtering methods based on metadata and contents [PS-105]
* feat: concurrent listing of files [PS-105]
* feat: concurrent file filtering [PS-105]
* feat: respect ignore files and new glob file filter [PS-105]
* refactor: simplified file filtering using GAF/pkg/utils.FileFilter and exposed results via channels [PS-105]
* feat: allow filtering for multiple input paths + tests for filefilter pkg [PS-105]
* refactor: moved StreamAllowedFiles into file filter package and added tests  [PS-105]
* refactor: added custom glob patterns param, added timeout for file finding process [PS-105]
* chore: upgrade go version and add makefile

* chore: downgrade back to 1.24 to comply with CLI

* revert img upgrade

* chore: fix linter version and exclusions

* chore: add secret scanning

* chore: format

* chore: remove dev deps and unused make
Co-authored-by: Alina Matei <alina-daniela.matei@snyk.io>
* feat: call new file upload

* feat: file upload draft [PS-87]

* feat: file upload & refactored filtering [PS-87]

* feat: tests, mocks [PS-87]

* fix: timeout [PS-87]

* fix: linting [PS-87]

* feat: wait for test and retrieve findings

* fix: fix error messages

* fix: align StartTestParams type to new GAF

* chore: add tests

* chore: rebase and lint

* chore: draft output

* fix: better ctx handling

* fix: cleanup code

* fix: align tests

* fix: lint

* fix: tests and linting

---------

Co-authored-by: Alina Matei <alina-daniela.matei@snyk.io>
@alexandru-manea-snyk alexandru-manea-snyk requested a review from a team as a code owner January 8, 2026 08:47
@alexandru-manea-snyk alexandru-manea-snyk force-pushed the feat/PS-260/have-exclude-flag-capabilities branch from 59ecd40 to e60fb50 Compare January 8, 2026 08:51
Copy link
Contributor

Choose a reason for hiding this comment

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

Unrelated to this PR since this was merged before, but how did we end up with all the files in this directory named with "-" instead of "_"?

@andreeaneata andreeaneata requested a review from a team as a code owner January 15, 2026 14:29
@andreeaneata andreeaneata force-pushed the main branch 2 times, most recently from eded02b to fa52284 Compare January 15, 2026 14:53
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.

6 participants