Skip to content

feat(compliance): add compose policy checks - #332

Draft
Ericliu-uz wants to merge 4 commits into
mainfrom
feature/compliance-compose-policy-pilot
Draft

feat(compliance): add compose policy checks#332
Ericliu-uz wants to merge 4 commits into
mainfrom
feature/compliance-compose-policy-pilot

Conversation

@Ericliu-uz

@Ericliu-uz Ericliu-uz commented Aug 19, 2026

Copy link
Copy Markdown

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

  • Bug fix
  • New feature
  • Breaking change
  • Refactor / code cleanup
  • Documentation
  • CI/CD / infrastructure
  • Security

Affected Components

  • /backend-api
  • /frontend
  • /engine (collectors / policies)
  • /security
  • /infrastructure
  • /.github/workflows
  • /policy (repository compliance policies)
  • /docs

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, and worker while keeping the workflow report-only until an enforcement approach is agreed.

Testing Done

  • Unit tests pass locally
  • Tested manually — describe how:
    • Ran conftest verify --policy policy/compose — 5 Rego unit tests passed.
    • Ran conftest test --policy policy/compose policy/fixtures/compose/compliant.yml — compliant fixture passed.
    • Ran conftest test --no-fail --policy policy/compose docker-compose.yml — reported the expected findings for db, redis, and worker without blocking the command.
    • GitHub Actions Compliance Policy Checks workflow passed, including policy verification, compliant-fixture validation, and current Compose reporting.
  • No tests required — explain why:

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

  • No breaking changes
  • Yes — describe below:

Rollback Plan

  • Revert commit is sufficient
  • Requires additional steps — describe below:

Checklist

  • Code follows project conventions
  • No secrets, credentials, or tokens committed
  • Relevant documentation updated (if applicable)
  • CI/CD workflows pass on this branch
  • PR is focused on one thing

@github-actions

Copy link
Copy Markdown
Contributor

Preview Environment

A preview environment can be spun up on demand for this PR.

Action Label Includes
Spin up preview deploy-preview Frontend, backend, database, Redis, OPA, worker
Spin up preview with M365 deploy-preview-m365 Everything above + PowerShell service for Exchange/Teams scan testing
Tear down preview teardown-preview Stops the environment early

The environment will also be torn down automatically when the PR is closed or merged.
Preview URLs will appear in a follow-up comment once the deploy completes (~5–8 min).
M365 scans require real tenant credentials added through the frontend UI.

@Ericliu-uz
Ericliu-uz force-pushed the feature/compliance-compose-policy-pilot branch from 91e6c16 to 9351ebd Compare August 19, 2026 12:14
@khan-deakin

Copy link
Copy Markdown
Collaborator

@codex review

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

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.

2 participants