[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M7AVG37PZ77CF35KAR6E93ZJ":3,"skill-same:01M7AVG37PZ77CF35KAR6E93ZJ":44},{"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":14,"repositoryHtmlUrl":27,"repositoryHomepageUrl":6,"ownerHtmlUrl":28,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":29,"install":30,"resources":43},"01M7AVG37PZ77CF35KAR6E93ZJ","security-and-hardening",null,"Use when auditing security, implementing authentication or authorization, handling secrets, or validating data across external trust boundaries.","MinhDuyDEV\u002Fmd-pikit","MinhDuyDEV","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F94704296?v=4","01M7AVDRJB5JM5VG5B6K49X0EZ","Nguyễn Viết Minh Duy","01M7AVDRKDB3JPGHFE4HGK1Z5M",0,"MIT","https:\u002F\u002Fgithub.com\u002FMinhDuyDEV\u002Fmd-pikit\u002Fblob\u002Fmain\u002F.pi\u002Fskills\u002Fsecurity-and-hardening\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: security-and-hardening\ndescription: Use when auditing security, implementing authentication or authorization, handling secrets, or validating data across external trust boundaries.\n---\n\n# Security and Hardening\n\n## Iron Laws\n\n\u003CEXTREMELY-IMPORTANT>\n- **Validate every external boundary.** Decode `unknown` into a trusted domain type.\n- **Authn is not authz.** Identity never implies permission.\n- **Deny and minimize by default.** Least privilege, short retention, explicit access.\n- **Secrets never enter code, logs, or git.**\n- **Use layered controls.** Application checks and persistence constraints cover different failures.\n\u003C\u002FEXTREMELY-IMPORTANT>\n\n## Boundary Matrix\n\n| Boundary | Required control |\n| --- | --- |\n| HTTP path\u002Fquery\u002Fbody | Schema decode, limits, reject unknown fields |\n| Job queue message | Versioned schema; never assume the producer validated |\n| User file or third-party response | Treat as untrusted bytes\u002Fdata |\n| Config \u002F env | Validate presence, type, range, and allowed values at startup |\n| DB read into a domain type | Validate current invariants; stored data may be stale |\n| Internal typed function call | Trust types unless the call changes trust\u002Fdomain |\n| Database write | Parameterized query plus database constraints (`NOT NULL`, `UNIQUE`, `CHECK`, FK) |\n\nValidate at boundaries, not randomly inside business logic. Service code enforces domain preconditions; the database protects invariants and races. Return validation failures as typed errors, not unclassified exceptions.\n\n## Security Controls\n\n- **Injection:** parameterized queries; never concatenate untrusted SQL or shell input.\n- **Authentication:** Argon2\u002Fbcrypt, MFA where sensitive, rate limit by account and IP.\n- **Sessions:** random signed identifiers, `httpOnly`, `secure`, short expiry, refresh rotation.\n- **Authorization:** check every action and object; test that user A cannot access user B.\n- **XSS\u002FCSRF:** output encoding, CSP, safe templating, appropriate same-site\u002FCSRF protection.\n- **Dependencies:** lock versions, review advisories and major upgrades; do not apply audit fixes blindly.\n- **Logging:** record failed auth, denials, and anomalous access; redact credentials and tokens.\n- **Headers:** HSTS, CSP, `nosniff`, frame protection, and restrictive referrer policy.\n\n## Secrets\n\nUse local environment variables, CI secret stores, and a production vault. Rotate on exposure. Never print secrets during debugging or transmit them to tools without explicit authorization.\n\n## Verification\n\nTest negative paths: malformed boundary input, missing permission, cross-tenant access, replay\u002Frate-limit behavior, invalid queue payload, invalid environment configuration, and persistence constraint violations.\n\n## Red Flags\n\n`as any` at a boundary; trusting frontend IDs; validation only in the controller; unvalidated queue\u002FDB\u002Fenv data; plaintext or fast-hashed passwords; permissive CORS; secrets in logs; default credentials; auth “later”; database invariants enforced only in application code.\n","# Security and Hardening\n\n## Iron Laws\n\n\u003CEXTREMELY-IMPORTANT>\n- **Validate every external boundary.** Decode `unknown` into a trusted domain type.\n- **Authn is not authz.** Identity never implies permission.\n- **Deny and minimize by default.** Least privilege, short retention, explicit access.\n- **Secrets never enter code, logs, or git.**\n- **Use layered controls.** Application checks and persistence constraints cover different failures.\n\u003C\u002FEXTREMELY-IMPORTANT>\n\n## Boundary Matrix\n\n| Boundary | Required control |\n| --- | --- |\n| HTTP path\u002Fquery\u002Fbody | Schema decode, limits, reject unknown fields |\n| Job queue message | Versioned schema; never assume the producer validated |\n| User file or third-party response | Treat as untrusted bytes\u002Fdata |\n| Config \u002F env | Validate presence, type, range, and allowed values at startup |\n| DB read into a domain type | Validate current invariants; stored data may be stale |\n| Internal typed function call | Trust types unless the call changes trust\u002Fdomain |\n| Database write | Parameterized query plus database constraints (`NOT NULL`, `UNIQUE`, `CHECK`, FK) |\n\nValidate at boundaries, not randomly inside business logic. Service code enforces domain preconditions; the database protects invariants and races. Return validation failures as typed errors, not unclassified exceptions.\n\n## Security Controls\n\n- **Injection:** parameterized queries; never concatenate untrusted SQL or shell input.\n- **Authentication:** Argon2\u002Fbcrypt, MFA where sensitive, rate limit by account and IP.\n- **Sessions:** random signed identifiers, `httpOnly`, `secure`, short expiry, refresh rotation.\n- **Authorization:** check every action and object; test that user A cannot access user B.\n- **XSS\u002FCSRF:** output encoding, CSP, safe templating, appropriate same-site\u002FCSRF protection.\n- **Dependencies:** lock versions, review advisories and major upgrades; do not apply audit fixes blindly.\n- **Logging:** record failed auth, denials, and anomalous access; redact credentials and tokens.\n- **Headers:** HSTS, CSP, `nosniff`, frame protection, and restrictive referrer policy.\n\n## Secrets\n\nUse local environment variables, CI secret stores, and a production vault. Rotate on exposure. Never print secrets during debugging or transmit them to tools without explicit authorization.\n\n## Verification\n\nTest negative paths: malformed boundary input, missing permission, cross-tenant access, replay\u002Frate-limit behavior, invalid queue payload, invalid environment configuration, and persistence constraint violations.\n\n## Red Flags\n\n`as any` at a boundary; trusting frontend IDs; validation only in the controller; unvalidated queue\u002FDB\u002Fenv data; plaintext or fast-hashed passwords; permissive CORS; secrets in logs; default credentials; auth “later”; database invariants enforced only in application code.\n",{"name":5,"description":7},"main","01207a96514af9f9c4d7d6cb594b936c6a9ddb10",".pi\u002Fskills\u002Fsecurity-and-hardening","https:\u002F\u002Fgithub.com\u002FMinhDuyDEV\u002Fmd-pikit","https:\u002F\u002Fgithub.com\u002FMinhDuyDEV","2026-08-20 02:00:33",{"source":8,"skillName":5,"commands":31,"prompt":41,"zipAvailable":42},[32,35,38],{"tool":33,"command":34},"npx","npx skills add MinhDuyDEV\u002Fmd-pikit --skill security-and-hardening",{"tool":36,"command":37},"bunx","bunx skills add MinhDuyDEV\u002Fmd-pikit --skill security-and-hardening",{"tool":39,"command":40},"pnpm","pnpm dlx skills add MinhDuyDEV\u002Fmd-pikit --skill security-and-hardening","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FMinhDuyDEV\u002Fmd-pikit\u002Fblob\u002Fmain\u002F.pi\u002Fskills\u002Fsecurity-and-hardening\u002FSKILL.md",true,[],[45,52,59,66,73,80],{"skillNo":46,"name":47,"nameZh":6,"description":48,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":49,"categories":50,"keywords":51,"publishedAt":19},"01M7AVGJR1RSRVA3VJT8ZW4Y27","writing-skills","Use when creating new skills, editing existing skills, or verifying skills work before deployment - applies TDD to process documentation by testing with subagents before writing, iterating until bulletproof against rationalization. Includes complete pressure testing methodology.","https:\u002F\u002Fgithub.com\u002FMinhDuyDEV\u002Fmd-pikit\u002Fblob\u002Fmain\u002F.pi\u002Fskills\u002Fwriting-skills\u002FSKILL.md",[],[],{"skillNo":53,"name":54,"nameZh":6,"description":55,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":56,"categories":57,"keywords":58,"publishedAt":19},"01M7AVGE076BNB3J7JDBGAKD2T","verification-before-completion","Use when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions always","https:\u002F\u002Fgithub.com\u002FMinhDuyDEV\u002Fmd-pikit\u002Fblob\u002Fmain\u002F.pi\u002Fskills\u002Fverification-before-completion\u002FSKILL.md",[],[],{"skillNo":60,"name":61,"nameZh":6,"description":62,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":63,"categories":64,"keywords":65,"publishedAt":19},"01M7AVGAYJ6APXRB9QWBG7482S","typescript-coding-standards","Use when writing, refactoring, or reviewing TypeScript code that needs strong domain modeling, typed errors, schema parsing, safe adapters, test seams, or maintainable module boundaries.","https:\u002F\u002Fgithub.com\u002FMinhDuyDEV\u002Fmd-pikit\u002Fblob\u002Fmain\u002F.pi\u002Fskills\u002Ftypescript-coding-standards\u002FSKILL.md",[],[],{"skillNo":67,"name":68,"nameZh":6,"description":69,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":70,"categories":71,"keywords":72,"publishedAt":19},"01M7AVG8CE5BTR2CRFPHHVJCJZ","test-driven-development","Use when implementing a feature, bugfix, or behavior-changing refactor — require a failing behavior test before production code, then make the smallest change that passes.","https:\u002F\u002Fgithub.com\u002FMinhDuyDEV\u002Fmd-pikit\u002Fblob\u002Fmain\u002F.pi\u002Fskills\u002Ftest-driven-development\u002FSKILL.md",[],[],{"skillNo":74,"name":75,"nameZh":6,"description":76,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":77,"categories":78,"keywords":79,"publishedAt":19},"01M7AVG5FJH3WTG9XR2G0608ND","source-driven-development","Use when unfamiliar libraries, dependency internals, external APIs, framework behavior, migrations, or current ecosystem guidance require official documentation, version-matched source, read the tests, and cited evidence.","https:\u002F\u002Fgithub.com\u002FMinhDuyDEV\u002Fmd-pikit\u002Fblob\u002Fmain\u002F.pi\u002Fskills\u002Fsource-driven-development\u002FSKILL.md",[],[],{"skillNo":81,"name":82,"nameZh":6,"description":83,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":84,"categories":85,"keywords":86,"publishedAt":19},"01M7AVG0HSKDA2Q23AEWDT8TNS","prototype","Use when the user wants to prototype, sanity-check a data model or state machine, mock up a UI, explore design options, or says \"prototype this\", \"let me play with it\", \"try a few designs\".","https:\u002F\u002Fgithub.com\u002FMinhDuyDEV\u002Fmd-pikit\u002Fblob\u002Fmain\u002F.pi\u002Fskills\u002Fprototype\u002FSKILL.md",[],[]]