Skip to content

project isolation testing#10

Open
gsanseverino wants to merge 3 commits into
mainfrom
add-project-isolation-test
Open

project isolation testing#10
gsanseverino wants to merge 3 commits into
mainfrom
add-project-isolation-test

Conversation

@gsanseverino

Copy link
Copy Markdown
Collaborator

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.sh

Idempotent end-to-end check. Creates two Projects (alpha, bravo) + Groups + Users (alice, bob), then asserts:

  • Keycloak password-grant works and the JWT carries aud=backend.
  • /auth/validate returns 200 for the user's own project and 403 for the other, symmetrically for both users (the real authz gate — layer 2).
  • The default ServiceAccount in project-alpha cannot list/create/delete pods or secrets in project-bravo (layer 3, RBAC).
  • A pod in project-alpha cannot TCP-reach a pod in project-bravo (layer 4, Cilium NetworkPolicy).
  • User CRs exist with the right group memberships.

Output uses three states: PASS / FAIL / WEAK. On a healthy cluster: 14 PASS, 0 FAIL, 2 WEAK (the two WEAK results are documented design gaps, not regressions).

docs/project-isolation.md

Walks through the four enforcement layers (UX /projects filtering, the /auth/validate gate, 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>/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 (kcadm.sh defaults to temporary passwords; firstName/lastName are required for password-grant; pod-network blocks in-pod kubectl access to the API server).

Test plan

  • StackIT dev cluster: script runs idempotently, returns 14 PASS, 0 FAIL, 2 WEAK on a steady-state cluster.

🤖 Generated with Claude Code

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>
@gsanseverino gsanseverino changed the title Add project isolation testing — script + model doc project isolation testing — script + model doc Jun 9, 2026
@gsanseverino gsanseverino changed the title project isolation testing — script + model doc project isolation testing Jun 9, 2026
@gsanseverino gsanseverino force-pushed the add-project-isolation-test branch 2 times, most recently from 943a392 to 0b4f187 Compare June 11, 2026 10:58
@gsanseverino gsanseverino force-pushed the add-project-isolation-test branch from 0b4f187 to 1fc5952 Compare June 11, 2026 10:59
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