Skip to content
Development
Skill

/api-platform-security

Secure API Platform resources with security expressions, voters, securityPostValidation, and operation-level access control

From plugin
superpowers-symfony
22744 skills14 agents13 commands1 hook

Claude Code

$ npx -y skills add dev-toolings/superpowers-symfony --skill api-platform-security --agent claude-code

SKILL.md

api-platform-security.SKILL.md
name: api-platform-security
description: Secure API Platform resources with security expressions, voters, securityPostValidation, and operation-level access control
capabilities: [read, search, edit, shell]
tags: [api-platform, security]
# projected by `bun run build` — do not edit by hand
allowed-tools:
  - Read
  - Glob
  - Grep
  - Write
  - Edit
  - Bash

Api Platform Security (Symfony)

Use when

  • Restricting who may call each operation of an API Platform resource.
  • Authorization depends on the object (owner) or on the submitted data.
  • Users must see only a subset of a collection.
  • Fields must be hidden depending on role or ownership.

Default workflow

1. Set `security` per operation with `is_granted()`, `object`, and `user`, plus a `securityMessage`. 2. Move complex rules into voters: `is_granted('POST_EDIT', object)`. 3. When the rule depends on input, use `securityPostDenormalize`, or `securityPostValidation` to run after the Validator. 4. Scope rows with a `QueryCollectionExtensionInterface` (and `QueryItemExtensionInterface`) or a state provider. 5. Hide fields with serializer groups and a decorated context builder, and guard the firewall with `access_control`. 6. Test both the grant and the deny case for every protected operation.

Guardrails

  • Never filter rows with a `security` expression on a collection: it gates the whole collection, it does not scope it.
  • Order of checks: `security`, denormalization, `securityPostDenormalize`, validation, `securityPostValidation`.
  • `previous_object` exists only in `securityPostDenormalize`, and `request` only at resource level.
  • Deny by default and mark secrets such as `password` with `#[Ignore]`.
  • `getAccessDecision()` and the Twig `access_decision()` helper need Symfony 8.1 or later: verify before using them.

Progressive disclosure

  • Use this file for execution posture and risk controls.
  • Open references when deep implementation details are needed.

Output contract

  • The security expression and message per operation, and the voters involved.
  • How collections and fields are scoped per user.
  • Tests covering allowed, forbidden, and anonymous access.

References

  • `reference.md`
Read more
@dev-toolings
Ships withsuperpowers-symfony

Superpowers Symfony gives coding agents deep, version-accurate Symfony expertise: from Doctrine schema design and API Platform REST/GraphQL APIs to test-driven development, async Messenger workflows, caching, rate limiting, and clean architecture.

22744 skills14 agents
Get the whole plugin

Stars on GitHub

Momentum

stars in total
227
Star history of dev-toolings/superpowers-symfony on GitHub, a chart by star-history.com

Other skills on superpowers-symfony.

More skills from other plugins.

brainstorming
Auto-invoked

brainstorming

You MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or…

@obra@obraInstall Skill
ask-matt

ask-matt

Ask which skill or flow fits your situation. A router over the skills in this repo.

skills11d309k
@mattpocock@mattpocockInstall Skill
accessibility
Auto-invoked

accessibility

Design, implement, and audit accessible UI to WCAG 2.2 Level AA across Web, iOS, and Android — semantic ARIA roles and labels,…

ecc12d293k
@affaan-m@affaan-mInstall Skill
compiler-commit

compiler-commit

Use when you want to verify compiler changes and commit with the correct convention. Runs tests, lint, and format, then commits…

react2d252k
@facebook@facebookInstall Skill

Questions about api-platform-security.

Which coding agents can use api-platform-security?
api-platform-security installs in Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf with the skills CLI, using each agent's flag shown on this page. Flowy's auto-invocation, which fires a skill when your prompt matches, runs in Claude Code only.