| type | skill |
| lifecycle | stable |
| inheritance | inheritable |
| name | distribution-security |
| description | Defense-in-depth, PII protection, secrets scanning, and secure packaging for distributed software |
| tier | standard |
| applyTo | **/*distribution*,**/*security* |
| currency | 2026-04-22T00:00:00.000Z |
| lastReviewed | 2026-04-30T00:00:00.000Z |
Distribution Security
Multi-layer security for software that ships to users — secrets scanning, permission minimization, and secure UI patterns.
Scope: Inheritable skill. Covers defense-in-depth architecture, PII protection, secrets scanning, permission minimization, CSP patterns, and secure WebView communication.
Defense-in-Depth Architecture
4-Layer Security Model
Every distributed application needs four independent security layers:
| Layer | Function | Failure Mode |
|---|
| 1. Authentication | Verify identity (OAuth, MSAL, API keys) | Unauthorized access |
| 2. Authorization | Role-based access control (RBAC) | Privilege escalation |
| 3. Secrets Scanning | Detect leaked credentials in source | Data breach |
| 4. Audit Logging | Record all security-relevant events | Undetected compromise |
Rule: Each layer must work independently. A failure in Layer 1 should not cascade — Layer 2 still blocks unauthorized actions, Layer 3 still catches leaked keys, Layer 4 still records the attempt.
PII Protection
3-Layer Exclusion Model
For projects that package and distribute source files:
| Layer | Implementation | Catches |
|---|
1. .gitignore | Exclude from version control | Personal config, local data |
2. .vscodeignore / build exclusions | Exclude from package | Dev-only files, test data |
| 3. Build pipeline scan | Regex validation gate | Anything layers 1-2 missed |
Personal Data Rules
| Location | Allowed? | Alternative |
|---|
| Source code headers | No | Use team/org name |
package.json author | Org name only |