add-security-voter

add-security-voter is a skill for Claude Code, Codex from tarlepp/symfony-flex-backend. It costs 30 tokens per session (1,449 once invoked), scanned A, original, MIT.

A guide for adding Symfony security voters, which are PHP components that decide whether a user may perform an action on a specific object. It also covers tests for those authorization decisions.

In plain words
What is it for?
Use it when adding or changing subject-based permissions, voter attributes, supported objects, or tests for allowed and denied access.
Why use it?
It helps keep permission checks consistent with the project's users, roles, ownership rules, and Symfony configuration instead of guessing from routes or entity names.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it when adding or changing subject-based permissions, voter attributes, supported objects, or tests for allowed and denied access.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/tarlepp/symfony-flex-backend/add-security-voter
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add tarlepp/symfony-flex-backend --skill add-security-voter
Clone the repo
git clone --depth 1 https://github.com/tarlepp/symfony-flex-backend

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for add-security-voter

README.md
[![agentmods](https://agentmods.dev/badge/skills/tarlepp/symfony-flex-backend/add-security-voter/github.svg)](https://agentmods.dev/skills/tarlepp/symfony-flex-backend/add-security-voter)
Your own site
<a href="https://agentmods.dev/skills/tarlepp/symfony-flex-backend/add-security-voter"><img src="https://agentmods.dev/badge/skills/tarlepp/symfony-flex-backend/add-security-voter/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for add-security-voter

Your own site · 80×15
<a href="https://agentmods.dev/skills/tarlepp/symfony-flex-backend/add-security-voter"><img src="https://agentmods.dev/badge/skills/tarlepp/symfony-flex-backend/add-security-voter.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 30 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,449 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00030 $0.01449
Opus 5.5 $0.00012 $0.00580
Sonnet 5.5 $0.00006 $0.00290
Haiku 4.5 $0.00003 $0.00145

Measured yesterday against content hash fa97e3acc6c1, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

add-security-voter scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.github/skills/add-security-voter/SKILL.md · 123 lines

How it starts

The opening of the file, as written. The whole thing — 123 lines — stays where its author put it; the contents beside it link to each section on GitHub.

What is this?

Use this skill when adding or changing a Symfony security voter, its supported attributes or subjects, or the authorization checks that invoke it. For changes to credentials, authentication flows, firewalls, or broader role policy, also follow .github/skills/implement-api-authentication/SKILL.md.

Follow the shared skill guidance, including .github/copilot-instructions.md and doc/AI_RULES.md. Read doc/SECURITY.md for the repository security policy.

Table of Contents ᐞ

Workflow ᐞ

  1. Read composer.json for supported PHP and Symfony Security versions and symfony.lock for recipes. Inspect config/packages/security.yaml, config/services.yaml, src/Security/Voter/IsUserHimselfVoter.php, its tests, and every affected authorization call site before choosing a pattern. Trace how the subject is resolved and which authenticated identity reaches the voter; do not infer either from the route or entity class alone.
  2. Establish the permission attribute, supported subject type, allowed and denied callers, ownership rules, and any role-based override. Include anonymous callers, other owners, JWT users, and API-key callers where relevant. Ask before making an unspecified policy decision or changing an access boundary. Extend an existing voter when it owns the same policy; keep unrelated permissions separate.
  3. Place voters in src/Security/Voter/ and extend Symfony's Voter, following local typing, generics, and #[Override] conventions. Match the installed method signatures, including the optional Vote argument where applicable. Implement supports() narrowly for the exact attributes and subject types. Unsupported requests must abstain, not grant or deny unrelated permissions; denial of a supported request belongs in voteOnAttribute(). Account for subjectless checks only when the intended permission requires them.
  4. Read the caller from the supplied TokenInterface. Human users are represented by SecurityUser, not the Doctrine User entity; API keys use ApiKeyUser. For ownership checks, compare stable entity identifiers as IsUserHimselfVoter does, not object identity or display names. Do not treat an API-key identifier or credential as a human user's UUID. Deny supported requests for missing or inappropriate identities unless the policy explicitly permits them. Never log credentials or expose them in denial messages or tests.
  5. Keep authorization decisions focused and free of mutations. Inject existing resources or services when domain information is needed rather than putting persistence or business operations in the voter. If the policy depends on roles, preserve configured inheritance using the existing security decision or role helpers; do not replace hierarchy-aware checks with a raw getRoles() membership test. When delegating another decision from a voter, use the supplied token with AccessDecisionManagerInterface and avoid voting recursively on the same attribute and subject.
  6. Preserve the configured unanimous access-decision strategy and inspect overlapping voters: one supported denial can block an otherwise granted permission. Do not change the strategy or all-abstain behavior to make a new check pass. Keep intentional alternatives together at the correct decision boundary. For example, UserRolesController and UserGroupsController express self-or-root access with an IsGranted expression; adding a separate ownership requirement alongside a role check is not equivalent to that alternative.
  7. Wire the permission at every relevant caller using the established #[IsGranted] or authorization-service pattern. Pass the actual subject; for attribute-based controllers, match the subject name to the resolved controller argument. Preserve class-level, method-level, trait-based, and firewall guards unless the requested policy explicitly changes them. Role-only checks do not enforce ownership, and merely creating a voter does not protect an endpoint. Preserve existing response status and error handling rather than swallowing access-denied exceptions.
  8. Rely on existing App\ service discovery and autoconfigure: true for standard voter registration. Do not add redundant security.voter tags or manually instantiate a voter at application call sites. If service configuration is exceptional, inspect its registration before changing it. Keep request-specific identities and subjects out of shared service state.
  9. Follow .github/skills/write-tests/SKILL.md. Use tests/Integration/Security/Voter/IsUserHimselfVoterTest.php as a reference for exercising the public vote() boundary and asserting grant, deny, and abstain results, not protected methods. Cover unsupported attributes and subjects, anonymous or inappropriate identities, matching and different owners, and relevant role overrides. Add container-backed decision-manager coverage when registration, voter overlap, or role inheritance matters. For endpoint checks, follow tests/E2E/Controller/v1/User/UserRolesControllerTest.php: exercise the real request with allowed and denied callers and assert response status and protected output or absence of write side effects. Test JWT and API-key paths when shared policy affects both. Direct voter tests alone do not prove registration, correct subject binding, or endpoint protection.
  10. Update relevant security documentation and OpenAPI access/error metadata when the observable authorization contract changes. Keep policy details close to existing documentation rather than creating parallel guidance.

Read the full file on GitHub · 123 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 123 lines · 30 tokens per session scan A fa97e3acc6c1

Subscribe to this mod's changes

add-security-voter is a skill published in the GitHub repository tarlepp/symfony-flex-backend (288 stars, last pushed today), licensed MIT. It adds 30 tokens to every session and 1,449 once invoked, about $0.0001 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-10-21.