Skip to content

fix(query): ignore anonymous compose volumes#8049

Open
omribz156 wants to merge 1 commit into
Checkmarx:masterfrom
omribz156:codex/kics-anonymous-volume-host-directory
Open

fix(query): ignore anonymous compose volumes#8049
omribz156 wants to merge 1 commit into
Checkmarx:masterfrom
omribz156:codex/kics-anonymous-volume-host-directory

Conversation

@omribz156
Copy link
Copy Markdown

Closes #8047

Reason for Proposed Changes

  • Docker Compose short syntax with a single path, such as /usr/src/app/node_modules, creates an anonymous volume rather than binding a host directory.
  • The query split every string volume on : and treated the first segment as a host path even when no : was present, which caused false positives for anonymous volumes.

Proposed Changes

  • Only evaluate short-syntax string volumes as host binds when the split volume has a host/container separator.
  • Keep positive coverage for sensitive host binds by making the existing positive sample explicit.
  • Add the reported anonymous-volume shape as a negative regression sample.

Verification:

  • go test ./test -run "TestQueries/dockerCompose/volume_has_sensitive_host_directory" -count=1
  • git diff --check

This was implemented with Codex assistance, with the patch kept focused and manually reviewed.

I submit this contribution under the Apache-2.0 license.

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.

bug(docker compose): docker compose file with anonymous volume false positively reported as Volume Has Sensitive Host Directory

1 participant