feat(cozystack-basics): pin TenantProjection writes to helm-controller - #3410
feat(cozystack-basics): pin TenantProjection writes to helm-controller#3410Aleksei Sviridkin (lexfrei) wants to merge 2 commits into
Conversation
Add a ValidatingAdmissionPolicy that restricts create, update and delete of internal.cozystack.io TenantProjection objects to the shared flux helm-controller ServiceAccount, as defence in depth behind the RBAC boundary that already denies tenants any verb on the group. A chart renders the sentinel through Flux, so no other writer has a legitimate reason to touch it. A bats check pins the policy to the flux namespace the platform installs helm-controller into. Assisted-By: Claude <noreply@anthropic.com> Signed-off-by: Aleksei Sviridkin <f@lex.la>
Add a chainsaw suite that exercises the CA-extraction feature end to end, and wire it into the e2e and install selection scripts so a change to the writer policy or the extraction controller runs it. The suite depends on the TenantProjection CRD, so it is meaningful only once that resource is installed. Assisted-By: Claude <noreply@anthropic.com> Signed-off-by: Aleksei Sviridkin <f@lex.la>
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (10)
📝 WalkthroughWalkthroughChangesTenant projection writer control
Estimated code review effort: 4 (Complex) | ~45 minutes Possibly related PRs
Suggested labels: Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
Timofei Larkin (lllamnyp)
left a comment
There was a problem hiding this comment.
I do not think this is needed. Multiple resources in Cozystack are exclusively platform managed, such as corev1 resources, but we don't enumerate their controllers in VAPs. I think the cost of the cluster admin's astonishment when he can't create a resource for whatever reason (maybe he's debugging something) is greater than the extra security benefit from this additional check.
|
The primary boundary is RBAC and it already shipped in #3407: no tenant role has any verb on Your corev1 analogy holds though, and the astonishment cost is real. With CREATE and UPDATE pinned to flux, an admin debugging cannot hand-apply a sentinel. DELETE is ungated so a stuck one can still be removed, just not created. The marginal-security-versus-astonishment call is yours. If you are not convinced, I will drop this PR. The controller's e2e is covered by the postgres chainsaw in #3407, so dropping the policy is a clean removal, not a loss of coverage. |
|
Closing, you convinced me. RBAC is the boundary and it already shipped in #3407: no tenant role has any verb on |
…3463) ## What this PR does Two documentation defects that both landed with the CA trust-anchor work in #3407. The Postgres README told a tenant to fetch `<release>.tenant-ca`. The release name carries the `postgres-` prefix the application definition applies, so the object is `postgres-<name>.tenant-ca`, and the postgres chainsaw test shows exactly that for a resource named `test`. A tenant following the README got `NotFound`. I confirmed the real name on a live cluster while converting another engine onto the same contract. The second is a comment in the controller and one in its RBAC chart, both promising a companion `ValidatingAdmissionPolicy` that pins sentinel writes to helm-controller. No such policy ships. It was proposed in #3410 and rejected: authorizing by `request.userInfo.username` duplicates RBAC in a more brittle form, and the RBAC boundary already holds because no tenant role has any verb on `internal.cozystack.io`. The comments now say that instead of pointing at a guard that does not exist. ### Downstream repositories Documentation only, no API or chart behaviour changes. `cozystack/website` regenerates the Postgres reference page from this README on the next stable tag, so no manual follow-up is needed there. - [x] No downstream repository is affected by this change - [ ] [cozystack/website](https://github.com/cozystack/website) - follow-up: ### Release note ```release-note docs(postgres): the tenant CA trust anchor is `postgres-<name>.tenant-ca`, not `<release>.tenant-ca`. ``` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Documentation** * Updated PostgreSQL TLS setup instructions with the correct tenant CA Secret name and retrieval command. * Clarified that tenant-accessible Secrets contain only the CA certificate, while the original Secret contains the private key. * Clarified CA sentinel access controls, including tenant isolation and helm-controller-managed behavior. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
What this PR does
Adds a
ValidatingAdmissionPolicypinning the writer of aTenantProjectionto helm-controller's ServiceAccount, as defence in depth. The primary boundary is RBAC: no tenant role grants any verb oninternal.cozystack.io, so this guards against platform-tier or widened-role writers, not tenants. Ships the cacert chainsaw suite that drives the deny and allow paths against a live apiserver.Depends on #3407: the
TenantProjectionCRD it references ships there, and the chainsaw suite needs it at e2e runtime. Merge after #3407.Split out from #3299.
Summary by CodeRabbit
New Features
cacerttest suite.Bug Fixes
Tests