Skip to content

mgrossman/aircore 771 entity rbac returns 403 for authenticated users on nmpdev#535

Closed
matthewgrossman wants to merge 7 commits into
mainfrom
mgrossman/aircore-771-entity-rbac-returns-403-for-authenticated-users-on-nmpdev
Closed

mgrossman/aircore 771 entity rbac returns 403 for authenticated users on nmpdev#535
matthewgrossman wants to merge 7 commits into
mainfrom
mgrossman/aircore-771-entity-rbac-returns-403-for-authenticated-users-on-nmpdev

Conversation

@matthewgrossman

@matthewgrossman matthewgrossman commented Jul 1, 2026

Copy link
Copy Markdown
Contributor
  • fix(auth): Remove has_role: false to stop 403s in tot
  • add CI test

Summary by CodeRabbit

  • Bug Fixes
    • Updated authorization so entities.read is granted to Viewer (and Admin/Editor), while entities create/update/delete require Editor/Admin.
    • Adjusted workspace-scoped nested entity reads to allow authenticated user access (403 → 200).
  • Documentation
    • Updated the “Entities API” permissions reference by splitting entities.read from entities.(create|update|delete).
  • Tests
    • Updated authorization tests to validate distinct read vs write expectations, and isolated auth E2E runs to a dedicated job.

…3-for-authenticated-users-on-nmpdev

Signed-off-by: Matthew Grossman <[email protected]>
Signed-off-by: Matthew Grossman <[email protected]>
@matthewgrossman
matthewgrossman requested review from a team as code owners July 1, 2026 16:36
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 0f35b820-6be2-44ee-b407-281ce6932c52

📥 Commits

Reviewing files that changed from the base of the PR and between 892e989 and 18595df.

📒 Files selected for processing (1)
  • docs/auth/authorization/permissions-reference.mdx
🚧 Files skipped from review as they are similar to previous changes (1)
  • docs/auth/authorization/permissions-reference.mdx

📝 Walkthrough

Walkthrough

Separates entity read and write authorization, updates the related tests and permissions reference, and adds a dedicated auth-enabled Kind E2E job.

Changes

Entities permission split

Layer / File(s) Summary
Authz config and roles
services/core/auth/src/nmp/core/auth/assets/static-authz.yaml
Removes has_role: false from entity delete/read/update permissions and adds entities.read to Viewer plus entities.create, entities.delete, entities.update to Editor.
Docs and authorization tests
docs/auth/authorization/permissions-reference.mdx, services/core/auth/tests/test_embedded_pdp.py, services/core/auth/tests/integration/test_authorization_middleware.py
Splits the entities permissions table and updates auth tests so viewers can read entity endpoints, editors can write them, and authenticated users can read nested entity endpoints.

Auth e2e CI job

Layer / File(s) Summary
Kind auth values and test marker
e2e/k8s/values/kind-auth.yaml, e2e/test_jobs_auth.py
Adds auth-enabled Kind values for CPU-only e2e runs and removes the subprocess-only marker from the auth e2e test module.
CI workflow job
.github/workflows/ci.yaml
Adds kind-cpu-auth-e2e for the auth suite and excludes e2e/test_jobs_auth.py from the non-auth Kind e2e job.

Sequence Diagram(s)

sequenceDiagram
  participant GitHubActions
  participant KindCluster
  participant PytestAuthSuite
  GitHubActions->>KindCluster: create auth-enabled cluster from kind-auth.yaml
  GitHubActions->>PytestAuthSuite: run e2e/test_jobs_auth.py with NMP_BASE_URL
  PytestAuthSuite->>KindCluster: exercise auth e2e endpoints
  GitHubActions->>KindCluster: collect kubernetes logs and artifacts
  GitHubActions->>KindCluster: delete cluster
Loading

Suggested labels: fix, ci

Suggested reviewers: mckornfield, svvarom

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title matches the main fix: authenticated users on nmpdev/TOT were getting 403s and this PR addresses that.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch mgrossman/aircore-771-entity-rbac-returns-403-for-authenticated-users-on-nmpdev

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
e2e/k8s/values/kind-auth.yaml (1)

1-4: 🗄️ Data Integrity & Integration | 🔵 Trivial | 💤 Low value

Update the header to avoid implying layered values. install_helm_e2e.sh always passes a single -f, so kind-auth.yaml is a standalone auth-enabled values file, not an overlay on kind.yaml.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@e2e/k8s/values/kind-auth.yaml` around lines 1 - 4, The header comment in
kind-auth.yaml implies it extends kind.yaml, but install_helm_e2e.sh only uses a
single values file. Update the top-of-file description to clearly state that
kind-auth.yaml is a standalone auth-enabled CPU-only Kubernetes E2E values file,
and remove any wording that suggests layering or overlay behavior; keep the
comment aligned with the file’s role and reference the kind-auth.yaml header
text.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@e2e/k8s/values/kind-auth.yaml`:
- Around line 1-4: The header comment in kind-auth.yaml implies it extends
kind.yaml, but install_helm_e2e.sh only uses a single values file. Update the
top-of-file description to clearly state that kind-auth.yaml is a standalone
auth-enabled CPU-only Kubernetes E2E values file, and remove any wording that
suggests layering or overlay behavior; keep the comment aligned with the file’s
role and reference the kind-auth.yaml header text.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 4d92f748-47df-4a03-942d-b054d3b9ef99

📥 Commits

Reviewing files that changed from the base of the PR and between d18be8e and 2322ebc.

📒 Files selected for processing (5)
  • .github/workflows/ci.yaml
  • docs/auth/authorization/permissions-reference.mdx
  • e2e/k8s/values/kind-auth.yaml
  • e2e/test_jobs_auth.py
  • services/core/auth/src/nmp/core/auth/assets/static-authz.yaml
💤 Files with no reviewable changes (1)
  • e2e/test_jobs_auth.py

Rebuild policy.wasm to include entities permissions for Viewer/Editor.
Update TestGenericEntitiesApiBlocked -> TestGenericEntitiesApiPermissions
to verify: Viewer can read, Editor can CRUD, Admin and services allowed.

Signed-off-by: Matthew Grossman <[email protected]>
@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor
Suite Lines Covered Line Rate Branch Rate
Unit Tests 22513/29630 76.0% 60.9%
Integration Tests 13005/28310 45.9% 19.4%

…ind job

- Update integration test to expect 200 (not 403) for entity read
- Exclude test_jobs_auth.py from kind-cpu-e2e (no auth) to prevent false failures

Signed-off-by: Matthew Grossman <[email protected]>
--ignore doesn't work with pytest when the file is inside a directory
argument. --deselect properly excludes it.

Signed-off-by: Matthew Grossman <[email protected]>
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