agentleFS
ViviBeriViviBeri/webcraft-pro/skills/authorization-access-control/SKILL.md

authorization-access-control

Skill11 starsChanged 10 days agoMITView on GitHub

Use when designing or reviewing roles, permissions, tenant isolation, object ownership, administrative actions, or server-side authorization checks in web applications and APIs.

The file

We split this skill into the rules it gives an agent

7 rules. About 0 are common, 7 are distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈7

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Ensure every sensitive operation is authorized for the current principal, requested action and specific resource.

    line 10
  2. Distinctive:

    Check object-level access on every operation that uses a client-supplied identifier.

    line 17
  3. Distinctive:

    Check function-level access for privileged endpoints and administrative workflows.

    line 18
  4. Distinctive:

    Read-only users cannot modify protected fields.

    line 29
  5. Distinctive:

    Avoid relying on frontend route guards, hidden buttons or client-side role flags.

    line 36
  6. Distinctive:

    Use policy functions that receive the principal, action and resource explicitly.

    line 37
  7. Distinctive:

    Avoid ambiguous fallback behavior when policy evaluation fails.

    line 40

≈ “Common” is an estimate: at least 1 in 5 of the 408,460 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Authorization and Access Control

Objective

Ensure every sensitive operation is authorized for the current principal, requested action and specific resource. Authentication proves identity; it does not grant blanket access.

Workflow

  1. Inventory actors, roles, permissions, resources, tenants and sensitive operations.
  2. Define policy centrally and enforce it at the server-side service or data-access boundary.
  3. Deny by default. Grant only the minimum permissions required for the task.
  4. Check object-level access on every operation that uses a client-supplied identifier.
  5. Check function-level access for privileged endpoints and administrative workflows.
  6. Restrict writable properties with explicit allowlists or command-specific input models. Never bind arbitrary request fields directly to persistence models.
  7. Enforce tenant boundaries in reads, writes, exports, background jobs, caches and object storage.
  8. Re-check authorization for asynchronous jobs and long-running operations at execution time where permissions may change.
  9. Record security-relevant denials and privileged changes without logging secrets or unnecessary personal data.

Required negative tests

  • User A cannot read, update, delete or export User B's resources by changing an identifier.
  • A user cannot access another tenant's records, including through search, bulk operations or indirect relationships.
  • A regular user cannot call administrative functions directly.
  • Read-only users cannot modify protected fields.
  • A user cannot elevate privileges by adding role, owner, tenant or approval fields to a request.
  • Revoked permissions take effect within the documented consistency window.
  • Background tasks do not execute with broader authority than intended.

Implementation guidance

  • Avoid relying on frontend route guards, hidden buttons or client-side role flags.
  • Use policy functions that receive the principal, action and resource explicitly.
  • Apply authorization before returning sensitive data or performing side effects.
  • Make resource queries tenant-aware rather than fetching globally and filtering after exposure.
  • Avoid ambiguous fallback behavior when policy evaluation fails.

Completion criteria

Sensitive routes and data operations have explicit server-side authorization, tenant isolation is tested, and negative tests cover object, function and property-level access.

Common AI failure mode

Failure: An agent checks that a user is signed in but fails to authorize access to the specific resource identified by a client-supplied ID.

Why it matters: An authenticated user can change an identifier and read, modify, delete, or export another user's object. Frontend route guards and hidden controls do not protect server-side data operations.

Symptoms:

  • Changing an object ID in a request returns another user's resource.
  • List, search, export, or background-job paths omit the same ownership or tenant check used by the detail route.
  • Authorization is checked only in the UI or before a later resource lookup changes the target object.

Prevention: At the server-side data boundary, authorize the current principal against the requested action and resolved resource on every operation. Scope resource queries by owner or tenant, deny by default, and re-check authorization in asynchronous work where permissions can change. Add negative tests that substitute another user's IDs across reads, writes, deletes, exports, and indirect access paths.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.