[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7CYGJB26N83DXKMDEKY2X48":3,"skill-same:01M7CYGJB26N83DXKMDEKY2X48":47},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":6,"ownerHtmlUrl":29,"ownerBlogUrl":30,"ownerDescription":31,"updatedAt":32,"install":33,"resources":46},"01M7CYGJB26N83DXKMDEKY2X48","umbraco-security",null,"What Umbraco provides for keeping a package secure, on the server and in the backoffice: Management API authorization and policies, settings that hold secrets, endpoints outside the Management API, sanitizeHTML and escapeHTML, DOMPurify rules for custom elements, and umbHttpClient instead of handling tokens in the browser. Use when writing or reviewing a Management API controller, a secret setting, a custom endpoint, a backoffice template that uses unsafeHTML, or frontend code that calls an API.","mattbrailsford\u002Fumbraco-devkit","mattbrailsford","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F527305?v=4","01M7CY974D4XX1P90YSXQC1T39","Matt Brailsford","01M7CY9751PSRA3EHBH03G936J",3,"MIT","https:\u002F\u002Fgithub.com\u002Fmattbrailsford\u002Fumbraco-devkit\u002Fblob\u002Fmain\u002Fplugins\u002Fumbraco-devkit\u002Fskills\u002Fumbraco-security\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: umbraco-security\ndescription: >-\n  What Umbraco provides for keeping a package secure, on the server and in the backoffice:\n  Management API authorization and policies, settings that hold secrets, endpoints outside\n  the Management API, sanitizeHTML and escapeHTML, DOMPurify rules for\n  custom elements, and umbHttpClient instead of handling tokens in the browser. Use when\n  writing or reviewing a Management API controller, a secret setting, a custom endpoint, a\n  backoffice template that uses unsafeHTML, or frontend code that calls an API.\n---\n\n# Security in Umbraco packages\n\nGeneral security (injection, XSS, CSRF, secrets in bundles, supply chain) isn't repeated\nhere. This skill covers what Umbraco provides for it and where Umbraco's defaults stop, so a\npackage uses those instead of hand-rolling its own.\n\nCheck type names and exports against the CMS source at the target release\n(`umbraco-cms-source`). Everything below was checked at `release-17.6.1`.\n\n## Management API controllers\n\n- **The base class is the authentication.** `ManagementApiControllerBase` carries\n  `[Authorize(Policy = AuthorizationPolicies.BackOfficeAccess)]`. The\n  `\u002Fumbraco\u002Fmanagement\u002Fapi\u002F` route alone protects nothing, so a controller on that route\n  that inherits plain `ControllerBase` is open to anyone.\n- **Backoffice access isn't enough for a sensitive action.** Add a stricter policy to\n  deletes, secret access, and settings that affect other users. `AuthorizationPolicies` has\n  built-in section and tree policies (`SectionAccessSettings`, `RequireAdminAccess`, and\n  others); a package-specific one is registered in a composer with `AddAuthorization`\n  (example in `umbraco-extensibility`'s `references\u002Fapi-and-infrastructure.md`).\n- **Every policy name must be registered.** An unknown name throws\n  `InvalidOperationException` (\"The AuthorizationPolicy named: '...' was not found\") on\n  every request to that endpoint. It fails closed, but only shows up when someone calls it.\n- **Check each action, not just the class.** An action's `[AllowAnonymous]` overrides the\n  class-level policy.\n\n## Secrets and sensitive configuration\n\n- **A masked field is write-only in the API.** A field shown as a password in the editor\n  must not come back in any response, not even to redraw the mask. Return whether a value\n  is set; treat an empty or masked value on save as \"keep the existing one\".\n- **Prefer a configuration reference to the secret itself.** A setting can store a\n  configuration key (`MyPackage:Providers:CoolVendor:ApiKey`) resolved from `IConfiguration`\n  at the point of use. Each environment then supplies its own value, and the reference is\n  safe to move between environments (`umbraco-env-sync`). Restrict the reference to the\n  package's own configuration sections, or it can be pointed at a connection string or\n  another package's secret and read back through your API.\n- **Keep secrets out of Deploy and uSync exports**: `umbraco-env-sync`.\n\n## Endpoints outside the Management API\n\nA minimal API route, a surface controller, or a webhook receiver doesn't inherit the\nManagement API's authentication or anything else from the backoffice, even in the same\nproject. Decide each one explicitly: a member endpoint called with the login cookie needs\nantiforgery or an origin check, and a public webhook needs its own authentication\n(a signature or shared secret).\n\n## Backoffice: sanitizing and escaping\n\nLit escapes interpolated values; the risk is in `unsafeHTML()`\u002F`unsafeSVG()`.\n`@umbraco-cms\u002Fbackoffice\u002Futils` exports two helpers:\n\n- **`sanitizeHTML(html)`** runs DOMPurify with its default config. Use it on any HTML that\n  must render as markup and isn't a constant: rich text, AI output, external API content,\n  editor-written help text.\n- **`escapeHTML(value)`** escapes one value for insertion into HTML you then render with\n  `unsafeHTML`.\n\n```typescript\nimport { html, unsafeHTML } from '@umbraco-cms\u002Fbackoffice\u002Fexternal\u002Flit';\nimport { sanitizeHTML } from '@umbraco-cms\u002Fbackoffice\u002Futils';\n\n\u002F\u002F WRONG: renders unsanitized markup\nhtml`\u003Cdiv>${unsafeHTML(this._summary)}\u003C\u002Fdiv>`;\n\n\u002F\u002F RIGHT\nhtml`\u003Cdiv>${unsafeHTML(sanitizeHTML(this._summary))}\u003C\u002Fdiv>`;\n```\n\nImport DOMPurify itself from `@umbraco-cms\u002Fbackoffice\u002Fexternal\u002Fdompurify` if you need a custom\nconfig, so the package doesn't bundle a second copy.\n\n## Backoffice: custom elements in sanitized HTML\n\nAllowing your own elements through DOMPurify (`CUSTOM_ELEMENT_HANDLING`) needs an\n`attributeNameCheck` that excludes event handlers. `\u002F.+\u002F` lets `onclick` and `onload` through\non every allowed tag. Umbraco's own UFM sanitizer had this bug (GHSA-vrqc-59mw-qqg7) and now\nuses `\u002F^(?!on)\u002F`. Match it, or list the allowed attributes:\n\n```typescript\nCUSTOM_ELEMENT_HANDLING: {\n  tagNameCheck: \u002F^my-pkg-\u002F,\n  attributeNameCheck: \u002F^(?!on)\u002F,\n  allowCustomizedBuiltInElements: false,\n}\n```\n\n## Backoffice: credentials stay on the server\n\n- **Backoffice auth.** From 17.0 the backoffice's access token lives in an httpOnly cookie\n  that scripts can't read. Call your package's Management API through `umbHttpClient`\n  (`@umbraco-cms\u002Fbackoffice\u002Fhttp-client`), and pass it as the `client` option to calls from\n  a generated client so they reuse its cookie setup (generating one is in\n  `umbraco-backoffice-conventions`). Never read, copy, or store a token in\n  `localStorage`\u002F`sessionStorage`.\n- **Third-party keys.** A key in `import.meta.env.VITE_*` is public once built. Put the call\n  to the third-party service behind your own Management API endpoint, which reads the key\n  from server-side settings (\"Secrets and sensitive configuration\").\n\n## *In a review*\n\nEach of these is an injection, an authorization gap, or a secret exposure, which the\n`reviewer` agent treats as `Critical`:\n\n- a Management API controller without `ManagementApiControllerBase` or an explicit\n  backoffice policy, or a policy name nothing registers\n- a sensitive action guarded only by backoffice access\n- a masked setting returned in a response, or a configuration reference with no section\n  restriction\n- a cookie-authenticated endpoint outside the Management API with no antiforgery or origin\n  check\n- an unsanitized `unsafeHTML`\u002F`unsafeSVG` render of non-constant content\n- a DOMPurify config that lets `on*` attributes through\n- a secret reaching the client bundle\n","# Security in Umbraco packages\n\nGeneral security (injection, XSS, CSRF, secrets in bundles, supply chain) isn't repeated\nhere. This skill covers what Umbraco provides for it and where Umbraco's defaults stop, so a\npackage uses those instead of hand-rolling its own.\n\nCheck type names and exports against the CMS source at the target release\n(`umbraco-cms-source`). Everything below was checked at `release-17.6.1`.\n\n## Management API controllers\n\n- **The base class is the authentication.** `ManagementApiControllerBase` carries\n  `[Authorize(Policy = AuthorizationPolicies.BackOfficeAccess)]`. The\n  `\u002Fumbraco\u002Fmanagement\u002Fapi\u002F` route alone protects nothing, so a controller on that route\n  that inherits plain `ControllerBase` is open to anyone.\n- **Backoffice access isn't enough for a sensitive action.** Add a stricter policy to\n  deletes, secret access, and settings that affect other users. `AuthorizationPolicies` has\n  built-in section and tree policies (`SectionAccessSettings`, `RequireAdminAccess`, and\n  others); a package-specific one is registered in a composer with `AddAuthorization`\n  (example in `umbraco-extensibility`'s `references\u002Fapi-and-infrastructure.md`).\n- **Every policy name must be registered.** An unknown name throws\n  `InvalidOperationException` (\"The AuthorizationPolicy named: '...' was not found\") on\n  every request to that endpoint. It fails closed, but only shows up when someone calls it.\n- **Check each action, not just the class.** An action's `[AllowAnonymous]` overrides the\n  class-level policy.\n\n## Secrets and sensitive configuration\n\n- **A masked field is write-only in the API.** A field shown as a password in the editor\n  must not come back in any response, not even to redraw the mask. Return whether a value\n  is set; treat an empty or masked value on save as \"keep the existing one\".\n- **Prefer a configuration reference to the secret itself.** A setting can store a\n  configuration key (`MyPackage:Providers:CoolVendor:ApiKey`) resolved from `IConfiguration`\n  at the point of use. Each environment then supplies its own value, and the reference is\n  safe to move between environments (`umbraco-env-sync`). Restrict the reference to the\n  package's own configuration sections, or it can be pointed at a connection string or\n  another package's secret and read back through your API.\n- **Keep secrets out of Deploy and uSync exports**: `umbraco-env-sync`.\n\n## Endpoints outside the Management API\n\nA minimal API route, a surface controller, or a webhook receiver doesn't inherit the\nManagement API's authentication or anything else from the backoffice, even in the same\nproject. Decide each one explicitly: a member endpoint called with the login cookie needs\nantiforgery or an origin check, and a public webhook needs its own authentication\n(a signature or shared secret).\n\n## Backoffice: sanitizing and escaping\n\nLit escapes interpolated values; the risk is in `unsafeHTML()`\u002F`unsafeSVG()`.\n`@umbraco-cms\u002Fbackoffice\u002Futils` exports two helpers:\n\n- **`sanitizeHTML(html)`** runs DOMPurify with its default config. Use it on any HTML that\n  must render as markup and isn't a constant: rich text, AI output, external API content,\n  editor-written help text.\n- **`escapeHTML(value)`** escapes one value for insertion into HTML you then render with\n  `unsafeHTML`.\n\n```typescript\nimport { html, unsafeHTML } from '@umbraco-cms\u002Fbackoffice\u002Fexternal\u002Flit';\nimport { sanitizeHTML } from '@umbraco-cms\u002Fbackoffice\u002Futils';\n\n\u002F\u002F WRONG: renders unsanitized markup\nhtml`\u003Cdiv>${unsafeHTML(this._summary)}\u003C\u002Fdiv>`;\n\n\u002F\u002F RIGHT\nhtml`\u003Cdiv>${unsafeHTML(sanitizeHTML(this._summary))}\u003C\u002Fdiv>`;\n```\n\nImport DOMPurify itself from `@umbraco-cms\u002Fbackoffice\u002Fexternal\u002Fdompurify` if you need a custom\nconfig, so the package doesn't bundle a second copy.\n\n## Backoffice: custom elements in sanitized HTML\n\nAllowing your own elements through DOMPurify (`CUSTOM_ELEMENT_HANDLING`) needs an\n`attributeNameCheck` that excludes event handlers. `\u002F.+\u002F` lets `onclick` and `onload` through\non every allowed tag. Umbraco's own UFM sanitizer had this bug (GHSA-vrqc-59mw-qqg7) and now\nuses `\u002F^(?!on)\u002F`. Match it, or list the allowed attributes:\n\n```typescript\nCUSTOM_ELEMENT_HANDLING: {\n  tagNameCheck: \u002F^my-pkg-\u002F,\n  attributeNameCheck: \u002F^(?!on)\u002F,\n  allowCustomizedBuiltInElements: false,\n}\n```\n\n## Backoffice: credentials stay on the server\n\n- **Backoffice auth.** From 17.0 the backoffice's access token lives in an httpOnly cookie\n  that scripts can't read. Call your package's Management API through `umbHttpClient`\n  (`@umbraco-cms\u002Fbackoffice\u002Fhttp-client`), and pass it as the `client` option to calls from\n  a generated client so they reuse its cookie setup (generating one is in\n  `umbraco-backoffice-conventions`). Never read, copy, or store a token in\n  `localStorage`\u002F`sessionStorage`.\n- **Third-party keys.** A key in `import.meta.env.VITE_*` is public once built. Put the call\n  to the third-party service behind your own Management API endpoint, which reads the key\n  from server-side settings (\"Secrets and sensitive configuration\").\n\n## *In a review*\n\nEach of these is an injection, an authorization gap, or a secret exposure, which the\n`reviewer` agent treats as `Critical`:\n\n- a Management API controller without `ManagementApiControllerBase` or an explicit\n  backoffice policy, or a policy name nothing registers\n- a sensitive action guarded only by backoffice access\n- a masked setting returned in a response, or a configuration reference with no section\n  restriction\n- a cookie-authenticated endpoint outside the Management API with no antiforgery or origin\n  check\n- an unsanitized `unsafeHTML`\u002F`unsafeSVG` render of non-constant content\n- a DOMPurify config that lets `on*` attributes through\n- a secret reaching the client bundle\n",{"name":5,"description":7},"main","a2f9c28bc56802b4e6db01e03972e497b30ad001","plugins\u002Fumbraco-devkit\u002Fskills\u002Fumbraco-security",1,"https:\u002F\u002Fgithub.com\u002Fmattbrailsford\u002Fumbraco-devkit","https:\u002F\u002Fgithub.com\u002Fmattbrailsford","https:\u002F\u002Fmattbrailsford.dev","AI Staff Engineer @umbraco ","2026-11-12 18:33:53",{"source":8,"skillName":5,"commands":34,"prompt":44,"zipAvailable":45},[35,38,41],{"tool":36,"command":37},"npx","npx skills add mattbrailsford\u002Fumbraco-devkit --skill umbraco-security",{"tool":39,"command":40},"bunx","bunx skills add mattbrailsford\u002Fumbraco-devkit --skill umbraco-security",{"tool":42,"command":43},"pnpm","pnpm dlx skills add mattbrailsford\u002Fumbraco-devkit --skill umbraco-security","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fmattbrailsford\u002Fumbraco-devkit\u002Fblob\u002Fmain\u002Fplugins\u002Fumbraco-devkit\u002Fskills\u002Fumbraco-security\u002FSKILL.md",true,[],[48,55,62,69,76,83],{"skillNo":49,"name":50,"nameZh":6,"description":51,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":52,"categories":53,"keywords":54,"publishedAt":19},"01M7CYGRPVNP8H9YNHGMZ6CP3C","user-stories","Writes, splits and refines user stories with Given\u002FWhen\u002FThen acceptance criteria in STORIES.md, feeding bdd-specs. Use when turning a feature request or a vague ask into a testable backlog entry.","https:\u002F\u002Fgithub.com\u002Fmattbrailsford\u002Fumbraco-devkit\u002Fblob\u002Fmain\u002Fplugins\u002Fumbraco-devkit\u002Fskills\u002Fuser-stories\u002FSKILL.md",[],[],{"skillNo":56,"name":57,"nameZh":6,"description":58,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":59,"categories":60,"keywords":61,"publishedAt":19},"01M7CYGBEZ2Q4AXDDNADWW4Q9H","umbraco-performance","Keeping a package fast on the sites that install it: the published cache over the services layer, tree traversal, caching lookups and clearing them, data type config and converter cache levels, output cache eviction, light hot paths, and backoffice screens that don't over-fetch. Use when writing, changing or reviewing code that runs per request, per save, per indexed item or at startup (property value converters, notification handlers, indexing), code that loops over every content item (a full rebuild, an import, a sync), or a list or search screen. Not for a site's own templates.","https:\u002F\u002Fgithub.com\u002Fmattbrailsford\u002Fumbraco-devkit\u002Fblob\u002Fmain\u002Fplugins\u002Fumbraco-devkit\u002Fskills\u002Fumbraco-performance\u002FSKILL.md",[],[],{"skillNo":63,"name":64,"nameZh":6,"description":65,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":66,"categories":67,"keywords":68,"publishedAt":19},"01M7CYG59CZN1K2KERB0SSDGSY","umbraco-package-conventions","Backend conventions for an Umbraco package: async naming, internal by default, Attempt-based results for routine failures, public-API backwards compatibility, and where extension methods live. Use when naming a method, choosing visibility, shaping a service's result, changing a public signature (including adding a dependency to a public class's constructor), or organizing extension methods. For extension mechanisms, see `umbraco-extensibility`.","https:\u002F\u002Fgithub.com\u002Fmattbrailsford\u002Fumbraco-devkit\u002Fblob\u002Fmain\u002Fplugins\u002Fumbraco-devkit\u002Fskills\u002Fumbraco-package-conventions\u002FSKILL.md",[],[],{"skillNo":70,"name":71,"nameZh":6,"description":72,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":19},"01M7CYG0J10QH8J2GS825WTTET","umbraco-marketplace","Gets a finished package listed on the Umbraco Marketplace: the NuGet tag, the dependency Marketplace reads version support from, the v14+ compatibility gotcha, and umbraco-marketplace.json. Use when a package is ready to publish, or when reviewing its packaging.","https:\u002F\u002Fgithub.com\u002Fmattbrailsford\u002Fumbraco-devkit\u002Fblob\u002Fmain\u002Fplugins\u002Fumbraco-devkit\u002Fskills\u002Fumbraco-marketplace\u002FSKILL.md",[],[],{"skillNo":77,"name":78,"nameZh":6,"description":79,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":80,"categories":81,"keywords":82,"publishedAt":19},"01M7CYFT7MSYW4GRDSQRDPG020","umbraco-extensibility","Umbraco's extension mechanisms (Composers, collection builders, notification handlers, attribute discovery) and a catalogue of backend CMS extension points: property value converters, Management API endpoints, content finders, health checks, search indexing, package migrations, background jobs, and more. Use when making a feature extensible or choosing which extension point fits. Not for property editor UI, dashboards, sections or trees, which the official Backoffice Skills plugin covers.","https:\u002F\u002Fgithub.com\u002Fmattbrailsford\u002Fumbraco-devkit\u002Fblob\u002Fmain\u002Fplugins\u002Fumbraco-devkit\u002Fskills\u002Fumbraco-extensibility\u002FSKILL.md",[],[],{"skillNo":84,"name":85,"nameZh":6,"description":86,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":19},"01M7CYFM5BJ5SVK9SJB78VY6ZG","umbraco-env-sync","Moving an Umbraco package's own entities between environments with Umbraco Deploy or uSync: what moves as files and what moves over the wire, export shape and dependencies, restores, keeping secrets out, linking users by alias, translating stored ids, and keeping sync code current. Use when adding Deploy or uSync support, or changing an entity the package syncs. Not for deploying the site itself.","https:\u002F\u002Fgithub.com\u002Fmattbrailsford\u002Fumbraco-devkit\u002Fblob\u002Fmain\u002Fplugins\u002Fumbraco-devkit\u002Fskills\u002Fumbraco-env-sync\u002FSKILL.md",[],[]]