Skip to content

docs(plugin-authz): add authz skill and rule the plugin route examples - #541

Merged
maxdubrinsky merged 2 commits into
mainfrom
plugin-authz-skills/md
Jul 2, 2026
Merged

docs(plugin-authz): add authz skill and rule the plugin route examples#541
maxdubrinsky merged 2 commits into
mainfrom
plugin-authz-skills/md

Conversation

@maxdubrinsky

@maxdubrinsky maxdubrinsky commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

What

Plugin HTTP authorization is now derived from routes (@path_rule + AuthzScope, #332). The plugin-* developer skills carried no authz guidance, and several taught route examples with no rule — following them today produces a plugin whose OPA bundle build hard-fails.

This adds a canonical plugin-authz skill and fixes the misleading examples.

Changes

  • New plugin-authz skill (SKILL.md + examples.md): the rule (every route needs a @path_rule or hard_fail refuses the bundle), the recipe, the service.resource.action permission grammar, the @AuthzScope.read/.write scope gate, caller kinds (PRINCIPAL vs SERVICE_PRINCIPAL), the job/function route factories (authz=), extra_permissions / extra_role_permissions, the fail modes, and the verify commands.
  • Ruled the route examples in creating-a-plugin (the 5-step minimal service and the job/function factory calls), plugin-service (+ crud-example.md), plugin-job, plugin-function; added a service-principal note to plugin-controller.
  • Registered plugin-authz in the nemo-platform-plugin package AGENTS.md skill index (routing list + Available Skills).

Why it matters

Under the new on_invalid_plugin=hard_fail default, an unruled route aborts the whole OPA bundle build and the platform 502s. An agent following creating-a-plugin's "minimal plugin in 5 steps" as written would ship a plugin that will not start.

Verification

  • New skill frontmatter valid; every cross-skill link resolves; plugin-authz registered in both AGENTS.md lists.
  • Every code snippet is grounded in the real surface (authz.py, the example plugin, the deployments service-principal routes, the factory signatures) and was adversarially reviewed against source before landing.

Summary by CodeRabbit

  • Documentation
    • Added new guidance for plugin route authorization, including required auth rules for every HTTP route.
    • Expanded plugin setup docs with examples for secure route patterns, job/function mounting, and controller status updates.
    • Added a dedicated authorization reference with recipes, verification steps, and migration notes from older authorization patterns.
    • Updated CRUD examples to show per-route read/write permissions and service-principal-only status handling.

Plugin HTTP authz is now derived from routes (@path_rule + AuthzScope), but the
plugin-* dev skills carried no authz guidance and several showed unruled route
examples that now fail the OPA bundle build under on_invalid_plugin=hard_fail.

- Add the plugin-authz skill (SKILL.md + examples.md): the recipe, permission id
  grammar, scope gate, caller kinds (PRINCIPAL vs SERVICE_PRINCIPAL), the job and
  function route factories, extra_permissions/extra_role_permissions, fail modes,
  and the verify commands.
- Rule the route examples in creating-a-plugin, plugin-service (+ crud-example),
  plugin-job and plugin-function; add a service-principal note to plugin-controller.
- Register plugin-authz in the package AGENTS.md skill index.

Signed-off-by: Max Dubrinsky <mdubrinsky@nvidia.com>
@maxdubrinsky
maxdubrinsky requested review from a team as code owners July 1, 2026 22:17
@github-actions github-actions Bot added the docs label Jul 1, 2026
@coderabbitai

coderabbitai Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

This PR is documentation-only, adding a new plugin-authz skill guide and recipes, updating AGENTS.md, and revising existing plugin skill docs (creating-a-plugin, plugin-controller, plugin-function, plugin-job, plugin-service) to require @path_rule/authz= decorators on all plugin HTTP routes to avoid OPA bundle build failures.

Changes

Plugin authorization documentation

Layer / File(s) Summary
AGENTS.md skill index
packages/nemo_platform_plugin/AGENTS.md
Adds authz key concept, checklist entry, and plugin-authz skill listing.
New plugin-authz skill and recipes
.../skills/plugin-authz/SKILL.md, .../skills/plugin-authz/examples.md
Defines authz decorator model, PermissionSet, caller kinds, fail modes, escape hatches, and migration from get_authz_contribution.
creating-a-plugin authz examples
.../skills/creating-a-plugin/SKILL.md
Adds authz decorators to minimal example and requires authz= on job/function route mounting.
plugin-controller status-write authz
.../skills/plugin-controller/SKILL.md
Requires service-principal gating on controller status-write routes.
plugin-function authz= requirement
.../skills/plugin-function/SKILL.md
Requires authz= on add_function_routes in mounting, testing, and streaming examples.
plugin-job authz= requirement
.../skills/plugin-job/SKILL.md
Requires authz= on add_job_routes.
plugin-service and CRUD example wiring
.../skills/plugin-service/SKILL.md, .../skills/plugin-service/crud-example.md
Adds AuthzScope/WidgetPerms decorators to service route examples and full CRUD example.

Possibly related PRs

Suggested labels: feat

Suggested reviewers: ironcommit

🚥 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 Title matches the main change set: a new plugin-authz skill plus authorization updates to plugin route examples.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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 plugin-authz-skills/md

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 (2)
packages/nemo_platform_plugin/src/nemo_platform_plugin/.agents/skills/plugin-authz/SKILL.md (1)

1-8: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add prerequisites before the guide body.

The page jumps straight into authz rules and recipes, but the doc guideline requires prerequisites at the top. The workspace/install assumptions currently only appear in Verify.

As per coding guidelines: “Always list prerequisites at the top of documentation pages before other content.”

🤖 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
`@packages/nemo_platform_plugin/src/nemo_platform_plugin/.agents/skills/plugin-authz/SKILL.md`
around lines 1 - 8, Add a short prerequisites section at the top of the
plugin-authz guide before the main authz explanation in SKILL.md. Move the
workspace/install assumptions currently mentioned under Verify into this new
opening section, and keep the rest of the document starting with the route-based
authorization overview. Use the existing SKILL.md headings/content flow as the
reference point when inserting the prerequisites above the current body.

Source: Coding guidelines

packages/nemo_platform_plugin/src/nemo_platform_plugin/.agents/skills/plugin-authz/examples.md (1)

1-24: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add prerequisites before the recipes.

This page starts with examples immediately, but the repo doc guideline requires prerequisites at the top. The repo-root/workspace-installed assumptions are only stated later in Verify.

As per coding guidelines: “Always list prerequisites at the top of documentation pages before other content.”

🤖 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
`@packages/nemo_platform_plugin/src/nemo_platform_plugin/.agents/skills/plugin-authz/examples.md`
around lines 1 - 24, The documentation starts with recipes before listing the
assumptions needed to use them, so add a prerequisites section at the top of
this page before the “plugin-authz recipes” content. Move the
repo-root/workspace-installed assumptions from the later “Verify” area into that
new prerequisites section, and keep the rest of the recipe sections unchanged.

Source: Coding guidelines

🤖 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
`@packages/nemo_platform_plugin/src/nemo_platform_plugin/.agents/skills/plugin-authz/examples.md`:
- Around line 1-24: The documentation starts with recipes before listing the
assumptions needed to use them, so add a prerequisites section at the top of
this page before the “plugin-authz recipes” content. Move the
repo-root/workspace-installed assumptions from the later “Verify” area into that
new prerequisites section, and keep the rest of the recipe sections unchanged.

In
`@packages/nemo_platform_plugin/src/nemo_platform_plugin/.agents/skills/plugin-authz/SKILL.md`:
- Around line 1-8: Add a short prerequisites section at the top of the
plugin-authz guide before the main authz explanation in SKILL.md. Move the
workspace/install assumptions currently mentioned under Verify into this new
opening section, and keep the rest of the document starting with the route-based
authorization overview. Use the existing SKILL.md headings/content flow as the
reference point when inserting the prerequisites above the current body.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 56b92a0d-2299-45b7-8155-d3445cca238c

📥 Commits

Reviewing files that changed from the base of the PR and between 47d6eea and 55a0602.

📒 Files selected for processing (9)
  • packages/nemo_platform_plugin/AGENTS.md
  • packages/nemo_platform_plugin/src/nemo_platform_plugin/.agents/skills/creating-a-plugin/SKILL.md
  • packages/nemo_platform_plugin/src/nemo_platform_plugin/.agents/skills/plugin-authz/SKILL.md
  • packages/nemo_platform_plugin/src/nemo_platform_plugin/.agents/skills/plugin-authz/examples.md
  • packages/nemo_platform_plugin/src/nemo_platform_plugin/.agents/skills/plugin-controller/SKILL.md
  • packages/nemo_platform_plugin/src/nemo_platform_plugin/.agents/skills/plugin-function/SKILL.md
  • packages/nemo_platform_plugin/src/nemo_platform_plugin/.agents/skills/plugin-job/SKILL.md
  • packages/nemo_platform_plugin/src/nemo_platform_plugin/.agents/skills/plugin-service/SKILL.md
  • packages/nemo_platform_plugin/src/nemo_platform_plugin/.agents/skills/plugin-service/crud-example.md

@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%

Follow-up after functionally verifying the skill (a skill-only agent built a
plugin whose authz derived clean) and reviewing caller-kind coverage.

- Caller kinds: replace the prose with a positive classification table (what
  each setting does, which routes suit it), drop the ANON reference (dropped
  from the spec), and document that callers must be non-empty (callers=[]
  raises; "either" is [PRINCIPAL, SERVICE_PRINCIPAL]).
- @path_rule: note stacking ORs only the caller dimension — stacked rules must
  share permissions (an OR of distinct permission sets is rejected).
- Permission ids: clarify segments split on dots only (hyphens are fine within
  a segment, e.g. my-plugin.widgets.create).
- examples.md: fix the service-principal recipe's entity-client import (was a
  local re-export the shown dependencies.py did not provide); point the job and
  function factory recipes at plugin-job / plugin-function for building the
  class; add a lightweight in-process tests/test_authz.py recipe.

Signed-off-by: Max Dubrinsky <mdubrinsky@nvidia.com>

@ironcommit ironcommit 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.

LGTM

@maxdubrinsky
maxdubrinsky added this pull request to the merge queue Jul 2, 2026
Merged via the queue into main with commit cc075bf Jul 2, 2026
52 checks passed
@maxdubrinsky
maxdubrinsky deleted the plugin-authz-skills/md branch July 2, 2026 18:43
arpitsardhana pushed a commit that referenced this pull request Jul 9, 2026
#541)

* docs(plugin-authz): add authz skill and rule the plugin route examples

Plugin HTTP authz is now derived from routes (@path_rule + AuthzScope), but the
plugin-* dev skills carried no authz guidance and several showed unruled route
examples that now fail the OPA bundle build under on_invalid_plugin=hard_fail.

- Add the plugin-authz skill (SKILL.md + examples.md): the recipe, permission id
  grammar, scope gate, caller kinds (PRINCIPAL vs SERVICE_PRINCIPAL), the job and
  function route factories, extra_permissions/extra_role_permissions, fail modes,
  and the verify commands.
- Rule the route examples in creating-a-plugin, plugin-service (+ crud-example),
  plugin-job and plugin-function; add a service-principal note to plugin-controller.
- Register plugin-authz in the package AGENTS.md skill index.

Signed-off-by: Max Dubrinsky <mdubrinsky@nvidia.com>

* docs(plugin-authz): refine caller-kind guidance and fix example gaps

Follow-up after functionally verifying the skill (a skill-only agent built a
plugin whose authz derived clean) and reviewing caller-kind coverage.

- Caller kinds: replace the prose with a positive classification table (what
  each setting does, which routes suit it), drop the ANON reference (dropped
  from the spec), and document that callers must be non-empty (callers=[]
  raises; "either" is [PRINCIPAL, SERVICE_PRINCIPAL]).
- @path_rule: note stacking ORs only the caller dimension — stacked rules must
  share permissions (an OR of distinct permission sets is rejected).
- Permission ids: clarify segments split on dots only (hyphens are fine within
  a segment, e.g. my-plugin.widgets.create).
- examples.md: fix the service-principal recipe's entity-client import (was a
  local re-export the shown dependencies.py did not provide); point the job and
  function factory recipes at plugin-job / plugin-function for building the
  class; add a lightweight in-process tests/test_authz.py recipe.

Signed-off-by: Max Dubrinsky <mdubrinsky@nvidia.com>

---------

Signed-off-by: Max Dubrinsky <mdubrinsky@nvidia.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants