Skip to content

test(deploy): check package pods against the cluster's pod-security rule - #630

Merged
devantler merged 2 commits into
mainfrom
claude/migration-container-nonroot
Nov 16, 2026
Merged

devantler merged 2 commits into
mainfrom
claude/migration-container-nonroot

Conversation

@devantler

@devantler devantler commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Why

#629 fixed the v3.9.0 admission refusal: Kyverno validate-pod-security requires runAsNonRoot on each container, and the migration Job and the retention CronJob set it only at pod level. The package tests didn't know that rule, so the gap passed CI.

What

Tests only, after merging main (#629's fix):

  • a test that applies the policy's container and seccomp rules to every pod in the rendered package (allowPrivilegeEscalation: false, not privileged, runAsNonRoot: true, drop: [ALL], pod seccomp RuntimeDefault or Localhost);
  • refusal cases for a migration or retention container without its own runAsNonRoot.

node --test scripts/tenant-package.test.mjs passes locally.

Part of #302.

🤖 Generated with Claude Code

The platform's Kyverno validate-pod-security policy refused v3.9.0's
migration Job at dry-run: it requires runAsNonRoot on every container,
and the Job and the retention CronJob set it only at pod level. Nothing
from v3.9.0 was applied; production still serves v3.8.0.

Both containers now set runAsNonRoot themselves. The package checker
requires it, and a new test applies the policy's container and seccomp
rules to every pod in the package.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@devantler
devantler requested a review from a team as a code owner November 16, 2026 02:12
@devantler

Copy link
Copy Markdown
Contributor Author

🤖 Generated by the Agentic Engineer

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-16T03:46:41.603395Z f0bdb34 Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Breezy!

Reviewed commit: 29f294f826

ℹ️ 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".

@devantler

Copy link
Copy Markdown
Contributor Author

🤖 Generated by the Agentic Engineer

Checked at 29f294f against platform main's validate-pod-security CEL. This is not a bot review; it doesn't replace the review gate.

No findings. Both migrate (Job) and purge (CronJob) now set container-level runAsNonRoot: true, the policy's per-container condition that refused v3.9.0. With allowPrivilegeEscalation: false, capabilities.drop: [ALL], no privileged and the pod-level seccompProfile: RuntimeDefault, both pass every rule.

The new test mirrors the container and seccomp rules for every package Job and CronJob pod, including init containers, and the two mutation controls prove the guard bites. Two small, non-blocking gaps compared with the policy: it doesn't check ephemeralContainers, and it doesn't check a container-level seccompProfile (allowed when unset, and only RuntimeDefault or Localhost when set). Neither applies to these manifests today.

@github-actions

Copy link
Copy Markdown

✅MegaLinter analysis: Success

Descriptor Linter Files Fixed Errors Max errors Warnings Elapsed time
✅ COPYPASTE jscpd yes no no 1.62s
✅ CSS stylelint 1 0 0 0 4.2s
✅ GO golangci-lint yes yes no no 136.82s
✅ GO revive 185 0 0 1.28s
✅ HTML djlint 5 0 0 1.82s
✅ HTML htmlhint 5 0 0 0.77s
✅ JSON jsonlint 2 0 0 0.15s
✅ JSON prettier 2 0 0 0 0.59s
✅ JSON v8r 2 0 0 1.69s
✅ MARKDOWN markdownlint 17 0 0 0 2.03s
✅ MARKDOWN markdown-table-formatter 17 0 0 0 0.34s
✅ REPOSITORY betterleaks yes no no 0.95s
✅ REPOSITORY checkov yes no no 18.8s
✅ REPOSITORY git_diff yes no no 0.18s
✅ REPOSITORY grype yes no no 196.96s
✅ REPOSITORY osv-scanner yes no no 172.61s
✅ REPOSITORY secretlint yes no no 1.31s
✅ REPOSITORY syft yes no no 2.36s
✅ REPOSITORY trivy yes no no 20.52s
✅ REPOSITORY trivy-sbom yes no no 0.28s
✅ REPOSITORY trufflehog yes no no 2.46s
✅ SPELL cspell 212 0 0 7.78s
✅ SPELL lychee 24 0 0 152.38s

See detailed reports in MegaLinter artifacts

Your project could benefit from a custom flavor, which would allow you to run only the linters you need, and thus improve runtime performances. (Skip this info by defining FLAVOR_SUGGESTIONS: false)

  • Documentation: Custom Flavors
  • Command: npx mega-linter-runner@10.2.0 --custom-flavor-setup --custom-flavor-linters COPYPASTE_JSCPD,CSS_STYLELINT,GO_GOLANGCI_LINT,GO_REVIVE,HTML_DJLINT,HTML_HTMLHINT,JSON_JSONLINT,JSON_V8R,JSON_PRETTIER,MARKDOWN_MARKDOWNLINT,MARKDOWN_MARKDOWN_TABLE_FORMATTER,REPOSITORY_CHECKOV,REPOSITORY_GIT_DIFF,REPOSITORY_BETTERLEAKS,REPOSITORY_GRYPE,REPOSITORY_OSV_SCANNER,REPOSITORY_SECRETLINT,REPOSITORY_SYFT,REPOSITORY_TRIVY,REPOSITORY_TRIVY_SBOM,REPOSITORY_TRUFFLEHOG,SPELL_CSPELL,SPELL_LYCHEE

MegaLinter is provided by OX Security
Show us your support by starring ⭐ the repository

…ainer-nonroot

# Conflicts:
#	scripts/check-tenant-package.mjs
@devantler devantler changed the title fix(deploy): make each migration container refuse root itself test(deploy): check package pods against the cluster's pod-security rule Nov 16, 2026
@devantler

Copy link
Copy Markdown
Contributor Author

🤖 Generated by the Agentic Engineer

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Another round soon, please!

Reviewed commit: f0bdb34fe8

ℹ️ 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".

@devantler
devantler merged commit 4e4469a into main Nov 16, 2026
40 of 53 checks passed
@devantler
devantler deleted the claude/migration-container-nonroot branch November 16, 2026 03:47
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.

1 participant