Bundle security
Skill sdieunidou/symfony-bundle-forge/skills/bundle-security
Security best practices for Symfony bundles — SECURITY.md & private disclosure, deny-by-default config, Twig auto-escaping, JSON-in-HTML hex encoding, reflected-input encoding, path-traversal/SSRF defense, query/regex escaping, CSRF, secure cookies & vetted crypto, XXE, no secrets in source, composer audit. Use when reviewing or hardening a bundle's security, writing a security policy, or handling user input/output/paths/tokens/cookies. Triggers — bundle security, SECURITY.md, XSS bundle, path traversal, SSRF, CSRF token, secure cookie, XXE, json_encode raw, composer audit, deny by default.From its SKILL.md
npx -y skills add sdieunidou/symfony-bundle-forge --skill bundle-securityAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
SKILL.md
3.1 KB, as published. Nobody here has run it
Bundle security
Authoritative rules: symfony-bundle-rubric skill, dimension security (13 rules). Apply the ones
that match the bundle's surface; for each security control, ship a regression test.
Always
SECURITY.md(root or.github/): a real policy (not a stub) naming a private channel (GitHub Private Vulnerability Reporting and/or a security email), forbidding public issue reports, with a supported-version table.- Deny by default: every node that widens a boundary (allowed origins/hosts/extensions,
credentials, doctype allowlists) defaults to closed/empty and requires explicit opt-in; validate
illegal combinations at compile time. Bind data collectors / SQL loggers / profiler panels to
%kernel.debug%. - No secrets in source: keys/passphrases come from
env(resolve:...)or%kernel.secret%; docs show the env pattern. Fixture keys live undertests/and are obviously non-production. composer auditas a CI gate; track accepted advisories inconfig.audit.ignorewith an id + justification.
When the bundle touches output
- Twig auto-escaping: never
|rawuntrusted data; HTML-safe output is double-gated (a bundle option AND a per-item flag). - JSON in HTML:
json_encode($x, JSON_HEX_TAG|JSON_HEX_APOS|JSON_HEX_AMP|JSON_HEX_QUOT)(i.e.|json_encode(>=63)) before embedding in a<script>. - Reflected request input:
htmlspecialchars($v, ENT_QUOTES, 'UTF-8')before echoing header/param names into a response.
When the bundle touches paths, URLs, queries, tokens
- Path traversal / SSRF:
realpath()+ verify containment under an allowed root; reject../; reject external URLs unless allowlisted; sign runtime URLs withhash_hmacSHA-256. - Query/regex injection: parameter binding (
->setParameter),preg_quote(), identifier escaping (quoteIdentifier/escapeDqlAlias) — never string concatenation. - CSRF: validate a token (
isCsrfTokenValid()/CsrfTokenBadge) on every state-changing/destructive action. - Cookies & crypto: cookies default
httpOnly,secure(or auto), explicitSameSite; vetted crypto only (hash_hmacSHA-256,lcobucci/jwtv5 with explicit constraints); disable XML external entities (LIBXML_NONET, empty doctype allowlist) when parsing user XML. - Tokens: provide revocation (PSR-6 blocklist keyed by JTI) and replay protection; gate identity access behind an auth check; prefer voters / ExpressionLanguage over ad-hoc role checks.