Skip to content

fix(docker-compose): support files without version - #4037

Open
fyrsta7 wants to merge 1 commit into
semgrep:developfrom
fyrsta7:codex/docker-compose-versionless
Open

fix(docker-compose): support files without version#4037
fyrsta7 wants to merge 1 commit into
semgrep:developfrom
fyrsta7:codex/docker-compose-versionless

Conversation

@fyrsta7

@fyrsta7 fyrsta7 commented Aug 8, 2026

Copy link
Copy Markdown

Link to an issue

Fixes #4035.

Summary

Modern Docker Compose files can omit the obsolete top-level version field, but six Docker Compose security rules currently require it before they can match. This causes false negatives for valid versionless Compose files.

This change:

  • removes the version requirement from all six affected Docker Compose security rules;
  • keeps findings scoped to services;
  • excludes GitHub Actions service containers under jobs.<job>.services;
  • adds regression coverage for versionless Compose files and GitHub Actions workflows.

The GitHub Actions exclusion preserves the false-positive protection introduced in #1241 while allowing current Compose syntax.

Two touched rules also update their discouraged CWE-284 metadata to CWE-250: Execution with Unnecessary Privileges, which matches related container-confinement rules and satisfies the current changed-file lint.

Testing

  • semgrep validate yaml/docker-compose/security
  • semgrep test yaml/docker-compose/security (6/6 passed)
  • repository Semgrep rule and changed-file strict lints (23 rules, 0 findings)
  • registry metadata schema validation
  • pre-commit hooks for all changed files
  • historical Semgrep Docker validation and tests with returntocorp/semgrep:1.163.0
  • git diff --check

@CLAassistant

CLAassistant commented Aug 10, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

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.

p/docker-compose rules fail when obsolete version attribute is omitted

2 participants