Skip to content

test(kyverno): pin host access policy behavior - #5135

Draft
devantler wants to merge 1 commit into
mainfrom
codex/host-coverage-5133
Draft

devantler wants to merge 1 commit into
mainfrom
codex/host-coverage-5133

Conversation

@devantler

Copy link
Copy Markdown
Contributor

🤖 Generated by the Agentic Engineer

Why

The host-access policy must keep the same protections when it moves to the policy engine's new format. Its current checks cover only one of its three rules, leaving the rewrite without a complete baseline.

What

Adds checks for allowed and denied host access, infrastructure exceptions and the policy's current scope. Deliberately weakened copies must fail the checks before a later rewrite can rely on them.

Fixes #5133

Part of #4996

@devantler

Copy link
Copy Markdown
Contributor Author

🤖 Generated by the Agentic Engineer

Behavioral baseline at f7eab5490a4c0aa82b3f5ede8cfc78ce32906589: the focused fixture and its evaluation gate passed with Kyverno 1.19.1. Its 25 assertions retain the user-namespace cases and add ordinary/explicit-false Pods, each forbidden host-access field, exact namespace exemptions, a namespace lookalike and a provisioner-style Pod name outside an exempt namespace.

Controller resources are deliberately excluded by the existing Pod rules. The CNPG label selector disables autogen for the entire current ClusterPolicy. An initial attempt to name nonexistent autogen rules exposed the CLI's misleading passing Excluded rows; the evaluation gate rejected them, and the corrected fixture passes that gate. This does not claim controller-template protection.

The two new weakening controls run in the existing CI regression family and must reject a permissive copy of each general rule. Their execution and the complete suite remain pending in CI attempt 1; the local focused checks preceded those script additions. No production policy or enforcement setting changed. This is the test-first increment for #5133; the format migration in #4996 remains open. Current-head review and complete green CI are still required before promotion.

@devantler

Copy link
Copy Markdown
Contributor Author

🤖 Generated by the Agentic Engineer

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor
⚠️ Action not completed

Review rate limited.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai

coderabbitai Bot commented Oct 20, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 39 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Repository YAML (base), Organization UI (inherited)
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 50a450ed-fe3e-4fc1-9486-63917fe75cd5
📥 Commits

Reviewing files that changed from the base of the PR and between f67064f and f7eab54.

📒 Files selected for processing: 3
  • scripts/tests/test-validate-kyverno-fixture-evaluation.sh
  • tests/validate-host-restrictions/kyverno-test.yaml
  • tests/validate-host-restrictions/resources.yaml
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@devantler

Copy link
Copy Markdown
Contributor Author

🤖 Generated by the Agentic Engineer

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-20T16:49:14.252573Z f7eab54 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. More of your lovely PRs please.

Reviewed commit: f7eab5490a

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

Hosted behavioral acceptance at f7eab5490a4c0aa82b3f5ede8cfc78ce32906589: CI attempt 1 completed successfully. I read all 23 jobs and the executed cluster-policy validation, rather than relying only on its aggregate check.

The host-access fixture's 25 assertions passed. Ordinary Pods and explicit false values were accepted; the expected host-path, host-network, host-PID and host-IPC denials, exact namespace exemptions and provisioner-name lookalike checks all matched. The existing user-namespace assertions also passed. The deliberate weakening of each general rule was rejected (weakened disallow-host-path and weakened disallow-host-namespaces), and the evaluation check confirmed that all 106 fixtures evaluate every rule they name.

I evaluated the observed CLI results as the policy maintainer: this now supplies a usable baseline for the later rewrite, including a check that would catch either general rule becoming permissive. Controller templates remain outside this policy's current scope; the selector disables autogen, and their exclusions do not establish controller protection. No production policy or failure action changed, and #4996 remains open.

This completes the previously pending hosted behavioral evidence. Review and readiness are assessed separately from this receipt. The separate required code-quality rule is still reported as unverified by the completeness helper; this comment does not clear it.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🫴 Ready

Development

Successfully merging this pull request may close these issues.

Pin host-access behavior before its policy format migration

1 participant