[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M79S1PY2BQXTEPT4T18TZBE4":3,"skill-same:01M79S1PY2BQXTEPT4T18TZBE4":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},"01M79S1PY2BQXTEPT4T18TZBE4","csp-security",null,"OWASP ASVS L2 security guidance (CSP, headers, HSTS, rate limiting, authz, input\u002Foutput handling).","dpalfery\u002Fkyber-weave","dpalfery","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F8592256?v=4","01M79RX47GSHMSDA5N4J22JXZ0","David Palfery","01M79RX486WGXFFRB4G5YCSCD5",23,"MIT","https:\u002F\u002Fgithub.com\u002Fdpalfery\u002Fkyber-weave\u002Fblob\u002Fmain\u002Fproducts\u002Fkyber-squad\u002Fskills\u002Fcsp-security\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: csp-security\ndescription: OWASP ASVS L2 security guidance (CSP, headers, HSTS, rate limiting, authz, input\u002Foutput handling).\nlicense: MIT\n---\n\n# CSP \u002F Security Headers \u002F OWASP ASVS L2 Patterns\n\n**Trigger:**\nThis skill MUST be loaded whenever working on:\n- Security headers, CSP policies, or HSTS configuration.\n- Rate limiting, throttling, or abuse prevention.\n- Authorization policies, `[Authorize]` attributes, or role-based access control.\n- Input validation, sanitization, or output encoding.\n- CORS configuration or cross-origin security.\n- Middleware pipeline ordering in `Program.cs`.\n- API or BFF endpoints, security middleware, or `Program.cs` pipeline ordering.\n\n---\n\n## Security Target: OWASP ASVS Level 2\n\nThis project targets **OWASP Application Security Verification Standard (ASVS) Level 2**. All security decisions must be evaluated against this standard.\n\n---\n\n## Security Headers Middleware\n\n### API: `SecurityHeadersMiddleware.cs`\nLocation: the API project's security-headers middleware (name it after the host's existing type).\n\n**Required Headers (all responses):**\n| Header | Value | Purpose |\n|---|---|---|\n| `Content-Security-Policy` | `default-src 'self'; script-src 'self'; style-src 'self'; img-src 'self' data:; font-src 'self'; connect-src 'self'; frame-ancestors 'none'; base-uri 'self'; form-action 'self'` | Strict CSP blocking external resources |\n| `Strict-Transport-Security` | `max-age=63072000; includeSubDomains; preload` | HSTS with 2-year max-age |\n| `X-Content-Type-Options` | `nosniff` | Prevent MIME sniffing |\n| `X-Frame-Options` | `DENY` | Prevent clickjacking |\n| `X-XSS-Protection` | `0` | Disable legacy XSS filter (CSP handles this) |\n| `Referrer-Policy` | `strict-origin-when-cross-origin` | Control referrer information |\n| `Permissions-Policy` | Block most features (camera, microphone, geolocation, etc.) | Minimize attack surface |\n\n### BFF: Inline Security Headers in `Program.cs`\nLocation: the BFF project's `Program.cs`.\n\n**Environment-Dependent CSP:**\n- **Development**: Allows `unsafe-inline` for React HMR hot reload (`script-src 'self' 'unsafe-inline'`)\n- **Production**: Strict CSP matching API policy — NO `unsafe-inline`\n\n**Why no `unsafe-inline` in production:**\n- Pigment CSS is zero-runtime, CSP-compliant — no inline styles needed\n- React builds produce bundled JS files — no inline scripts needed\n- `unsafe-inline` defeats CSP protection against XSS\n\n### Host Header Validation\nBoth API and BFF implement `HostHeaderValidationMiddleware` to prevent host header injection attacks. Validates incoming `Host` header against an allowlist.\n\n---\n\n## Rate Limiting\n\n### Configuration (API `Program.cs`)\nUses `RateLimitPartition` with role-based policies partitioned by user OID. The per-role hourly\u002Fdaily limits are declared as **Auth Design** (§7 Rate Limiting) in the root `AGENTS.md` registry — do not restate the specific numbers here, they drift independently of this skill.\n\n### Implementation Rules\n- Partition key: User's OID from JWT claims\n- Policy names should be descriptive and role-based\n- Apply `[EnableRateLimiting(\"policy\")]` on controllers or endpoints\n- Never hardcode rate limit values — use configuration\n\n---\n\n## Authorization\n\n### Policies\nThe specific policy names, scope\u002Frole requirements, and client-isolation (`azp` claim) rules are declared as **Auth Design** (§5.2, §5.3, §6) in the root `AGENTS.md` registry — do not restate them here. In general: every endpoint requires an authenticated user; admin endpoints additionally require the admin scope, admin role, and client-isolation check.\n\n### Patterns\n```csharp\n\u002F\u002F Default: require authentication\n[Authorize]\npublic class MotorcycleController : ControllerBase\n\n\u002F\u002F Admin: require admin policy with client isolation\n[Authorize(Policy = \"mcr-api-admin\")]\npublic class WebSourcesAdminController : ControllerBase\n```\n\n---\n\n## Input Validation\n\n### Current Pattern: DataAnnotations\n```csharp\npublic class MotorcycleQueryRequest\n{\n    [Required]\n    [StringLength(1000)]\n    public string Query { get; set; }\n}\n```\n\n### Rules\n- **ALL** user inputs must be validated before processing\n- Use `[Required]`, `[StringLength]`, `[Range]` as minimum validation\n- For complex business rules, FluentValidation is acceptable\n- **NEVER** trust client-side validation alone\n- **NEVER** use raw user input in SQL — always parameterized (see `dapper-sql` skill)\n- **NEVER** render raw user input in HTML responses — always encode\n\n---\n\n## CORS Configuration\n\n### API CORS Policy\n- Explicit allowed origins (no wildcards in production)\n- Explicit allowed methods (`GET`, `POST`, `PUT`, `DELETE`)\n- Explicit allowed headers\n- `AllowCredentials()` only when specific origins are configured\n\n### Rules\n- **NEVER** use `AllowAnyOrigin()` with `AllowCredentials()`\n- **NEVER** use wildcard `*` origins in production\n- Origins come from configuration, not hardcoded\n\n---\n\n## Middleware Pipeline Order (CRITICAL)\n\nSecurity middleware MUST be ordered correctly in `Program.cs`:\n\n```\n1. UseSecurityHeaders()          \u002F\u002F First — applies to ALL responses\n2. UseHostHeaderValidation()     \u002F\u002F Early — reject bad hosts immediately\n3. UseHttpsRedirection()         \u002F\u002F Force HTTPS\n4. UseHsts()                     \u002F\u002F HSTS headers\n5. UseCors()                     \u002F\u002F CORS before auth\n6. UseAuthentication()           \u002F\u002F Authenticate\n7. UseAuthorization()            \u002F\u002F Authorize\n8. UseRateLimiter()              \u002F\u002F Rate limit after auth (needs user identity)\n9. MapControllers()              \u002F\u002F Endpoints last\n```\n\n---\n\n## Secrets Management (Reinforced)\n\n- **NEVER** store secrets in appsettings, code, or any committed file\n- Use `Environment.GetEnvironmentVariable()` or Azure Key Vault\n- Connection strings are secrets — environment variables only\n- Client secrets: environment variables (e.g., `MCR_BFF_CLIENT_SECRET`)\n- API keys: environment variables or Key Vault references\n\n---\n\n## Logging Security\n\n- **NEVER** log raw user queries, prompts, or search terms (PII)\n- **NEVER** log tokens, secrets, or connection strings\n- **ALWAYS** sanitize user input before logging (strip newlines, tabs)\n- **ALWAYS** use structured logging with placeholders: `_logger.LogInfo(\"User {UserId} action\", sanitizedId)`\n- **NEVER** use string concatenation in log messages\n\n---\n\n## MUST NOT\n- Add `unsafe-inline` or `unsafe-eval` to CSP in production\n- Disable HTTPS redirection or HSTS\n- Use wildcard CORS origins in production\n- Skip authorization on any endpoint that accesses data\n- Log sensitive data (tokens, secrets, PII, raw queries)\n- Trust client-side validation as the only validation layer\n\n## MUST DO\n- Include all security headers on every response\n- Validate host headers against allowlist\n- Apply rate limiting based on user identity and role\n- Validate `azp` claim on admin endpoints for client isolation\n- Validate all user inputs with DataAnnotations at minimum\n- Use parameterized queries for all database operations\n- Enforce HTTPS with HSTS preload\n- Follow correct middleware pipeline ordering\n","# CSP \u002F Security Headers \u002F OWASP ASVS L2 Patterns\n\n**Trigger:**\nThis skill MUST be loaded whenever working on:\n- Security headers, CSP policies, or HSTS configuration.\n- Rate limiting, throttling, or abuse prevention.\n- Authorization policies, `[Authorize]` attributes, or role-based access control.\n- Input validation, sanitization, or output encoding.\n- CORS configuration or cross-origin security.\n- Middleware pipeline ordering in `Program.cs`.\n- API or BFF endpoints, security middleware, or `Program.cs` pipeline ordering.\n\n---\n\n## Security Target: OWASP ASVS Level 2\n\nThis project targets **OWASP Application Security Verification Standard (ASVS) Level 2**. All security decisions must be evaluated against this standard.\n\n---\n\n## Security Headers Middleware\n\n### API: `SecurityHeadersMiddleware.cs`\nLocation: the API project's security-headers middleware (name it after the host's existing type).\n\n**Required Headers (all responses):**\n| Header | Value | Purpose |\n|---|---|---|\n| `Content-Security-Policy` | `default-src 'self'; script-src 'self'; style-src 'self'; img-src 'self' data:; font-src 'self'; connect-src 'self'; frame-ancestors 'none'; base-uri 'self'; form-action 'self'` | Strict CSP blocking external resources |\n| `Strict-Transport-Security` | `max-age=63072000; includeSubDomains; preload` | HSTS with 2-year max-age |\n| `X-Content-Type-Options` | `nosniff` | Prevent MIME sniffing |\n| `X-Frame-Options` | `DENY` | Prevent clickjacking |\n| `X-XSS-Protection` | `0` | Disable legacy XSS filter (CSP handles this) |\n| `Referrer-Policy` | `strict-origin-when-cross-origin` | Control referrer information |\n| `Permissions-Policy` | Block most features (camera, microphone, geolocation, etc.) | Minimize attack surface |\n\n### BFF: Inline Security Headers in `Program.cs`\nLocation: the BFF project's `Program.cs`.\n\n**Environment-Dependent CSP:**\n- **Development**: Allows `unsafe-inline` for React HMR hot reload (`script-src 'self' 'unsafe-inline'`)\n- **Production**: Strict CSP matching API policy — NO `unsafe-inline`\n\n**Why no `unsafe-inline` in production:**\n- Pigment CSS is zero-runtime, CSP-compliant — no inline styles needed\n- React builds produce bundled JS files — no inline scripts needed\n- `unsafe-inline` defeats CSP protection against XSS\n\n### Host Header Validation\nBoth API and BFF implement `HostHeaderValidationMiddleware` to prevent host header injection attacks. Validates incoming `Host` header against an allowlist.\n\n---\n\n## Rate Limiting\n\n### Configuration (API `Program.cs`)\nUses `RateLimitPartition` with role-based policies partitioned by user OID. The per-role hourly\u002Fdaily limits are declared as **Auth Design** (§7 Rate Limiting) in the root `AGENTS.md` registry — do not restate the specific numbers here, they drift independently of this skill.\n\n### Implementation Rules\n- Partition key: User's OID from JWT claims\n- Policy names should be descriptive and role-based\n- Apply `[EnableRateLimiting(\"policy\")]` on controllers or endpoints\n- Never hardcode rate limit values — use configuration\n\n---\n\n## Authorization\n\n### Policies\nThe specific policy names, scope\u002Frole requirements, and client-isolation (`azp` claim) rules are declared as **Auth Design** (§5.2, §5.3, §6) in the root `AGENTS.md` registry — do not restate them here. In general: every endpoint requires an authenticated user; admin endpoints additionally require the admin scope, admin role, and client-isolation check.\n\n### Patterns\n```csharp\n\u002F\u002F Default: require authentication\n[Authorize]\npublic class MotorcycleController : ControllerBase\n\n\u002F\u002F Admin: require admin policy with client isolation\n[Authorize(Policy = \"mcr-api-admin\")]\npublic class WebSourcesAdminController : ControllerBase\n```\n\n---\n\n## Input Validation\n\n### Current Pattern: DataAnnotations\n```csharp\npublic class MotorcycleQueryRequest\n{\n    [Required]\n    [StringLength(1000)]\n    public string Query { get; set; }\n}\n```\n\n### Rules\n- **ALL** user inputs must be validated before processing\n- Use `[Required]`, `[StringLength]`, `[Range]` as minimum validation\n- For complex business rules, FluentValidation is acceptable\n- **NEVER** trust client-side validation alone\n- **NEVER** use raw user input in SQL — always parameterized (see `dapper-sql` skill)\n- **NEVER** render raw user input in HTML responses — always encode\n\n---\n\n## CORS Configuration\n\n### API CORS Policy\n- Explicit allowed origins (no wildcards in production)\n- Explicit allowed methods (`GET`, `POST`, `PUT`, `DELETE`)\n- Explicit allowed headers\n- `AllowCredentials()` only when specific origins are configured\n\n### Rules\n- **NEVER** use `AllowAnyOrigin()` with `AllowCredentials()`\n- **NEVER** use wildcard `*` origins in production\n- Origins come from configuration, not hardcoded\n\n---\n\n## Middleware Pipeline Order (CRITICAL)\n\nSecurity middleware MUST be ordered correctly in `Program.cs`:\n\n```\n1. UseSecurityHeaders()          \u002F\u002F First — applies to ALL responses\n2. UseHostHeaderValidation()     \u002F\u002F Early — reject bad hosts immediately\n3. UseHttpsRedirection()         \u002F\u002F Force HTTPS\n4. UseHsts()                     \u002F\u002F HSTS headers\n5. UseCors()                     \u002F\u002F CORS before auth\n6. UseAuthentication()           \u002F\u002F Authenticate\n7. UseAuthorization()            \u002F\u002F Authorize\n8. UseRateLimiter()              \u002F\u002F Rate limit after auth (needs user identity)\n9. MapControllers()              \u002F\u002F Endpoints last\n```\n\n---\n\n## Secrets Management (Reinforced)\n\n- **NEVER** store secrets in appsettings, code, or any committed file\n- Use `Environment.GetEnvironmentVariable()` or Azure Key Vault\n- Connection strings are secrets — environment variables only\n- Client secrets: environment variables (e.g., `MCR_BFF_CLIENT_SECRET`)\n- API keys: environment variables or Key Vault references\n\n---\n\n## Logging Security\n\n- **NEVER** log raw user queries, prompts, or search terms (PII)\n- **NEVER** log tokens, secrets, or connection strings\n- **ALWAYS** sanitize user input before logging (strip newlines, tabs)\n- **ALWAYS** use structured logging with placeholders: `_logger.LogInfo(\"User {UserId} action\", sanitizedId)`\n- **NEVER** use string concatenation in log messages\n\n---\n\n## MUST NOT\n- Add `unsafe-inline` or `unsafe-eval` to CSP in production\n- Disable HTTPS redirection or HSTS\n- Use wildcard CORS origins in production\n- Skip authorization on any endpoint that accesses data\n- Log sensitive data (tokens, secrets, PII, raw queries)\n- Trust client-side validation as the only validation layer\n\n## MUST DO\n- Include all security headers on every response\n- Validate host headers against allowlist\n- Apply rate limiting based on user identity and role\n- Validate `azp` claim on admin endpoints for client isolation\n- Validate all user inputs with DataAnnotations at minimum\n- Use parameterized queries for all database operations\n- Enforce HTTPS with HSTS preload\n- Follow correct middleware pipeline ordering\n",{"name":5,"license":15,"description":7},"main","32aee4396c5407e3de876e39eb3c673739175d6b","products\u002Fkyber-squad\u002Fskills\u002Fcsp-security",3,"https:\u002F\u002Fgithub.com\u002Fdpalfery\u002Fkyber-weave","https:\u002F\u002Fgithub.com\u002Fdpalfery","www.palfery.com","Experienced technology leader with a strong background in cloud strategy, software development, and agile. Passionate about building scalable solutions","2026-11-15 05:04:11",{"source":8,"skillName":5,"commands":34,"prompt":44,"zipAvailable":45},[35,38,41],{"tool":36,"command":37},"npx","npx skills add dpalfery\u002Fkyber-weave --skill csp-security",{"tool":39,"command":40},"bunx","bunx skills add dpalfery\u002Fkyber-weave --skill csp-security",{"tool":42,"command":43},"pnpm","pnpm dlx skills add dpalfery\u002Fkyber-weave --skill csp-security","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fdpalfery\u002Fkyber-weave\u002Fblob\u002Fmain\u002Fproducts\u002Fkyber-squad\u002Fskills\u002Fcsp-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},"01M79S4SA2T3G081B5TBVSF8CV","pr-review","Use to run the pre-merge pull request review checklist so required validations are never skipped. Use when reviewing or approving a pull request before merge. Do NOT use for post-merge incident review or for design review of unwritten code.","https:\u002F\u002Fgithub.com\u002Fdpalfery\u002Fkyber-weave\u002Fblob\u002Fmain\u002Fsamples\u002Fskills\u002Fpr-review\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},"01M79S4PDPV6D0J22CJFDHKBTK","password-reset","Use to reset an employee's corporate account password following the IT security SOP. Use when a user reports they are locked out, forgot their password, or needs a password reset. Do NOT use for multi-factor authentication enrollment, shared\u002Fservice accounts, or external partner accounts.","https:\u002F\u002Fgithub.com\u002Fdpalfery\u002Fkyber-weave\u002Fblob\u002Fmain\u002Fsamples\u002Fskills\u002Fpassword-reset\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},"01M79S4K6M0AVKAYA97FKF8R4Y","incident-triage","Use to triage an incoming production incident report, classify its severity, and route it to the right on-call team. Use when someone reports an outage, degradation, or production error. Do NOT use for routine service requests, feature questions, or non-production environments.","https:\u002F\u002Fgithub.com\u002Fdpalfery\u002Fkyber-weave\u002Fblob\u002Fmain\u002Fsamples\u002Fskills\u002Fincident-triage\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},"01M79S4GC6M4N8646BRBQJ5WDR","expense-policy","Use as the reference manual for the corporate travel and expense policy covering per-diem limits, approval thresholds, and reimbursable categories. Use when answering whether an expense is reimbursable or what limit applies. Do NOT use to submit, approve, or modify expense reports.","https:\u002F\u002Fgithub.com\u002Fdpalfery\u002Fkyber-weave\u002Fblob\u002Fmain\u002Fsamples\u002Fskills\u002Fexpense-policy\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},"01M79S4E2DYDVK71GKZQWQFFCP","Vague_Helper","Helps with HR questions.","https:\u002F\u002Fgithub.com\u002Fdpalfery\u002Fkyber-weave\u002Fblob\u002Fmain\u002Fsamples\u002Fbad-skills\u002Fvague-helper\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},"01M79S4C13DDHBVF8P99APCSJ4","risky-skill","Use to format a customer record into the standard export template. Use when exporting a single customer record. Do NOT use for bulk exports.","https:\u002F\u002Fgithub.com\u002Fdpalfery\u002Fkyber-weave\u002Fblob\u002Fmain\u002Fsamples\u002Fbad-skills\u002Frisky-skill\u002FSKILL.md",[],[]]