feat(compliance): add compose policy checks - #332
Conversation
Preview EnvironmentA preview environment can be spun up on demand for this PR.
|
91e6c16 to
9351ebd
Compare
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9351ebdf8f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| has_healthcheck(service) if { | ||
| healthcheck := object.get(service, "healthcheck", {}) | ||
| test := object.get(healthcheck, "test", []) | ||
| count(test) > 0 |
There was a problem hiding this comment.
Reject disabled Compose healthchecks
When a service sets healthcheck.test to ["NONE"] (Docker Compose's documented way to disable a healthcheck), count(test) > 0 evaluates true, so the deny rule treats that service as compliant even though Compose will not run any readiness check. This leaves a false negative in the new compliance gate for the missing-healthcheck condition; reject NONE and require CMD/CMD-SHELL with an actual command.
Useful? React with 👍 / 👎.
Summary
Adds the first compliance-as-code checks for
docker-compose.yml. This PR introduces Conftest policies for service resource limits and healthchecks, Rego unit tests and fixtures, and a GitHub Actions workflow that verifies the policy and reports the current Compose findings without blocking CI.Type of Change
Affected Components
Motivation
Converts the completed baseline audit findings into repeatable checks for missing Compose resource limits and healthchecks. The initial implementation detects the known findings on
db,redis, andworkerwhile keeping the workflow report-only until an enforcement approach is agreed.Testing Done
conftest verify --policy policy/compose— 5 Rego unit tests passed.conftest test --policy policy/compose policy/fixtures/compose/compliant.yml— compliant fixture passed.conftest test --no-fail --policy policy/compose docker-compose.yml— reported the expected findings fordb,redis, andworkerwithout blocking the command.Compliance Policy Checksworkflow passed, including policy verification, compliant-fixture validation, and current Compose reporting.Security Considerations
The policies make missing resource limits and healthchecks visible during review. The workflow reports the current baseline findings without blocking CI, so it introduces no immediate deployment or availability impact. No secrets, credentials, or tokens are added.
Breaking Changes
Rollback Plan
Checklist