SkillsReviewed · ronnythedev

dotnet-permission-authorization

dotnet-permission-authorization is an instruction skill for .NET developers adding API permission checks, but its example permission policies do not explicitly require an authenticated user. It provides C# templates for permission attributes, dynamic policies, role-to-permission mapping and authorization handlers. The file declares .NET 8+ support; compilation, integration and runtime security have not been assessed.

Researched 17 Nov 2026

In short.

dotnet-permission-authorization is an instruction skill for ASP.NET Core developers implementing permission-based access control, but its templates depend on additional authentication and endpoint safeguards. It centralizes permissions, translates roles into permission claims and checks those claims through custom authorization policies. The shown controller includes an authentication requirement, while dynamically created permission policies omit one and the fallback configuration leaves otherwise unprotected endpoints open. Application-specific symbols and host configuration also need completion. This is a useful implementation starting point for teams able to review security boundaries, rather than evidence of a complete authorization system. Nothing was executed; compatibility, performance and runtime behavior remain unverified. Pricing and licence terms are unknown.

Researched and written by an AI model and checked by a second AI model. How it works

The selected scope is cli/dist/skills/13-dotnet-permission-authorization and its files, with licence notices beside and above that folder. The supplied manifest lists only SKILL.md at revision 9075ef3b9b86e576a86d634b9c8e8cebf50cf1a0; the full supplied file informs this report. No adjacent or ancestor licence notices are included, leaving their terms unknown. Related authentication, controller-generation and clean-architecture skills, repository tooling and consuming applications are outside the supplied evidence. Nothing was executed, and compilation, runtime authorization, security integration, performance and deployment behavior remain unverified.

The overview

Resource identity

dotnet-permission-authorization is a SKILL.md instruction resource in ronnythedev/dotnet-clean-architecture-skills, under cli/dist/skills/13-dotnet-permission-authorization. It contains C# implementation templates rather than a complete application or a demonstrated installable authorization library.

Its front matter declares skill version 1.0.0, language C#, framework .NET 8+ and dependency Microsoft.AspNetCore.Authorization. These are source declarations; compatibility across framework versions has not been established.

Practical assessment

The useful contribution is a connected implementation pattern: define permissions once, assign them to roles, attach permission requirements to endpoints and evaluate claims through a shared handler. This gives developers a concrete alternative to scattering role checks throughout application code.

The templates need security review and integration work. In particular, custom permission policies omit an authentication requirement, endpoint protection depends on authorization metadata, and record or tenant boundaries are outside the general permission handler. Nothing was compiled or run, so this assessment concerns the supplied code and explanations only.

Who it suits

The skill suits developers building ASP.NET Core APIs whose access rules need actions such as users:read and users:manage_roles, rather than only broad labels such as Admin. Teams comfortable with dependency injection, claims and authorization policies can adapt the components to their application.

Beginners get concrete examples connecting these concepts, but will need additional guidance on authentication and host configuration. Applications needing tenant isolation, editable permission assignments or immediate revocation need capabilities beyond the static mapping shown here. Compatibility with particular assistants or skill loaders is not specified.

Included capabilities

The file supplies permission and role constants, a role-permission dictionary, a custom HasPermission attribute, a permission requirement, an authorization handler, a dynamic policy provider, claims transformation and dependency registration. Example permissions cover organizations, users, departments, assessments, reports and administration.

Multiple roles contribute the union of their permissions. Repeated HasPermission attributes express requirements that must all be satisfied. Examples also cover built-in role policies, imperative checks through IAuthorizationService and document ownership checks. These are demonstrated patterns, not verified runtime capabilities.

Using it

Prerequisites and dependencies

The declared target is C# on .NET 8+ with Microsoft.AspNetCore.Authorization. The code also uses ASP.NET Core authentication interfaces, dependency injection, logging and options. A working authentication setup must supply trusted identities and claims; it is not included.

Developers must replace the {name} namespace placeholders and supply application-specific types. The imperative example references IUserContext, command interfaces, Result and CommonErrors; the document example needs a Document model. Permissions.SomethingWrite and Permissions.DocumentsRead are referenced but absent from the supplied permission constants.

The registration snippet uses IClaimsTransformation without importing Microsoft.AspNetCore.Authentication. An explicit import or an existing project-level global using is needed. No project file or dependency versions are supplied to establish build readiness.

How authorization works

A permission is an action label such as users:write. RoleToPermissionClaimsTransformation reads ClaimTypes.Role claims, looks up each role in the static dictionary and adds the resulting permission claims to a ClaimsIdentity when they are not already present.

HasPermissionAttribute uses its permission string as an authorization policy name. The policy provider first returns an existing named policy; otherwise, it creates a PermissionRequirement for that name and stores the policy in AuthorizationOptions. The handler succeeds when the principal contains a matching permission claim.

The transformation adds claims but does not remove existing permissions or validate their issuer. The handler checks permission text without checking the target record. Trusted claim issuance and resource-specific restrictions therefore remain responsibilities of the surrounding application.

Integration work

Adapt the templates to the application's namespaces, define its actual permission vocabulary and replace the sample role assignments. Register the components through AddPermissionAuthorization and connect the helper to the application's service configuration. Authentication configuration and the request pipeline are not shown.

Decide explicitly which endpoints require authentication and permission checks. The helper defines an authenticated default policy, but its dynamic permission policies contain only a permission requirement. The controller example adds a separate class-level Authorize attribute. The fallback policy is null, so this configuration does not require authorization on otherwise unprotected endpoints.

Complete controller implementations and application types before building. The document authorization handler is not included in the registration helper, so using that example requires additional registration and an authorization call that supplies the document resource.

Example access decision

The role-assignment endpoint illustrates a useful distinction between broad roles and specific actions. It carries both HasPermission(Permissions.UsersWrite) and HasPermission(Permissions.UsersManageRoles), requiring both permissions. Its controller also carries Authorize to require authentication.

The sample Admin mapping includes both permissions, while the Viewer mapping includes neither. Admin does not receive UsersDelete, so the sample separates role management from user deletion. These are expected decisions inferred from the templates, not observed test results.

Assessment & evidence

Security and implementation limits

The dynamic policy contains no RequireAuthenticatedUser call, and the permission handler does not inspect authentication status. Consequently, that requirement must come from other applicable authorization configuration; HasPermission alone should not be treated as an explicit authentication check. The shown controller supplies a separate Authorize attribute.

The generic handler cannot establish ownership or tenant membership because it checks only claims. Calling the Admin role organization-level in a comment does not constrain it to an organization. The separate document example grants owners every operation passed to it and permits non-owner reads through DocumentsRead; those rules require application-specific review.

The claims transformation preserves existing permission claims, so it does not demonstrate permission revocation or correction of stale claims. It reads ClaimTypes.Role specifically, making compatibility with the application's role-claim mapping important.

Denied requests log the user's identifier and complete permission list at warning level. Review whether those details belong in operational logs. Concurrency behavior of runtime policy caching, multi-identity principals, integration behavior and performance are unassessed.

Fit and tradeoffs

Separating permission names from role assignments can keep endpoint requirements stable when role definitions change. Centralizing the mapping also makes it easier to inspect which actions a role receives. Those benefits follow from the template structure; no maintainability or productivity measurements are supplied.

The tradeoff is additional custom infrastructure and a hard-coded permission model. Changes to grants require code changes in the shown design, and dynamic policy creation treats any otherwise unknown policy name as a permission name. Teams should establish naming rules and review interactions with other named policies.

Other approaches shown

The file itself demonstrates simpler built-in role authorization through Authorize(Roles = ...) and named policies such as AdminOnly. These may fit endpoints whose requirements genuinely match stable role groups, while permission attributes express individual actions more directly.

For decisions involving a particular record, the document authorization example checks ownership and an operation requirement. The imperative IAuthorizationService example supports checks inside application handlers. No external authorization product or library is compared, so relative cost, performance and feature coverage are unknown.

Source evidence

The source is cli/dist/skills/13-dotnet-permission-authorization/SKILL.md at repository revision 9075ef3b9b86e576a86d634b9c8e8cebf50cf1a0. The original captured file is available at [https://raw.githubusercontent.com/ronnythedev/dotnet-clean-architecture-skills/9075ef3b9b86e576a86d634b9c8e8cebf50cf1a0/cli/dist/skills/13-dotnet-permission-authorization/SKILL.md].

The retained manifest identifies the file as 28,750 bytes with SHA-256 52eaa557425b957e44242581cf1d0ea48952cbf463361d5a130d983892b24e51. Findings are based on the supplied text and source metadata. No executable project, build output, test results or deployment evidence is included.

Access & freshness

Costs

The supplied file gives no price, subscription terms, support charges or other commercial terms. Cost is unknown; public availability does not establish that every use is free.

Integration effort, maintenance effort and runtime overhead have not been measured. No performance benchmarks or operating-cost estimates are provided.

Licence and reuse

No licence text or reuse grant appears in the supplied SKILL.md. The retained manifest contains no licence notices beside or above the selected folder, so applicable copying, modification and redistribution terms are unknown.

Confirm the repository's applicable licence and notices before copying the templates into a project or redistributing the skill. The GitHub source address alone does not establish those permissions.

Version and currency

The source snapshot was captured on 17 November 2026 at 02:51:31.601 UTC. Its front matter declares version 1.0.0, but the file provides no release date or maintenance history.

The pinned revision establishes which content is described. It does not establish that this is the repository's latest version, that the code remains maintained or that compatibility with every later .NET release has been verified.

Before adoption

Confirm reuse rights, adapt the permission map and complete the missing application definitions. Make authentication requirements explicit for permission-protected endpoints and decide whether otherwise unprotected endpoints should remain accessible.

Review trusted claim issuance, role-claim mapping, permission revocation, ownership and tenant boundaries. Register any resource-specific handlers and review the authorization details written to logs.

Build the integrated application and verify anonymous requests, authenticated users without permissions, users with one or both required permissions, unknown roles and cross-tenant access. Exercise permission changes and concurrent policy creation where relevant. None of these checks has been performed.

Evidence for this report