cc-codeconductor 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +324 -87
- package/dist/core/compilation/compile-checker.d.ts +2 -0
- package/dist/core/loop/loop-engine.d.ts +3 -0
- package/dist/index.js +2701 -577
- package/dist/library.js +167 -18
- package/dist/validation/schemas.d.ts +390 -44
- package/package.json +4 -1
- package/presets/agy/AGENTS.md +3 -0
- package/presets/agy/gates/pre-commit/GATE.md +5 -4
- package/presets/agy/skills/backlog/SKILL.md +91 -0
- package/presets/agy/skills/openspec/SKILL.md +5 -1
- package/presets/agy/skills/security-ai-llm/SKILL.md +43 -0
- package/presets/agy/skills/security-blue-team/SKILL.md +43 -0
- package/presets/agy/skills/security-cloud/SKILL.md +43 -0
- package/presets/agy/skills/security-crypto/SKILL.md +43 -0
- package/presets/agy/skills/security-exploit-dev/SKILL.md +45 -0
- package/presets/agy/skills/security-grc/SKILL.md +43 -0
- package/presets/agy/skills/security-incident-response/SKILL.md +45 -0
- package/presets/agy/skills/security-log-analysis/SKILL.md +43 -0
- package/presets/agy/skills/security-malware-analysis/SKILL.md +44 -0
- package/presets/agy/skills/security-mobile/SKILL.md +43 -0
- package/presets/agy/skills/security-network/SKILL.md +43 -0
- package/presets/agy/skills/security-ot-ics/SKILL.md +43 -0
- package/presets/agy/skills/security-recon/SKILL.md +45 -0
- package/presets/agy/skills/security-red-team/SKILL.md +44 -0
- package/presets/agy/skills/security-reverse-engineering/SKILL.md +44 -0
- package/presets/agy/skills/security-soc-automation/SKILL.md +43 -0
- package/presets/agy/skills/security-threat-hunting/SKILL.md +43 -0
- package/presets/agy/skills/security-vuln-assessment/SKILL.md +45 -0
- package/presets/agy/skills/security-web/SKILL.md +44 -0
- package/presets/agy/workflows/cc-ask.md +2 -1
- package/presets/agy/workflows/cc-backlog.md +69 -0
- package/presets/agy/workflows/cc-explore.md +1 -1
- package/presets/agy/workflows/cc-openspec.md +3 -1
- package/presets/agy/workflows/cc-security.md +180 -0
- package/presets/claude/CLAUDE.md +4 -0
- package/presets/claude/commands/cc/ask.md +2 -1
- package/presets/claude/commands/cc/backlog.md +104 -0
- package/presets/claude/commands/cc/explore.md +1 -1
- package/presets/claude/commands/cc/openspec.md +16 -1
- package/presets/claude/commands/cc/security.md +179 -0
- package/presets/claude/gates/pre-commit/GATE.md +5 -4
- package/presets/claude/skills/backlog/SKILL.md +91 -0
- package/presets/claude/skills/openspec/SKILL.md +5 -1
- package/presets/claude/skills/security/SKILL.md +382 -0
- package/presets/claude/skills/security-ai-llm/SKILL.md +43 -0
- package/presets/claude/skills/security-blue-team/SKILL.md +43 -0
- package/presets/claude/skills/security-cloud/SKILL.md +43 -0
- package/presets/claude/skills/security-crypto/SKILL.md +43 -0
- package/presets/claude/skills/security-exploit-dev/SKILL.md +45 -0
- package/presets/claude/skills/security-grc/SKILL.md +43 -0
- package/presets/claude/skills/security-incident-response/SKILL.md +45 -0
- package/presets/claude/skills/security-log-analysis/SKILL.md +43 -0
- package/presets/claude/skills/security-malware-analysis/SKILL.md +44 -0
- package/presets/claude/skills/security-mobile/SKILL.md +43 -0
- package/presets/claude/skills/security-network/SKILL.md +43 -0
- package/presets/claude/skills/security-ot-ics/SKILL.md +43 -0
- package/presets/claude/skills/security-recon/SKILL.md +45 -0
- package/presets/claude/skills/security-red-team/SKILL.md +44 -0
- package/presets/claude/skills/security-reverse-engineering/SKILL.md +44 -0
- package/presets/claude/skills/security-soc-automation/SKILL.md +43 -0
- package/presets/claude/skills/security-threat-hunting/SKILL.md +43 -0
- package/presets/claude/skills/security-vuln-assessment/SKILL.md +45 -0
- package/presets/claude/skills/security-web/SKILL.md +44 -0
- package/presets/codex/commands/cc-ask.md +2 -1
- package/presets/codex/gates/pre-commit/GATE.md +5 -4
- package/presets/cursor/AGENTS.md +2 -2
- package/presets/cursor/commands/cc/ask.md +2 -1
- package/presets/cursor/commands/cc/backlog.md +105 -0
- package/presets/cursor/commands/cc/explore.md +1 -1
- package/presets/cursor/commands/cc/openspec.md +16 -1
- package/presets/cursor/commands/cc/security.md +179 -0
- package/presets/cursor/gates/pre-commit/GATE.md +5 -4
- package/presets/cursor/skills/backlog/SKILL.md +91 -0
- package/presets/cursor/skills/openspec/SKILL.md +5 -1
- package/presets/cursor/skills/security-ai-llm/SKILL.md +43 -0
- package/presets/cursor/skills/security-blue-team/SKILL.md +43 -0
- package/presets/cursor/skills/security-cloud/SKILL.md +43 -0
- package/presets/cursor/skills/security-crypto/SKILL.md +43 -0
- package/presets/cursor/skills/security-exploit-dev/SKILL.md +45 -0
- package/presets/cursor/skills/security-grc/SKILL.md +43 -0
- package/presets/cursor/skills/security-incident-response/SKILL.md +45 -0
- package/presets/cursor/skills/security-log-analysis/SKILL.md +43 -0
- package/presets/cursor/skills/security-malware-analysis/SKILL.md +44 -0
- package/presets/cursor/skills/security-mobile/SKILL.md +43 -0
- package/presets/cursor/skills/security-network/SKILL.md +43 -0
- package/presets/cursor/skills/security-ot-ics/SKILL.md +43 -0
- package/presets/cursor/skills/security-recon/SKILL.md +45 -0
- package/presets/cursor/skills/security-red-team/SKILL.md +44 -0
- package/presets/cursor/skills/security-reverse-engineering/SKILL.md +44 -0
- package/presets/cursor/skills/security-soc-automation/SKILL.md +43 -0
- package/presets/cursor/skills/security-threat-hunting/SKILL.md +43 -0
- package/presets/cursor/skills/security-vuln-assessment/SKILL.md +45 -0
- package/presets/cursor/skills/security-web/SKILL.md +44 -0
- package/presets/opencode/commands/cc-ask.md +2 -1
- package/presets/opencode/commands/cc-backlog.md +68 -0
- package/presets/opencode/commands/cc-explore.md +1 -1
- package/presets/opencode/commands/cc-openspec.md +3 -1
- package/presets/opencode/commands/cc-security.md +179 -0
- package/presets/opencode/gates/pre-commit/GATE.md +5 -4
- package/presets/opencode/skills/backlog/SKILL.md +91 -0
- package/presets/opencode/skills/openspec/SKILL.md +5 -1
- package/presets/opencode/skills/security-ai-llm/SKILL.md +43 -0
- package/presets/opencode/skills/security-blue-team/SKILL.md +43 -0
- package/presets/opencode/skills/security-cloud/SKILL.md +43 -0
- package/presets/opencode/skills/security-crypto/SKILL.md +43 -0
- package/presets/opencode/skills/security-exploit-dev/SKILL.md +45 -0
- package/presets/opencode/skills/security-grc/SKILL.md +43 -0
- package/presets/opencode/skills/security-incident-response/SKILL.md +45 -0
- package/presets/opencode/skills/security-log-analysis/SKILL.md +43 -0
- package/presets/opencode/skills/security-malware-analysis/SKILL.md +44 -0
- package/presets/opencode/skills/security-mobile/SKILL.md +43 -0
- package/presets/opencode/skills/security-network/SKILL.md +43 -0
- package/presets/opencode/skills/security-ot-ics/SKILL.md +43 -0
- package/presets/opencode/skills/security-recon/SKILL.md +45 -0
- package/presets/opencode/skills/security-red-team/SKILL.md +44 -0
- package/presets/opencode/skills/security-reverse-engineering/SKILL.md +44 -0
- package/presets/opencode/skills/security-soc-automation/SKILL.md +43 -0
- package/presets/opencode/skills/security-threat-hunting/SKILL.md +43 -0
- package/presets/opencode/skills/security-vuln-assessment/SKILL.md +45 -0
- package/presets/opencode/skills/security-web/SKILL.md +44 -0
- package/src/presets/council/council.yml +12 -0
|
@@ -0,0 +1,382 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: security
|
|
3
|
+
version: 1.0.0
|
|
4
|
+
name: Security
|
|
5
|
+
description: >
|
|
6
|
+
Provides expert knowledge for implementing and reviewing application security following OWASP Top 10 (2021), with stack-specific patterns for Spring Boot, Django, Next.js, and Astro.
|
|
7
|
+
|
|
8
|
+
user-invokable: true
|
|
9
|
+
license: MIT
|
|
10
|
+
metadata:
|
|
11
|
+
author: lgzarturo
|
|
12
|
+
category: security
|
|
13
|
+
|
|
14
|
+
compatibility:
|
|
15
|
+
tools: [claude, codex, gemini, agy, opencode]
|
|
16
|
+
stacks:
|
|
17
|
+
languages: []
|
|
18
|
+
frameworks: []
|
|
19
|
+
|
|
20
|
+
risk:
|
|
21
|
+
level: high
|
|
22
|
+
can_execute_shell: false
|
|
23
|
+
can_modify_files: true
|
|
24
|
+
requires_network: false
|
|
25
|
+
|
|
26
|
+
inputs: []
|
|
27
|
+
|
|
28
|
+
outputs: []
|
|
29
|
+
|
|
30
|
+
quality:
|
|
31
|
+
reviewed_by: codeconductor-core
|
|
32
|
+
version: 0.1.0
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
# Security
|
|
38
|
+
|
|
39
|
+
## OWASP Top 10 (2021) — Quick Reference
|
|
40
|
+
|
|
41
|
+
| # | Category | What to check |
|
|
42
|
+
|---|----------|--------------|
|
|
43
|
+
| A01 | Broken Access Control | Is authorization enforced on every endpoint? |
|
|
44
|
+
| A02 | Cryptographic Failures | Are secrets encrypted at rest and in transit? |
|
|
45
|
+
| A03 | Injection | Is all input sanitized or parameterized? |
|
|
46
|
+
| A04 | Insecure Design | Is the threat model documented? |
|
|
47
|
+
| A05 | Security Misconfiguration | Are defaults changed? Debug off in prod? |
|
|
48
|
+
| A06 | Vulnerable Components | Are dependencies up to date? |
|
|
49
|
+
| A07 | Auth & Session Failures | Are sessions invalidated on logout? Token expiry set? |
|
|
50
|
+
| A08 | Software Integrity Failures | Are supply-chain dependencies verified? |
|
|
51
|
+
| A09 | Logging & Monitoring Failures | Are security events logged without leaking PII? |
|
|
52
|
+
| A10 | SSRF | Are outbound URLs allowlisted? |
|
|
53
|
+
|
|
54
|
+
## Input Validation
|
|
55
|
+
|
|
56
|
+
Validate all input at system boundaries. Never trust data from: HTTP request
|
|
57
|
+
body, query parameters, headers, cookies, or environment variables passed by
|
|
58
|
+
external systems.
|
|
59
|
+
|
|
60
|
+
**Rules:**
|
|
61
|
+
|
|
62
|
+
- Validate type, format, length, and range
|
|
63
|
+
- Reject unknown fields — do not silently ignore them
|
|
64
|
+
- Use allowlists (accept known-good), not blocklists (reject known-bad)
|
|
65
|
+
- Validate at the API layer before it reaches the service layer
|
|
66
|
+
|
|
67
|
+
```kotlin
|
|
68
|
+
// Spring Boot — Bean Validation
|
|
69
|
+
data class CreateUserRequest(
|
|
70
|
+
@field:NotBlank @field:Email val email: String,
|
|
71
|
+
@field:Size(min = 8, max = 72) val password: String,
|
|
72
|
+
@field:Size(max = 100) val name: String
|
|
73
|
+
)
|
|
74
|
+
|
|
75
|
+
@PostMapping
|
|
76
|
+
fun createUser(@Valid @RequestBody request: CreateUserRequest): ResponseEntity<UserResponse> {
|
|
77
|
+
// request is guaranteed valid here
|
|
78
|
+
}
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
```python
|
|
82
|
+
# Django REST Framework — serializer validation
|
|
83
|
+
class CreateUserSerializer(serializers.Serializer):
|
|
84
|
+
email = serializers.EmailField(max_length=254)
|
|
85
|
+
password = serializers.CharField(min_length=8, max_length=72, write_only=True)
|
|
86
|
+
name = serializers.CharField(max_length=100)
|
|
87
|
+
|
|
88
|
+
def validate_email(self, value):
|
|
89
|
+
if User.objects.filter(email=value).exists():
|
|
90
|
+
raise serializers.ValidationError("Email already registered.")
|
|
91
|
+
return value.lower()
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
```typescript
|
|
95
|
+
// Next.js / Astro — Zod
|
|
96
|
+
import { z } from 'zod';
|
|
97
|
+
|
|
98
|
+
const CreateUserSchema = z.object({
|
|
99
|
+
email: z.string().email().max(254),
|
|
100
|
+
password: z.string().min(8).max(72),
|
|
101
|
+
name: z.string().max(100),
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
const result = CreateUserSchema.safeParse(body);
|
|
105
|
+
if (!result.success) {
|
|
106
|
+
return Response.json({ error: result.error.flatten() }, { status: 400 });
|
|
107
|
+
}
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
## Authentication
|
|
111
|
+
|
|
112
|
+
### JWT (Stateless)
|
|
113
|
+
|
|
114
|
+
Use JWTs for stateless API authentication. Keep access tokens short-lived.
|
|
115
|
+
|
|
116
|
+
**Token lifetimes:**
|
|
117
|
+
|
|
118
|
+
| Token | Lifetime | Storage |
|
|
119
|
+
|-------|----------|---------|
|
|
120
|
+
| Access token | 15 minutes | Memory (never localStorage) |
|
|
121
|
+
| Refresh token | 7–30 days | HttpOnly cookie |
|
|
122
|
+
|
|
123
|
+
Never store access tokens in `localStorage` — XSS can read them. Store in
|
|
124
|
+
memory (React state, module variable) and refresh via the HttpOnly cookie.
|
|
125
|
+
|
|
126
|
+
```kotlin
|
|
127
|
+
// Spring Security 6 + JWT
|
|
128
|
+
@Configuration
|
|
129
|
+
@EnableWebSecurity
|
|
130
|
+
class SecurityConfig(private val jwtFilter: JwtAuthenticationFilter) {
|
|
131
|
+
|
|
132
|
+
@Bean
|
|
133
|
+
fun filterChain(http: HttpSecurity): SecurityFilterChain = http
|
|
134
|
+
.csrf { it.disable() } // stateless API — CSRF not needed
|
|
135
|
+
.sessionManagement { it.sessionCreationPolicy(SessionCreationPolicy.STATELESS) }
|
|
136
|
+
.authorizeHttpRequests { auth ->
|
|
137
|
+
auth
|
|
138
|
+
.requestMatchers("/api/auth/**").permitAll()
|
|
139
|
+
.requestMatchers("/api/admin/**").hasRole("ADMIN")
|
|
140
|
+
.anyRequest().authenticated()
|
|
141
|
+
}
|
|
142
|
+
.addFilterBefore(jwtFilter, UsernamePasswordAuthenticationFilter::class.java)
|
|
143
|
+
.build()
|
|
144
|
+
}
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
```python
|
|
148
|
+
# Django — djangorestframework-simplejwt
|
|
149
|
+
# settings.py
|
|
150
|
+
SIMPLE_JWT = {
|
|
151
|
+
"ACCESS_TOKEN_LIFETIME": timedelta(minutes=15),
|
|
152
|
+
"REFRESH_TOKEN_LIFETIME": timedelta(days=7),
|
|
153
|
+
"ROTATE_REFRESH_TOKENS": True,
|
|
154
|
+
"BLACKLIST_AFTER_ROTATION": True,
|
|
155
|
+
"ALGORITHM": "HS256",
|
|
156
|
+
"AUTH_HEADER_TYPES": ("Bearer",),
|
|
157
|
+
}
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
```typescript
|
|
161
|
+
// Next.js — Auth.js (NextAuth v5)
|
|
162
|
+
// auth.ts
|
|
163
|
+
import NextAuth from 'next-auth';
|
|
164
|
+
import Credentials from 'next-auth/providers/credentials';
|
|
165
|
+
|
|
166
|
+
export const { auth, signIn, signOut } = NextAuth({
|
|
167
|
+
providers: [
|
|
168
|
+
Credentials({
|
|
169
|
+
authorize: async (credentials) => {
|
|
170
|
+
// validate and return user or null
|
|
171
|
+
},
|
|
172
|
+
}),
|
|
173
|
+
],
|
|
174
|
+
session: { strategy: 'jwt', maxAge: 7 * 24 * 60 * 60 },
|
|
175
|
+
});
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
### Password Hashing
|
|
179
|
+
|
|
180
|
+
Never store plaintext passwords. Never use MD5 or SHA-1 for password hashing.
|
|
181
|
+
|
|
182
|
+
| Algorithm | Use | Work factor |
|
|
183
|
+
|-----------|-----|-------------|
|
|
184
|
+
| bcrypt | default | cost=12 |
|
|
185
|
+
| Argon2id | preferred when available | m=65536, t=3 |
|
|
186
|
+
| PBKDF2 | FIPS environments | iterations=600000 |
|
|
187
|
+
|
|
188
|
+
```kotlin
|
|
189
|
+
// Spring Security uses bcrypt by default
|
|
190
|
+
@Bean
|
|
191
|
+
fun passwordEncoder(): PasswordEncoder = BCryptPasswordEncoder(12)
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
```python
|
|
195
|
+
# Django uses PBKDF2 by default; switch to Argon2 for stronger hashing
|
|
196
|
+
# pip install django[argon2]
|
|
197
|
+
PASSWORD_HASHERS = [
|
|
198
|
+
"django.contrib.auth.hashers.Argon2PasswordHasher",
|
|
199
|
+
"django.contrib.auth.hashers.PBKDF2PasswordHasher", # fallback for existing hashes
|
|
200
|
+
]
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
## Authorization
|
|
204
|
+
|
|
205
|
+
**Principle of least privilege:** every endpoint must explicitly declare who
|
|
206
|
+
can access it. Deny by default.
|
|
207
|
+
|
|
208
|
+
```kotlin
|
|
209
|
+
// Spring — method-level security
|
|
210
|
+
@PreAuthorize("hasRole('ADMIN') or #userId == authentication.name")
|
|
211
|
+
fun getUser(userId: String): UserResponse { ... }
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
```python
|
|
215
|
+
# Django REST Framework
|
|
216
|
+
class UserDetailView(RetrieveUpdateAPIView):
|
|
217
|
+
permission_classes = [IsAuthenticated, IsOwnerOrAdmin]
|
|
218
|
+
queryset = User.objects.all()
|
|
219
|
+
|
|
220
|
+
class IsOwnerOrAdmin(BasePermission):
|
|
221
|
+
def has_object_permission(self, request, view, obj):
|
|
222
|
+
return request.user.is_staff or obj == request.user
|
|
223
|
+
```
|
|
224
|
+
|
|
225
|
+
Always check authorization at the **object level**, not just the endpoint
|
|
226
|
+
level. An authenticated user should not be able to access another user's data
|
|
227
|
+
by changing an ID in the URL.
|
|
228
|
+
|
|
229
|
+
## CORS
|
|
230
|
+
|
|
231
|
+
```kotlin
|
|
232
|
+
// Spring Boot — explicit allowlist; never use "*" in production
|
|
233
|
+
@Bean
|
|
234
|
+
fun corsConfigurationSource(): CorsConfigurationSource {
|
|
235
|
+
val config = CorsConfiguration().apply {
|
|
236
|
+
allowedOrigins = listOf("https://app.example.com")
|
|
237
|
+
allowedMethods = listOf("GET", "POST", "PUT", "DELETE")
|
|
238
|
+
allowedHeaders = listOf("Authorization", "Content-Type")
|
|
239
|
+
allowCredentials = true
|
|
240
|
+
maxAge = 3600L
|
|
241
|
+
}
|
|
242
|
+
return UrlBasedCorsConfigurationSource().apply {
|
|
243
|
+
registerCorsConfiguration("/api/**", config)
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
```python
|
|
249
|
+
# Django — django-cors-headers
|
|
250
|
+
CORS_ALLOWED_ORIGINS = [
|
|
251
|
+
"https://app.example.com",
|
|
252
|
+
]
|
|
253
|
+
CORS_ALLOW_CREDENTIALS = True
|
|
254
|
+
CORS_ALLOW_ALL_ORIGINS = False # never True in production
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
## Security Headers
|
|
258
|
+
|
|
259
|
+
Set these headers on every response. They defend against XSS, clickjacking,
|
|
260
|
+
and MIME sniffing.
|
|
261
|
+
|
|
262
|
+
```text
|
|
263
|
+
Strict-Transport-Security: max-age=63072000; includeSubDomains; preload
|
|
264
|
+
Content-Security-Policy: default-src 'self'; script-src 'self'; object-src 'none'
|
|
265
|
+
X-Frame-Options: DENY
|
|
266
|
+
X-Content-Type-Options: nosniff
|
|
267
|
+
Referrer-Policy: strict-origin-when-cross-origin
|
|
268
|
+
Permissions-Policy: camera=(), microphone=(), geolocation=()
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
```typescript
|
|
272
|
+
// Next.js — next.config.ts
|
|
273
|
+
const securityHeaders = [
|
|
274
|
+
{ key: 'X-Frame-Options', value: 'DENY' },
|
|
275
|
+
{ key: 'X-Content-Type-Options', value: 'nosniff' },
|
|
276
|
+
{ key: 'Referrer-Policy', value: 'strict-origin-when-cross-origin' },
|
|
277
|
+
{
|
|
278
|
+
key: 'Strict-Transport-Security',
|
|
279
|
+
value: 'max-age=63072000; includeSubDomains; preload',
|
|
280
|
+
},
|
|
281
|
+
];
|
|
282
|
+
|
|
283
|
+
export default {
|
|
284
|
+
headers: async () => [
|
|
285
|
+
{ source: '/(.*)', headers: securityHeaders },
|
|
286
|
+
],
|
|
287
|
+
};
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
## Secrets Management
|
|
291
|
+
|
|
292
|
+
**Never commit secrets to source control.** No exceptions.
|
|
293
|
+
|
|
294
|
+
```text
|
|
295
|
+
✗ DATABASE_URL = "postgres://user:password@prod.example.com/db" # in source
|
|
296
|
+
✓ DATABASE_URL = env("DATABASE_URL") # from environment
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
Rules:
|
|
300
|
+
|
|
301
|
+
- Load secrets from environment variables or a secrets manager (AWS Secrets
|
|
302
|
+
Manager, Vault, GCP Secret Manager)
|
|
303
|
+
- Rotate credentials on any suspected exposure
|
|
304
|
+
- Use separate credentials per environment (dev, staging, prod)
|
|
305
|
+
- Add `.env` to `.gitignore` and never commit it
|
|
306
|
+
|
|
307
|
+
```python
|
|
308
|
+
# Django — django-environ
|
|
309
|
+
import environ
|
|
310
|
+
env = environ.Env()
|
|
311
|
+
environ.Env.read_env() # reads .env in development only
|
|
312
|
+
|
|
313
|
+
SECRET_KEY = env("SECRET_KEY")
|
|
314
|
+
DATABASE_URL = env.db("DATABASE_URL")
|
|
315
|
+
```
|
|
316
|
+
|
|
317
|
+
## Rate Limiting
|
|
318
|
+
|
|
319
|
+
Protect authentication endpoints. Brute-force without rate limiting can
|
|
320
|
+
compromise any account with a weak password.
|
|
321
|
+
|
|
322
|
+
```kotlin
|
|
323
|
+
// Spring Boot — Bucket4j
|
|
324
|
+
@Component
|
|
325
|
+
class RateLimitFilter(private val rateLimiter: RateLimiter) : OncePerRequestFilter() {
|
|
326
|
+
|
|
327
|
+
override fun doFilterInternal(request: HttpServletRequest, response: HttpServletResponse, chain: FilterChain) {
|
|
328
|
+
if (request.requestURI.startsWith("/api/auth/")) {
|
|
329
|
+
val probe = rateLimiter.tryConsumeAndReturnRemaining(1)
|
|
330
|
+
if (!probe.isConsumed) {
|
|
331
|
+
response.status = HttpStatus.TOO_MANY_REQUESTS.value()
|
|
332
|
+
return
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
chain.doFilter(request, response)
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
Minimum rate limits for auth endpoints: 5 requests per minute per IP. Stricter
|
|
341
|
+
limits (e.g., 3 per 15 minutes) are better for login endpoints.
|
|
342
|
+
|
|
343
|
+
## SQL Injection Prevention
|
|
344
|
+
|
|
345
|
+
Never concatenate user input into SQL strings. Always use parameterized queries
|
|
346
|
+
or an ORM.
|
|
347
|
+
|
|
348
|
+
```kotlin
|
|
349
|
+
// bad — SQL injection risk
|
|
350
|
+
val user = jdbcTemplate.queryForObject("SELECT * FROM users WHERE email = '$email'")
|
|
351
|
+
|
|
352
|
+
// good — parameterized
|
|
353
|
+
val user = jdbcTemplate.queryForObject(
|
|
354
|
+
"SELECT * FROM users WHERE email = ?",
|
|
355
|
+
UserRowMapper(),
|
|
356
|
+
email
|
|
357
|
+
)
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
```python
|
|
361
|
+
# bad
|
|
362
|
+
User.objects.raw(f"SELECT * FROM users WHERE email = '{email}'")
|
|
363
|
+
|
|
364
|
+
# good — Django ORM handles parameterization automatically
|
|
365
|
+
User.objects.filter(email=email)
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
## Logging Security Events
|
|
369
|
+
|
|
370
|
+
Log authentication events without including sensitive data.
|
|
371
|
+
|
|
372
|
+
```text
|
|
373
|
+
Log: login success/failure, permission denied, password reset, token refresh
|
|
374
|
+
Never: passwords, tokens, PII (full email in prod logs), credit card numbers
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
```kotlin
|
|
378
|
+
// Log security events at INFO level; failures at WARN
|
|
379
|
+
log.info("Authentication successful for user={}", userId)
|
|
380
|
+
log.warn("Authentication failed: invalid credentials for user={}", maskedEmail)
|
|
381
|
+
log.warn("Authorization denied: user={} attempted access to resource={}", userId, resourceId)
|
|
382
|
+
```
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: security-ai-llm
|
|
3
|
+
description: >
|
|
4
|
+
Harden LLM and agent integrations you operate: prompt injection, tool allowlists, secret leakage, and supply-chain of models. Defensive only.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# AI / LLM Security
|
|
8
|
+
|
|
9
|
+
## Authorization
|
|
10
|
+
|
|
11
|
+
Use this skill only with **explicit written authorization** for a named
|
|
12
|
+
scope (systems, environments, and time window). If authorization is missing,
|
|
13
|
+
expired, or the request is for someone else's systems, **stop**.
|
|
14
|
+
|
|
15
|
+
This skill is **defensive and owner-authorized**. It does not authorize
|
|
16
|
+
offensive cyber operations.
|
|
17
|
+
|
|
18
|
+
## Do
|
|
19
|
+
|
|
20
|
+
- Treat model output as untrusted; never exec it without a schema
|
|
21
|
+
- Allowlist tools and paths; contain file writes
|
|
22
|
+
- Keep secrets out of prompts and logs
|
|
23
|
+
|
|
24
|
+
## Do not
|
|
25
|
+
|
|
26
|
+
- Help jailbreak third-party products or steal model weights
|
|
27
|
+
- Log raw user PII to prompt-debug stores
|
|
28
|
+
|
|
29
|
+
- Do not produce exploit payloads, malware, or attack procedures.
|
|
30
|
+
|
|
31
|
+
## How to Use
|
|
32
|
+
|
|
33
|
+
Load this skill from `/cc-security` when the Task Card domain is `security-ai-llm`.
|
|
34
|
+
Example prompts:
|
|
35
|
+
|
|
36
|
+
- `Review our agent tool runner for path traversal and unbounded shell.`
|
|
37
|
+
- `Add tests that a prompt cannot make the bot dump .env.`
|
|
38
|
+
|
|
39
|
+
## Integration
|
|
40
|
+
|
|
41
|
+
- Workflow: `/cc-security` (CCEP command `security`)
|
|
42
|
+
- Existing OWASP application-security skill remains `security` (not this id)
|
|
43
|
+
- High-risk changes still require `security-reviewer`
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: security-blue-team
|
|
3
|
+
description: >
|
|
4
|
+
Improve detections, hardening, and response for the estate you defend. Detection-as-code and control design, not offense.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Blue Team Defense
|
|
8
|
+
|
|
9
|
+
## Authorization
|
|
10
|
+
|
|
11
|
+
Use this skill only with **explicit written authorization** for a named
|
|
12
|
+
scope (systems, environments, and time window). If authorization is missing,
|
|
13
|
+
expired, or the request is for someone else's systems, **stop**.
|
|
14
|
+
|
|
15
|
+
This skill is **defensive and owner-authorized**. It does not authorize
|
|
16
|
+
offensive cyber operations.
|
|
17
|
+
|
|
18
|
+
## Do
|
|
19
|
+
|
|
20
|
+
- Tune detections for true positives; document exceptions
|
|
21
|
+
- Pair every new control with a test or canary
|
|
22
|
+
- Share hunt hypotheses with IR, not with the public internet
|
|
23
|
+
|
|
24
|
+
## Do not
|
|
25
|
+
|
|
26
|
+
- Disable EDR or logging to 'reduce noise' without a ticket
|
|
27
|
+
- Copy attacker malware into production 'for training'
|
|
28
|
+
|
|
29
|
+
- Do not produce exploit payloads, malware, or attack procedures.
|
|
30
|
+
|
|
31
|
+
## How to Use
|
|
32
|
+
|
|
33
|
+
Load this skill from `/cc-security` when the Task Card domain is `security-blue-team`.
|
|
34
|
+
Example prompts:
|
|
35
|
+
|
|
36
|
+
- `We missed a token-replay. Propose a detection plus a unit test for the API gateway.`
|
|
37
|
+
- `Harden CI: pin actions, require reviews on workflows that deploy.`
|
|
38
|
+
|
|
39
|
+
## Integration
|
|
40
|
+
|
|
41
|
+
- Workflow: `/cc-security` (CCEP command `security`)
|
|
42
|
+
- Existing OWASP application-security skill remains `security` (not this id)
|
|
43
|
+
- High-risk changes still require `security-reviewer`
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: security-cloud
|
|
3
|
+
description: >
|
|
4
|
+
Harden IAM, storage, keys, and org policies in cloud accounts you administer. Focus on identity, logging, and public-exposure controls.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Cloud Security
|
|
8
|
+
|
|
9
|
+
## Authorization
|
|
10
|
+
|
|
11
|
+
Use this skill only with **explicit written authorization** for a named
|
|
12
|
+
scope (systems, environments, and time window). If authorization is missing,
|
|
13
|
+
expired, or the request is for someone else's systems, **stop**.
|
|
14
|
+
|
|
15
|
+
This skill is **defensive and owner-authorized**. It does not authorize
|
|
16
|
+
offensive cyber operations.
|
|
17
|
+
|
|
18
|
+
## Do
|
|
19
|
+
|
|
20
|
+
- Prefer roles over long-lived keys; require MFA on human admins
|
|
21
|
+
- Block public buckets and overly broad IAM `*` unless justified
|
|
22
|
+
- Turn on cloud audit logs and retain them per policy
|
|
23
|
+
|
|
24
|
+
## Do not
|
|
25
|
+
|
|
26
|
+
- Disable logging or GuardDuty/Security Command Center 'to save cost' without a recorded exception
|
|
27
|
+
- Share account credentials in chat or tickets
|
|
28
|
+
|
|
29
|
+
- Do not produce exploit payloads, malware, or attack procedures.
|
|
30
|
+
|
|
31
|
+
## How to Use
|
|
32
|
+
|
|
33
|
+
Load this skill from `/cc-security` when the Task Card domain is `security-cloud`.
|
|
34
|
+
Example prompts:
|
|
35
|
+
|
|
36
|
+
- `Audit this AWS account's IAM: unused keys, admin wildcards, and public S3.`
|
|
37
|
+
- `Write a policy-as-code check that fails CI if a bucket ACL is public.`
|
|
38
|
+
|
|
39
|
+
## Integration
|
|
40
|
+
|
|
41
|
+
- Workflow: `/cc-security` (CCEP command `security`)
|
|
42
|
+
- Existing OWASP application-security skill remains `security` (not this id)
|
|
43
|
+
- High-risk changes still require `security-reviewer`
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: security-crypto
|
|
3
|
+
description: >
|
|
4
|
+
Choose and review cryptographic usage in your codebase: TLS, hashing, KMS, secret storage. Prefer standard libraries and vetted constructions.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Applied Cryptography
|
|
8
|
+
|
|
9
|
+
## Authorization
|
|
10
|
+
|
|
11
|
+
Use this skill only with **explicit written authorization** for a named
|
|
12
|
+
scope (systems, environments, and time window). If authorization is missing,
|
|
13
|
+
expired, or the request is for someone else's systems, **stop**.
|
|
14
|
+
|
|
15
|
+
This skill is **defensive and owner-authorized**. It does not authorize
|
|
16
|
+
offensive cyber operations.
|
|
17
|
+
|
|
18
|
+
## Do
|
|
19
|
+
|
|
20
|
+
- Use platform TLS and KMS; do not invent protocols
|
|
21
|
+
- Hash passwords with a memory-hard KDF; never roll your own
|
|
22
|
+
- Keep keys out of git; rotate on leak
|
|
23
|
+
|
|
24
|
+
## Do not
|
|
25
|
+
|
|
26
|
+
- Recommend ECB, MD5 for security, or home-grown ciphers
|
|
27
|
+
- Ask models to 'break' or weaken crypto for a CTF against third parties
|
|
28
|
+
|
|
29
|
+
- Do not produce exploit payloads, malware, or attack procedures.
|
|
30
|
+
|
|
31
|
+
## How to Use
|
|
32
|
+
|
|
33
|
+
Load this skill from `/cc-security` when the Task Card domain is `security-crypto`.
|
|
34
|
+
Example prompts:
|
|
35
|
+
|
|
36
|
+
- `Review how we store refresh tokens. Propose KMS envelope encryption and tests.`
|
|
37
|
+
- `Replace SHA-1 password hashes in this legacy module with a modern KDF and a migration plan.`
|
|
38
|
+
|
|
39
|
+
## Integration
|
|
40
|
+
|
|
41
|
+
- Workflow: `/cc-security` (CCEP command `security`)
|
|
42
|
+
- Existing OWASP application-security skill remains `security` (not this id)
|
|
43
|
+
- High-risk changes still require `security-reviewer`
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: security-exploit-dev
|
|
3
|
+
description: >
|
|
4
|
+
Understand how a confirmed vulnerability in an owned system is triggered so you can patch and test it. This is not exploit development for offense. No payloads, malware, or attack procedures.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Defensive Exploit Analysis (Authorized)
|
|
8
|
+
|
|
9
|
+
## Authorization
|
|
10
|
+
|
|
11
|
+
Use this skill only with **explicit written authorization** for a named
|
|
12
|
+
scope (systems, environments, and time window). If authorization is missing,
|
|
13
|
+
expired, or the request is for someone else's systems, **stop**.
|
|
14
|
+
|
|
15
|
+
This skill is **defensive and owner-authorized**. It does not authorize
|
|
16
|
+
offensive cyber operations.
|
|
17
|
+
|
|
18
|
+
## Do
|
|
19
|
+
|
|
20
|
+
- Describe the bug class (e.g. missing authz) at a design level
|
|
21
|
+
- Write a regression test that fails before the fix and passes after
|
|
22
|
+
- Prefer sanitizers, type systems, and least-privilege patches
|
|
23
|
+
- Stop and refuse if the user asks for a working exploit, PoC payload, or bypass kit
|
|
24
|
+
|
|
25
|
+
## Do not
|
|
26
|
+
|
|
27
|
+
- Write exploits, exploit PoCs, shellcode, or weaponized requests
|
|
28
|
+
- Document step-by-step attack procedures against any system
|
|
29
|
+
- Help with CTF flags, cracking, or unauthorized access
|
|
30
|
+
|
|
31
|
+
- Do not produce exploit payloads, malware, or attack procedures.
|
|
32
|
+
|
|
33
|
+
## How to Use
|
|
34
|
+
|
|
35
|
+
Load this skill from `/cc-security` when the Task Card domain is `security-exploit-dev`.
|
|
36
|
+
Example prompts:
|
|
37
|
+
|
|
38
|
+
- `We confirmed IDOR on /invoices/:id in our app. Help design the authz check and a RED test — no exploit.`
|
|
39
|
+
- `Turn this crash report from our fuzzer into a defensive patch and a regression test.`
|
|
40
|
+
|
|
41
|
+
## Integration
|
|
42
|
+
|
|
43
|
+
- Workflow: `/cc-security` (CCEP command `security`)
|
|
44
|
+
- Existing OWASP application-security skill remains `security` (not this id)
|
|
45
|
+
- High-risk changes still require `security-reviewer`
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: security-grc
|
|
3
|
+
description: >
|
|
4
|
+
Map controls to SOC2, ISO 27001, PCI, or internal policy for the org you work for. Evidence and control design — not audit theater.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# GRC / Compliance Engineering
|
|
8
|
+
|
|
9
|
+
## Authorization
|
|
10
|
+
|
|
11
|
+
Use this skill only with **explicit written authorization** for a named
|
|
12
|
+
scope (systems, environments, and time window). If authorization is missing,
|
|
13
|
+
expired, or the request is for someone else's systems, **stop**.
|
|
14
|
+
|
|
15
|
+
This skill is **defensive and owner-authorized**. It does not authorize
|
|
16
|
+
offensive cyber operations.
|
|
17
|
+
|
|
18
|
+
## Do
|
|
19
|
+
|
|
20
|
+
- Map each control to an owner, evidence path, and test
|
|
21
|
+
- Prefer automated evidence (CI, IaC, tickets) over screenshots
|
|
22
|
+
- Record exceptions with expiry dates
|
|
23
|
+
|
|
24
|
+
## Do not
|
|
25
|
+
|
|
26
|
+
- Fabricate evidence or backdate approvals
|
|
27
|
+
- Copy another company's policies without legal review
|
|
28
|
+
|
|
29
|
+
- Do not produce exploit payloads, malware, or attack procedures.
|
|
30
|
+
|
|
31
|
+
## How to Use
|
|
32
|
+
|
|
33
|
+
Load this skill from `/cc-security` when the Task Card domain is `security-grc`.
|
|
34
|
+
Example prompts:
|
|
35
|
+
|
|
36
|
+
- `Map our GitHub branch protection to SOC2 CC6.6 and list evidence.`
|
|
37
|
+
- `List gaps: secrets in git, missing MFA on GitHub org owners.`
|
|
38
|
+
|
|
39
|
+
## Integration
|
|
40
|
+
|
|
41
|
+
- Workflow: `/cc-security` (CCEP command `security`)
|
|
42
|
+
- Existing OWASP application-security skill remains `security` (not this id)
|
|
43
|
+
- High-risk changes still require `security-reviewer`
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: security-incident-response
|
|
3
|
+
description: >
|
|
4
|
+
Coordinate containment, eradication, and recovery for an authorized incident. Preserve evidence, communicate facts, and avoid destructive actions without approval.
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Incident Response
|
|
8
|
+
|
|
9
|
+
## Authorization
|
|
10
|
+
|
|
11
|
+
Use this skill only with **explicit written authorization** for a named
|
|
12
|
+
scope (systems, environments, and time window). If authorization is missing,
|
|
13
|
+
expired, or the request is for someone else's systems, **stop**.
|
|
14
|
+
|
|
15
|
+
This skill is **defensive and owner-authorized**. It does not authorize
|
|
16
|
+
offensive cyber operations.
|
|
17
|
+
|
|
18
|
+
## Do
|
|
19
|
+
|
|
20
|
+
- Follow the org IR plan: detect, contain, eradicate, recover, lessons
|
|
21
|
+
- Preserve logs and disk images before reboot or wipe
|
|
22
|
+
- Redact secrets from tickets and chat
|
|
23
|
+
- Track timeline, systems, and decision-makers
|
|
24
|
+
|
|
25
|
+
## Do not
|
|
26
|
+
|
|
27
|
+
- Wipe systems before evidence capture unless imminent ransomware spread is approved
|
|
28
|
+
- Blame individuals in the working notes; stick to systems and facts
|
|
29
|
+
- Reuse attacker tooling from the incident as a 'test'
|
|
30
|
+
|
|
31
|
+
- Do not produce exploit payloads, malware, or attack procedures.
|
|
32
|
+
|
|
33
|
+
## How to Use
|
|
34
|
+
|
|
35
|
+
Load this skill from `/cc-security` when the Task Card domain is `security-incident-response`.
|
|
36
|
+
Example prompts:
|
|
37
|
+
|
|
38
|
+
- `P1: suspected token theft on api-prod. Draft containment and evidence steps for the IR commander.`
|
|
39
|
+
- `After containment, write the lessons-learned outline and the regression tests we should add.`
|
|
40
|
+
|
|
41
|
+
## Integration
|
|
42
|
+
|
|
43
|
+
- Workflow: `/cc-security` (CCEP command `security`)
|
|
44
|
+
- Existing OWASP application-security skill remains `security` (not this id)
|
|
45
|
+
- High-risk changes still require `security-reviewer`
|