Skip to content

fix: Skip symbolic links in file discovery and upload - #711

Draft
danskmt wants to merge 1 commit into
mainfrom
fix/CLI-1792-skip-symlinks-in-discovery-and-upload
Draft

fix: Skip symbolic links in file discovery and upload#711
danskmt wants to merge 1 commit into
mainfrom
fix/CLI-1792-skip-symlinks-in-discovery-and-upload

Conversation

@danskmt

@danskmt danskmt commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Description

Prevents scanners from following symbolic links during file discovery and upload, closing a path where files outside the scan root could be read and uploaded.

  • GetAllFiles (file_filter.go) now skips symlink entries when FF_FILE_FILTER_SKIP_SYMLINKS is enabled, gated behind a new feature flag internal_snyk_file_filter_skip_symlinks_enabled.
  • createUploadFile (batch.go) switches from os.Stat to os.Lstat and rejects symlinks as SpecialFileError (defence in depth, unconditional).
  • The test "uploads a symlink to a regular file" is inverted to assert symlinks are skipped.

Checklist

  • Tests added and all succeed (make test)
  • Regenerated mocks, etc. (make generate)
  • Linted (make lint)
  • Test your changes work for the CLI
    1. Clone / pull the latest CLI main.
    2. Run go get github.com/snyk/go-application-framework@YOUR_LATEST_GAF_COMMIT in the cliv2 directory.
      • Tip: for local testing, you can uncomment the line near the bottom of the CLI's go.mod to point to your local GAF code.
    3. Run go mod tidy in the cliv2 directory.
    4. Run the CLI tests and do any required manual testing.
    5. Open a PR in the CLI repo now with the go.mod and go.sum changes.
    • Once this PR is merged, repeat these steps, but pointing to the latest GAF commit on main and update your CLI PR.

@snyk-io

snyk-io Bot commented Aug 25, 2026

Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@snyk-io

snyk-io Bot commented Aug 25, 2026

Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues
Secrets 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

@danskmt
danskmt force-pushed the fix/CLI-1792-skip-symlinks-in-discovery-and-upload branch from bf769e9 to df40372 Compare August 25, 2026 12:51
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.

1 participant