skillZs
★ LIVE SKILL TAGS ★
>>> LIVE SKILLS INDEX <<<
* OPEN SOURCE *
NO LOGIN, NO TRACKING
※ REAL INSTALL DATA ※
← back to all skills
vinzscam/backstage-skills49 installs

using-backstage-permissions

Use when a Backstage plugin needs to gate UI behind permissions (frontend) or authorize actions in route handlers (backend). Covers createPermission, the usePermission hook and RequirePermission component, the coreServices.permissions service for backend authorization, and resource permissions for per-instance checks. Triggers on phrases like "require permission", "gate this UI", "check authorization", or imports of @backstage/plugin-permission-common, @backstage/plugin-permission-react, or @backstage/plugin-permission-node.

How do I install this agent skill?

npx skills add https://github.com/vinzscam/backstage-skills --skill using-backstage-permissions
view source ↗

Is this agent skill safe to install?

  • Gen Agent Trust Hubpass

    This skill provides documentation and code patterns for implementing permissions and authorization within the Backstage framework. It promotes security best practices and contains no malicious code or suspicious behaviors.

  • Socketpass

    No alerts

  • Snykpass

    Risk: LOW · No issues

What does this agent skill do?

Backstage Permissions Patterns

When to use this skill

  • Plugin needs to hide a button, menu, or page from users without the right permission (frontend)
  • Plugin's route handler needs to authorize the caller before performing an action (backend)
  • Defining new permissions for a plugin
  • Checking permissions per-resource ("can update this component", not "can update components in general")

Choose the right pattern

Declaring permissions

Building...PatternReference
A new permission for your plugincreatePermission({ name, attributes }) in a *-common libraryreferences/declaring.md

Frontend (in a plugin component)

SituationPatternReference
Conditionally render UI based on a permissionusePermission({ permission }) hookreferences/frontend.md
Wrap an entire subtree in a permission gate<RequirePermission permission={...}>...</RequirePermission>references/frontend.md

Backend (in a route handler or scheduled task)

SituationPatternReference
Authorize a basic action permissioncoreServices.permissions.authorize([{ permission }], { credentials })references/backend.md
Authorize per-resource (with conditional decisions)permissions.authorizeConditional([{ permission, resourceRef }], { credentials }) + permissionsRegistry.addResourceType(...)references/resource-permissions.md

Two invocation modes

  • Standalone (mid-development): user is editing an existing plugin. Pick the right reference based on what's being added — defining a permission, gating UI, or authorizing on the backend.
  • Post-scaffold (called by creating-backstage-plugin): when intent describes "only admins can…", "the current user must have permission to…", or any access-control language. Add the relevant patterns to the freshly scaffolded plugin.

Common gotchas

  • Permissions are declared once, used twice. The permission object lives in a *-common (or *-permissions-common) library so both the frontend (usePermission) and the backend (permissions.authorize) import the same definition. Don't redeclare the same permission in two places.
  • The host app must enable the permission framework. Adopters set permission.enabled: true in app-config.yaml and install a PermissionPolicy. If permissions aren't enabled, authorize always returns AuthorizeResult.ALLOW — your plugin code is correct, just unenforced. Document the prerequisite in your plugin README.
  • permissions.authorize returns an array matching the order of requests. For a single permission, destructure const [decision] = await permissions.authorize(...) — and the decision is decision.result === AuthorizeResult.ALLOW, NOT a boolean.
  • For resource permissions, prefer authorizeConditional over authorize when the decision can depend on the resource (e.g. "owner can update"). It returns conditional decisions you translate into a database-level filter, avoiding the need to load every candidate resource into memory.
  • usePermission is async. Returns { allowed, loading, error } — render a <Skeleton /> while loading, otherwise users see UI flicker as access is determined.
  • For backend plugins, coreServices.permissions and coreServices.permissionsRegistry come from @backstage/backend-plugin-api. They're plugin-scoped — your plugin gets a PermissionsService that already knows its own pluginId.

Add the canonical catalog link to the repository README so users can inspect current installs and available audits. The publishing guide covers the complete discovery path.

<a href="https://skillzs.dev/skills/vinzscam/backstage-skills/using-backstage-permissions">View using-backstage-permissions on skillZs</a>