Security Baseline Controls
Skill Profile
(Select at least one profile to enable specific modules)
Overview
Minimum security controls every service must implement: authentication, authorization, input validation, secrets handling, and security headers that make system secure from day one.
Why This Matters
- Compliance: Meet SOC2, ISO27001, GDPR requirements
- Defense in depth: Multiple security layers
- Consistency: Same security posture across services
- Audit: Clear evidence of controls
Core Concepts & Rules
1. Core Principles
- Follow established patterns and conventions
- Maintain consistency across codebase
- Document decisions and trade-offs
2. Implementation Guidelines
- Start with the simplest viable solution
- Iterate based on feedback and requirements
- Test thoroughly before deployment
Inputs / Outputs / Contracts
- Inputs:
- <e.g., env vars, request payload, file paths, schema>
- Entry Conditions:
- <Pre-requisites: e.g., Repo initialized, DB running, specific branch checked out>
- Outputs:
- <e.g., artifacts (PR diff, docs, tests, dashboard JSON)>
- Artifacts Required (Deliverables):
- <e.g., Code Diff, Unit Tests, Migration Script, API Docs>
- Acceptance Evidence:
- <e.g., Test Report (screenshot/log), Benchmark Result, Security Scan Report>
- Success Criteria:
- <e.g., p95 < 300ms, coverage ≥ 80%>
Skill Composition
Quick Start
Assumptions
- Services need security baseline
- Authentication and authorization required
- Input validation necessary
- Secrets management system available
- Dependency scanning in CI/CD
- Compliance requirements (SOC2, ISO27001, GDPR)
Compatibility
- Node.js: 16+
- TypeScript: 4.5+
- Helmet: 7.0+
- JWT: jsonwebtoken 9.0+
- Zod: 3.0+ (for validation)
Test Scenario Matrix
| Scenario |
Input |
Expected Output |
Verification |
| Unauthenticated request |
Request without auth |
401 Unauthorized |
Response status |
| Invalid token |
Expired/invalid token |
401 Unauthorized |
Token validation |
| Invalid input |
Malformed input |
400 Bad Request |
Input validation |
| SQL injection |
SQL in input |
Sanitized/rejected |
No SQL injection |
| XSS attempt |
Script in input |
Escaped/sanitized |
No XSS execution |
Technical Guardrails
Agent Directives & Error Recovery
(ข้อกำหนดสำหรับ AI Agent ในการคิดและแก้ปัญหาเมื่อเกิดข้อผิดพลาด)
- Thinking Process: Analyze root cause before fixing. Do not brute-force.
- Fallback Strategy: Stop after 3 failed test attempts. Output root cause and ask for human intervention/clarification.
- Self-Review: Check against Guardrails & Anti-patterns before finalizing.
- Output Constraints: Output ONLY the modified code block. Do not explain unless asked.
Definition of Done
Security controls are complete when:
Anti-patterns
- Security as afterthought: Add security later
- Trust internal traffic: No service-to-service auth
- Log everything: Including secrets
- Ignore dependencies: Old vulnerable packages
- Over-logging: Log PII/credentials then say "will delete later" (can't do reliably)
Reference Links
Versioning & Changelog
- Version: 1.0.0
- Changelog:
- 2026-02-22: Initial version with complete template structure
Converted and distributed by TomeVault — claim your Tome and manage your conversions.
1---2name: amnadtaowsoam-cerebraskills-security-baseline-controls3description: Security Baseline Controls4---56# Security Baseline Controls78## Skill Profile9*(Select at least one profile to enable specific modules)*10- [ ] **DevOps**11- [x] **Backend**12- [ ] **Frontend**13- [ ] **AI-RAG**14- [ ] **Security Critical**1516## Overview17Minimum security controls every service must implement: authentication, authorization, input validation, secrets handling, and security headers that make system secure from day one.1819## Why This Matters20- **Compliance**: Meet SOC2, ISO27001, GDPR requirements21- **Defense in depth**: Multiple security layers22- **Consistency**: Same security posture across services23- **Audit**: Clear evidence of controls2425## Core Concepts & Rules2627### 1. Core Principles28- Follow established patterns and conventions29- Maintain consistency across codebase30- Document decisions and trade-offs3132### 2. Implementation Guidelines33- Start with the simplest viable solution34- Iterate based on feedback and requirements35- Test thoroughly before deployment363738## Inputs / Outputs / Contracts39* **Inputs**:40 - <e.g., env vars, request payload, file paths, schema>41* **Entry Conditions**:42 - <Pre-requisites: e.g., Repo initialized, DB running, specific branch checked out>43* **Outputs**:44 - <e.g., artifacts (PR diff, docs, tests, dashboard JSON)>45* **Artifacts Required (Deliverables)**:46 - <e.g., Code Diff, Unit Tests, Migration Script, API Docs>47* **Acceptance Evidence**:48 - <e.g., Test Report (screenshot/log), Benchmark Result, Security Scan Report>49* **Success Criteria**:50 - <e.g., p95 < 300ms, coverage ≥ 80%>5152## Skill Composition53* **Depends on**: [api-style-guide](./api-style-guide/SKILL.md), [secrets-key-management](../71-infrastructure-patterns/secrets-key-management/SKILL.md)54* **Compatible with**: [service-standards-blueprint](./service-standards-blueprint/SKILL.md), [logging-metrics-tracing-standard](./logging-metrics-tracing-standard/SKILL.md)55* **Conflicts with**: None56* **Related Skills**: [owasp-top-10](../../24-security-practices/owasp-top-10/SKILL.md), [security-audit](../../24-security-practices/security-audit/SKILL.md)5758## Quick Start59#6061## Assumptions62- Services need security baseline63- Authentication and authorization required64- Input validation necessary65- Secrets management system available66- Dependency scanning in CI/CD67- Compliance requirements (SOC2, ISO27001, GDPR)6869## Compatibility70- **Node.js**: 16+71- **TypeScript**: 4.5+72- **Helmet**: 7.0+73- **JWT**: jsonwebtoken 9.0+74- **Zod**: 3.0+ (for validation)7576## Test Scenario Matrix77| Scenario | Input | Expected Output | Verification |78|----------|-------|-----------------|--------------|79| Unauthenticated request | Request without auth | 401 Unauthorized | Response status |80| Invalid token | Expired/invalid token | 401 Unauthorized | Token validation |81| Invalid input | Malformed input | 400 Bad Request | Input validation |82| SQL injection | SQL in input | Sanitized/rejected | No SQL injection |83| XSS attempt | Script in input | Escaped/sanitized | No XSS execution |8485## Technical Guardrails86#8788## Agent Directives & Error Recovery89*(ข้อกำหนดสำหรับ AI Agent ในการคิดและแก้ปัญหาเมื่อเกิดข้อผิดพลาด)*9091- **Thinking Process**: Analyze root cause before fixing. Do not brute-force.92- **Fallback Strategy**: Stop after 3 failed test attempts. Output root cause and ask for human intervention/clarification.93- **Self-Review**: Check against Guardrails & Anti-patterns before finalizing.94- **Output Constraints**: Output ONLY the modified code block. Do not explain unless asked.959697## Definition of Done98Security controls are complete when:99100- [ ] Authentication on all endpoints (except health)101- [ ] Authorization checks for protected resources102- [ ] Input validation on all user inputs103- [ ] Security headers configured104- [ ] Secrets from secret manager (not env/code)105- [ ] Dependencies scanned for vulnerabilities106- [ ] Security audit logging enabled107- [ ] CSP configured for web apps108- [ ] HSTS enabled on production109- [ ] Regular security reviews scheduled110111## Anti-patterns1121. **Security as afterthought**: Add security later1132. **Trust internal traffic**: No service-to-service auth1143. **Log everything**: Including secrets1154. **Ignore dependencies**: Old vulnerable packages1165. **Over-logging**: Log PII/credentials then say "will delete later" (can't do reliably)117118## Reference Links119- [OWASP Top 10](https://owasp.org/www-project-top-ten/)120- [OWASP ASVS](https://owasp.org/www-project-application-security-verification-standard/)121- [Security Headers](https://securityheaders.com/)122- [Helmet Documentation](https://helmetjs.github.io/)123- [JWT Best Practices](https://tools.ietf.org/html/rfc8725)124125## Versioning & Changelog126127* **Version**: 1.0.0128* **Changelog**:129 - 2026-02-22: Initial version with complete template structure130131---132> Converted and distributed by [TomeVault](https://tomevault.io/claim/amnadtaowsoam) — claim your Tome and manage your conversions.133<!-- tomevault:4.0:skill_md:2026-04-13 -->