Skip to content

fix: continue file tree searches after link cycles - #666

Open
CAOShurong wants to merge 1 commit into
anchore:mainfrom
CAOShurong:codex/206-continue-after-link-cycles
Open

fix: continue file tree searches after link cycles#666
CAOShurong wants to merge 1 commit into
anchore:mainfrom
CAOShurong:codex/206-continue-after-link-cycles

Conversation

@CAOShurong

Copy link
Copy Markdown

Summary

  • continue depth-first traversal after a path fails specifically with ErrLinkCycleDetected
  • skip the same malformed entries during indexed file-tree searches instead of aborting all results
  • warn with the affected path while preserving failures for every other error type
  • add regressions proving files after a two-link cycle remain traversable and MIME-searchable

Fixes #206.

Validation

  • go test ./pkg/filetree -count=1
  • go test ./pkg/filetree -run 'TestDFS_WalkAll_SkipsLinkCycles|Test_searchContext_SearchByMIMEType_SkipsLinkCycles' -count=20
  • go vet ./...
  • standalone API probe using /usr/bin/xz <-> /usr/bin/xzcat: traversal and MIME search both return the normal files before and after the cycle with no error

The broader go test ./... run was also attempted on Windows. The changed pkg/filetree package passed; unrelated platform/integration suites retain existing Windows assumptions and require a Docker daemon, so I have not represented that command as passing.

AI assistance

OpenAI Codex assisted with issue screening, implementation, and test drafting. I reviewed the resulting diff and ran the validations listed above. The commit includes an Assisted-by trailer and DCO sign-off.

Skip only ErrLinkCycleDetected entries so malformed symlinks are logged without hiding later files from traversal or MIME searches. Other resolution errors continue to fail the operation.

Assisted-by: OpenAI Codex <noreply@openai.com>
Signed-off-by: Shurong Cao <170531907+CAOShurong@users.noreply.github.com>
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.

Cycle during symlink resolution prevents syft/grype scans from enumerating vulnerabilities

1 participant