project isolation testing#10
Open
gsanseverino wants to merge 3 commits into
Open
Conversation
Two paired artifacts that document and exercise the four layers k8tre
relies on to keep one Project's resources out of reach of another
Project's users.
tests/test-project-isolation.sh
Idempotent end-to-end check. Creates two Projects (alpha, bravo)
+ Groups + Users (alice, bob), then asserts:
- Keycloak password-grant works and the JWT has aud=backend
- /auth/validate returns 200 for own project, 403 for the other,
symmetrically for both users (the real authz gate, layer 2)
- default ServiceAccount in project-alpha cannot list/create/
delete pods or secrets in project-bravo (layer 3, RBAC)
- a pod in project-alpha can't TCP to a pod in project-bravo
(layer 4, Cilium)
- User CRs exist with the right group memberships
On a healthy cluster: 14 PASS, 0 FAIL, 2 WEAK (documented).
docs/project-isolation.md
Walks through the four enforcement layers (UX /projects filtering,
/auth/validate gate, Kubernetes RBAC, Cilium NetworkPolicy), how
to run the script, what it does and does not cover, the two known
weak spots (logged-in users can still GET /projects/<other>/apps
and /launch/<other>/<app> — metadata leak, no data leak; one-line
fix in get_apps()/launch_app() noted), and the three Keycloak +
network-policy quirks the script's setup phase has to work around.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
943a392 to
0b4f187
Compare
0b4f187 to
1fc5952
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two paired artifacts that document and exercise the four layers k8tre relies on to keep one Project's resources out of reach of another Project's users.
tests/test-project-isolation.shIdempotent end-to-end check. Creates two Projects (
alpha,bravo) + Groups + Users (alice,bob), then asserts:aud=backend./auth/validatereturns 200 for the user's own project and 403 for the other, symmetrically for both users (the real authz gate — layer 2).project-alphacannotlist/create/deletepods or secrets inproject-bravo(layer 3, RBAC).project-alphacannot TCP-reach a pod inproject-bravo(layer 4, Cilium NetworkPolicy).UserCRs exist with the right group memberships.Output uses three states:
PASS/FAIL/WEAK. On a healthy cluster: 14 PASS, 0 FAIL, 2 WEAK (the twoWEAKresults are documented design gaps, not regressions).docs/project-isolation.mdWalks through the four enforcement layers (UX
/projectsfiltering, the/auth/validategate, Kubernetes RBAC, Cilium NetworkPolicy), explains how to run the script, what it asserts and what it does not cover (token replay across authorized projects, spawner SA RBAC, intra-namespace traffic, control plane), the two known weak spots (logged-in users can still GET/projects/<other>/appsand/launch/<other>/<app>— metadata leak, no data leak; one-line fix inget_apps()/launch_app()noted), and the three Keycloak/network-policy quirks the script's setup phase has to work around (kcadm.shdefaults to temporary passwords;firstName/lastNameare required for password-grant; pod-network blocks in-podkubectlaccess to the API server).Test plan
14 PASS, 0 FAIL, 2 WEAKon a steady-state cluster.🤖 Generated with Claude Code