用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
直接命令不会经过审查 Prompt;运行前请先检查来源。
npx skills add https://github.com/Hack23/cia --skill security-by-design命令会保持在同一行。复制前请横向滚动并检查完整内容。
想先保存到本地?可下载 SkillsMP 当前能够提供的文件。
Identity and access management: RBAC, least privilege, MFA, quarterly reviews per ISO 27001 A.5.15, A.8.2, A.8.3
Business continuity and disaster recovery: 30-day retention, quarterly restore tests, RTO/RPO targets per ISO 27001 A.17
Political psychology, cognitive biases, group dynamics, leadership analysis, decision-making patterns for Swedish political intelligence
基于 SOC 职业分类
正在显示 SKILL.md
| name | security-by-design |
| description | Threat modeling before coding, STRIDE methodology, defense in depth, security controls in SDLC |
| license | Apache-2.0 |
This skill integrates security into every phase of the CIA platform's software development lifecycle (SDLC). It ensures threats are identified and mitigated before code is written, following defense-in-depth principles aligned with Hack23 ISMS Secure Development Policy.
Apply this skill when:
Do NOT use for:
SDLC Phase Security Activity
│
├─ REQUIREMENTS
│ ├─ Identify security requirements (abuse cases)
│ ├─ Define data classification for new features
│ └─ Document compliance requirements (GDPR, NIS2)
│
├─ DESIGN
│ ├─ Threat model using STRIDE
│ ├─ Define trust boundaries
│ ├─ Select security controls
│ └─ Review architecture for defense in depth
│
├─ IMPLEMENTATION
│ ├─ Follow secure coding standards
│ ├─ Use approved libraries and frameworks
│ ├─ Implement input validation at boundaries
│ └─ Apply principle of least privilege
│
├─ TESTING
│ ├─ Security unit tests
│ ├─ SAST scanning (CodeQL, SonarCloud)
│ ├─ DAST scanning (ZAP)
│ └─ Dependency vulnerability check (OWASP)
│
├─ DEPLOYMENT
│ ├─ Security configuration review
│ ├─ Infrastructure hardening verification
│ ├─ Secrets management validation
│ └─ Monitoring and alerting setup
│
└─ MAINTENANCE
├─ Vulnerability patching cadence
├─ Security incident response
├─ Periodic threat model updates
└─ Dependency update reviews
Feature: [Name]
Data Classification: [PUBLIC/INTERNAL/CONFIDENTIAL/RESTRICTED]
Trust Boundary: [User→App / App→DB / App→ExternalAPI]
┌─────────────┬──────────────────────────────────────────┐
│ STRIDE │ Assessment │
├─────────────┼──────────────────────────────────────────┤
│ Spoofing │ Can an attacker impersonate a user? │
│ Tampering │ Can data be modified in transit/storage? │
│ Repudiation │ Can actions be denied without proof? │
│ Info Disc. │ Can sensitive data leak? │
│ DoS │ Can service be overwhelmed? │
│ Elev. Priv. │ Can a user gain unauthorized access? │
└─────────────┴──────────────────────────────────────────┘
Feature: Politician Risk Score Dashboard
Data Classification: INTERNAL
Trust Boundaries: Browser→Vaadin→Service→Database
Spoofing:
Threat: Unauthenticated access to risk scores
Control: Spring Security authentication required
Code: @PreAuthorize("hasRole('USER')")
Tampering:
Threat: Manipulation of risk score algorithm inputs
Control: Read-only database transactions for analysis
Code: @Transactional(readOnly = true)
Repudiation:
Threat: User denies viewing sensitive risk data
Control: Audit logging of all dashboard access
Code: AuditService.logAccess(userId, "RISK_DASHBOARD")
Information Disclosure:
Threat: Risk scores leaked to unauthorized users
Control: Role-based access, no client-side caching
Code: Cache-Control: no-store, Pragma: no-cache
Denial of Service:
Threat: Complex queries overloading database
Control: Query timeout, connection pool limits
Code: spring.datasource.hikari.connectionTimeout=30000
Elevation of Privilege:
Threat: Regular user accessing admin risk controls
Control: Method-level security annotations
Code: @Secured("ROLE_ADMIN")
Layer 1: NETWORK
├─ AWS VPC with private subnets
├─ Security groups (least privilege)
├─ WAF rules for common attacks
└─ DDoS protection (AWS Shield)
Layer 2: APPLICATION
├─ Spring Security filter chain
├─ CSRF protection enabled
├─ Content Security Policy headers
└─ Rate limiting per client
Layer 3: DATA
├─ Input validation at every boundary
├─ Parameterized queries (JPA/Hibernate)
├─ Output encoding (Vaadin auto-escapes)
└─ Encryption at rest (AES-256, KMS)
Layer 4: IDENTITY
├─ Strong authentication (bcrypt, cost 12)
├─ Role-based access control (RBAC)
├─ Session management (secure cookies)
└─ Principle of least privilege
Layer 5: MONITORING
├─ Security event logging (CloudWatch)
├─ Intrusion detection (GuardDuty)
├─ Vulnerability scanning (CodeQL, OWASP)
└─ Incident response procedures
Pre-Implementation:
□ Threat model completed (STRIDE)
□ Data classification assigned
□ Security requirements documented
□ Trust boundaries identified
During Implementation:
□ Input validation at all entry points
□ Output encoding for all user-displayed data
□ Authentication required for protected resources
□ Authorization checks at service layer
□ Parameterized queries for database access
□ Secrets managed via environment variables
□ Error messages don't leak internal details
□ Logging includes security-relevant events
Post-Implementation:
□ CodeQL scan passes with no high/critical findings
□ OWASP dependency check passes
□ Security unit tests written and passing
□ Code review with security focus completed
// ✅ Spring Security configuration with secure defaults
@Configuration
@EnableWebSecurity
public class SecurityConfig {
@Bean
public SecurityFilterChain filterChain(HttpSecurity http) throws Exception {
http
.headers(headers -> headers
.contentSecurityPolicy(csp -> csp
.policyDirectives("default-src 'self'"))
.frameOptions(frame -> frame.deny())
.httpStrictTransportSecurity(hsts -> hsts
.maxAgeInSeconds(31536000)
.includeSubDomains(true)))
.sessionManagement(session -> session
.sessionCreationPolicy(SessionCreationPolicy.IF_REQUIRED)
.maximumSessions(1))
.csrf(csrf -> csrf.csrfTokenRepository(
CookieCsrfTokenRepository.withHttpOnlyFalse()));
return http.build();
}
}
| Control | Requirement | Security-by-Design Activity |
|---|---|---|
| ISO 27001 A.8.25 | Secure development lifecycle | STRIDE per feature |
| ISO 27001 A.8.26 | Application security requirements | Security user stories |
| ISO 27001 A.8.28 | Secure coding | Approved coding patterns |
| NIST CSF PR.DS | Data security | Encryption by default |
| CIS Control 16 | Application software security | SAST/DAST in pipeline |
| NIS2 Art. 21 | Cybersecurity risk management | Threat modeling |