hero-mmt-kit 1.0.0 → 1.1.1
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/CHANGELOG.md +32 -0
- package/README.md +143 -158
- package/bin/hero-mmt-kit.js +0 -1
- package/package.json +2 -3
- package/skills.manifest.json +72 -72
- package/src/doctor.cjs +22 -27
- package/src/init.cjs +3 -25
- package/src/integrations.cjs +1 -1
- package/src/skills.cjs +1 -1
- package/src/update.cjs +1 -9
- package/templates/common/.claude/hooks/active-state-bridge.cjs +58 -0
- package/templates/common/.claude/hooks/git-guard.cjs +60 -20
- package/templates/common/.claude/hooks/stop-reminder.cjs +3 -11
- package/templates/common/.claude/settings.json +2 -3
- package/templates/docs/ACTIVE_STATE.md +6 -8
- package/templates/docs/SECURITY_STANDARDS.md +1 -1
- package/templates/skills/NOTICE +6 -3
- package/templates/skills/executing-plans/SKILL.md +4 -5
- package/templates/skills/hero-coding/SKILL.md +7 -7
- package/templates/skills/hero-planning/SKILL.md +7 -12
- package/templates/skills/hero-report/SKILL.md +46 -0
- package/templates/skills/hero-reviewing/SKILL.md +9 -6
- package/templates/skills/hero-security/SKILL.md +427 -425
- package/templates/skills/hero-strict/SKILL.md +5 -5
- package/templates/skills/hero-unit-test/SKILL.md +9 -10
- package/templates/skills/requesting-code-review/SKILL.md +1 -1
- package/templates/skills/subagent-driven-development/SKILL.md +0 -1
- package/templates/skills/using-git-worktrees/SKILL.md +0 -2
- package/templates/skills/using-hero/SKILL.md +16 -10
- package/templates/skills/writing-plans/SKILL.md +2 -2
- package/presets/enterprise.json +0 -3
- package/presets/small-team.json +0 -3
- package/presets/solo.json +0 -3
- package/src/workflow-state.cjs +0 -65
- package/templates/.hero-mmt-kit/session.schema.json +0 -15
- package/templates/common/.claude/hooks/session-bridge.cjs +0 -43
- package/templates/skills/finishing-a-development-branch/SKILL.md +0 -253
|
@@ -1,425 +1,427 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: hero-security
|
|
3
|
-
description: Use when you want an independent OWASP + AI/LLM security review or release gate of changed code, plans, configuration, or sensitive surfaces
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Hero Security
|
|
7
|
-
|
|
8
|
-
## Overview
|
|
9
|
-
|
|
10
|
-
hero-security is a standalone security
|
|
11
|
-
|
|
12
|
-
**Core principle:** inspect attack surfaces explicitly, map controls to the reviewed scope, report uncertainty honestly, and never claim a surface is safe if it was not reviewed.
|
|
13
|
-
|
|
14
|
-
## Outcome
|
|
15
|
-
|
|
16
|
-
Produce a security output that is actionable and auditable:
|
|
17
|
-
- Risk-ranked findings or required controls mapped to the reviewed scope.
|
|
18
|
-
- Required controls versus recommended hardening.
|
|
19
|
-
- Verification checklist with pass/fail criteria.
|
|
20
|
-
- Residual risks, owners, and follow-up actions.
|
|
21
|
-
- A release verdict when the review is used as a gate.
|
|
22
|
-
|
|
23
|
-
## When to Use
|
|
24
|
-
|
|
25
|
-
Use this skill when:
|
|
26
|
-
- The user explicitly asks for security, OWASP, compliance, abuse-case, hardening, threat modeling, vulnerability review, remediation planning, or release-gate review.
|
|
27
|
-
- The task touches authentication, authorization, auth/authz boundaries, sessions, secrets, payments, personal data, regulated data, tenant isolation, uploads, file paths, network calls, webhooks, permissions, deployment, infrastructure, mobile apps, database access, API exposure, dependency changes, or supply-chain behavior.
|
|
28
|
-
- `gitnexus_impact` or project policy marks the change as HIGH/CRITICAL or security-sensitive.
|
|
29
|
-
- A Full path feature reaches QA or pre-merge review.
|
|
30
|
-
- The feature includes AI/assistant behavior, AI-assisted coding, AI runtime features, tool use, retrieval/RAG, prompt construction, generated code, or user-supplied instructions.
|
|
31
|
-
|
|
32
|
-
This skill is intentionally independent: `hero-coding`, `hero-reviewing`, and `hero-strict` may recommend running it, but they do not own or embed the security pass.
|
|
33
|
-
|
|
34
|
-
## Inputs
|
|
35
|
-
|
|
36
|
-
Read artifact-first:
|
|
37
|
-
1. Planning artifact / PRD / technical design, if present.
|
|
38
|
-
2. Execution handoff, coding report, or implementation summary, if present.
|
|
39
|
-
3. The current diff and relevant changed files.
|
|
40
|
-
4. `docs/SECURITY_STANDARDS.md` and any existing threat model or project conventions.
|
|
41
|
-
5. Test/build/security-tool evidence that already exists.
|
|
42
|
-
6. System scope: feature, endpoints, services, clients, data stores, background jobs, and admin/internal surfaces.
|
|
43
|
-
7. Stack: language, framework, database, infrastructure, identity provider, and deployment model.
|
|
44
|
-
8. Data class: public, internal, sensitive, regulated, secrets, credentials, tokens, or tenant data.
|
|
45
|
-
9. Exposure: internal only, partner, internet-facing, mobile, webhook, or model/tool-facing.
|
|
46
|
-
10. Identity model and account types: SSO, OAuth2/OIDC, session, API key, customer, employee, admin, privileged, or service account.
|
|
47
|
-
11. Optional modules: file upload, file processing, AI, mobile, RAG, tool-calling, payments, exports, or third-party integrations.
|
|
48
|
-
|
|
49
|
-
If an input is missing, continue with what is available and mark the gap in the report.
|
|
50
|
-
|
|
51
|
-
## Context Optimization Rules
|
|
52
|
-
|
|
53
|
-
Apply only relevant control domains to keep context focused:
|
|
54
|
-
- Always include domains 1, 2, 3, 4, 5, 6, 7, 9, 10, and 11 below.
|
|
55
|
-
- Include domain 8 only if file upload or file processing exists.
|
|
56
|
-
- Include domains 12 and 13 only if AI-assisted coding, AI runtime features, RAG, prompt construction, model APIs, or tool-calling agents exist.
|
|
57
|
-
- Include domain 14 only if an Android/iOS mobile app exists.
|
|
58
|
-
- For admin, internal, privileged, and service accounts, enforce stricter credential, MFA, lockout, lifecycle, rotation, and audit controls than customer accounts.
|
|
59
|
-
- For internet-facing or multi-tenant systems, treat access control, rate limiting, tenant isolation, audit logging, and least-data responses as release-gate controls.
|
|
60
|
-
|
|
61
|
-
## Security Control Baseline
|
|
62
|
-
|
|
63
|
-
Use this baseline to classify controls as **Required**, **Missing**, **Verified**, **Not applicable**, or **Not reviewed**.
|
|
64
|
-
|
|
65
|
-
### 1) Input Handling and Data Processing
|
|
66
|
-
|
|
67
|
-
Required:
|
|
68
|
-
- Validate all client input at the server boundary: type, length, range, format, regex, and allow-list where possible.
|
|
69
|
-
- Never trust client data, including hidden fields, UI state, and client-side validation results.
|
|
70
|
-
- Encode or escape data before use in HTML, JS, CSS, SQL, LDAP, template, shell, and log contexts.
|
|
71
|
-
- Prefer allow-list validation over deny-list validation.
|
|
72
|
-
|
|
73
|
-
Verification:
|
|
74
|
-
- Negative tests cover malformed, oversized, unexpected-type, and boundary input.
|
|
75
|
-
- No dynamic query, template, shell, or expression injection path accepts raw input.
|
|
76
|
-
|
|
77
|
-
### 2) Authentication and Accounts
|
|
78
|
-
|
|
79
|
-
Required:
|
|
80
|
-
- Use established standards such as SSO, OAuth2, or OIDC where possible.
|
|
81
|
-
- Store passwords only with salted bcrypt, Argon2, or scrypt; never plaintext or reversible encryption.
|
|
82
|
-
- Do not hardcode credentials or secrets in source code, config, generated examples, logs, or repository history.
|
|
83
|
-
- Require MFA for privileged/admin accounts.
|
|
84
|
-
- Enforce first-login password change for internal or privileged accounts when password login exists.
|
|
85
|
-
- Privileged/internal credential rotation should be at most 90 days, and privileged/admin accounts cannot reuse the last 5 passwords.
|
|
86
|
-
- Privileged/service account credentials must be strong random values protected by a secret manager.
|
|
87
|
-
- Lockout policy: internal/admin accounts lock after 6 failed attempts in 15 minutes; customer accounts use progressive delay and captcha or equivalent abuse protection.
|
|
88
|
-
- Password policy: internal/admin minimum 12 characters, privileged minimum 14 with upper/lower/digit/special; customer minimum 8 and recommended 10+ with strength checks and 2FA capability.
|
|
89
|
-
|
|
90
|
-
Verification:
|
|
91
|
-
- Tests cover lockout, MFA path, password reuse, rotation, and generic auth failure behavior.
|
|
92
|
-
|
|
93
|
-
### 3) Session Management
|
|
94
|
-
|
|
95
|
-
Required:
|
|
96
|
-
- Session IDs must be cryptographically random and high entropy.
|
|
97
|
-
- Cookies must set `Secure`, `HttpOnly`, and `SameSite=Strict` or `SameSite=Lax`.
|
|
98
|
-
- Session invalidation must occur server-side on logout, privilege changes, and credential reset.
|
|
99
|
-
- Centralize auth/session controls in shared middleware or a shared library.
|
|
100
|
-
- Enforce inactivity timeout according to risk level; 15 minutes or less is recommended for sensitive/admin flows.
|
|
101
|
-
- Never send session IDs, access tokens, or refresh tokens through URLs or logs.
|
|
102
|
-
|
|
103
|
-
Verification:
|
|
104
|
-
- Evidence confirms server-side revocation, timeout behavior, cookie flags, and no token leakage in URLs/logs.
|
|
105
|
-
|
|
106
|
-
### 4) Access Control
|
|
107
|
-
|
|
108
|
-
Required:
|
|
109
|
-
- Enforce authorization server-side only; UI controls are never security controls.
|
|
110
|
-
- Deny by default and grant only required permissions.
|
|
111
|
-
- Apply least privilege and role separation across user, admin, privileged, and service accounts.
|
|
112
|
-
- No shared privileged accounts.
|
|
113
|
-
- Never create a default super admin during bootstrap.
|
|
114
|
-
- Privileged account lifecycle must be approved, time-bounded, logged, and promptly revoked.
|
|
115
|
-
- Multi-tenant systems must enforce tenant isolation on every object read, write, export, webhook, background job, and admin path.
|
|
116
|
-
|
|
117
|
-
Verification:
|
|
118
|
-
- Tests cover horizontal and vertical privilege escalation, direct object references, tenant leaks, and sensitive action authorization.
|
|
119
|
-
|
|
120
|
-
### 5) Cryptography and Data Protection
|
|
121
|
-
|
|
122
|
-
Required:
|
|
123
|
-
- Use standard algorithms and maintained libraries only, such as AES-256, RSA-2048+, or ECC where appropriate.
|
|
124
|
-
- Never create custom cryptographic algorithms or ad-hoc signing/encryption formats.
|
|
125
|
-
- Manage keys in Vault or a Secret Manager with rotation policy and scoped access.
|
|
126
|
-
- Protect data stored on web/mobile clients: minimize retention, delete when unnecessary, encrypt or mask sensitive data.
|
|
127
|
-
- Store mobile credentials/secrets only in OS secure stores such as Keychain or Keystore.
|
|
128
|
-
- Never store auth tokens in `localStorage` or `sessionStorage`; use HttpOnly cookies or secure ephemeral memory.
|
|
129
|
-
- Protect sensitive data at rest and in transit according to classification.
|
|
130
|
-
|
|
131
|
-
Verification:
|
|
132
|
-
- Evidence exists for key source, key access scope, rotation, TLS, encrypted backups, and sensitive data minimization.
|
|
133
|
-
|
|
134
|
-
### 6) Error Handling and Logging
|
|
135
|
-
|
|
136
|
-
Required:
|
|
137
|
-
- Return generic authentication errors; do not reveal user existence or exact failure reason.
|
|
138
|
-
- Log critical security events: login, logout, failed login, MFA changes, permission changes, credential resets, exports, and sensitive create/update/delete actions.
|
|
139
|
-
- Use structured logs such as JSON or syslog-compatible records.
|
|
140
|
-
- Do not expose stack traces, system paths, versions, or internal error details to end users.
|
|
141
|
-
- Never log passwords, secrets, tokens, session IDs, prompt contents containing sensitive data, or sensitive PII.
|
|
142
|
-
- Audit important business actions with actor, timestamp, source IP, action, target object, and result.
|
|
143
|
-
- Applications must not be able to modify or delete their own immutable security logs.
|
|
144
|
-
|
|
145
|
-
Verification:
|
|
146
|
-
- Sampling confirms logs are structured, useful for audit, and free of sensitive fields.
|
|
147
|
-
|
|
148
|
-
### 7) Database Security
|
|
149
|
-
|
|
150
|
-
Required:
|
|
151
|
-
- Use prepared statements or safe ORM patterns; no string concatenation SQL or dynamic query construction from raw input.
|
|
152
|
-
- Database accounts must follow least privilege; applications must not use root, `sa`, owner, or broad admin accounts.
|
|
153
|
-
- Enable audit logging for sensitive tables and sensitive actions such as CREATE, DROP, ALTER, UPDATE, DELETE, and INSERT, then forward to SIEM or equivalent monitoring.
|
|
154
|
-
- Encrypted backups are mandatory for sensitive systems.
|
|
155
|
-
- Sensitive columns or tables must be encrypted or tokenized where classification requires it.
|
|
156
|
-
- AI internal apps must have scoped DB/knowledge access, dedicated service accounts, and access logging.
|
|
157
|
-
- Each service can access only its own database; avoid cross-service shared DB accounts.
|
|
158
|
-
|
|
159
|
-
Verification:
|
|
160
|
-
- Review grants, SQL patterns, audit pipeline, backup encryption, and service account scope.
|
|
161
|
-
|
|
162
|
-
### 8) File Handling and Upload
|
|
163
|
-
|
|
164
|
-
Required when upload or file processing exists:
|
|
165
|
-
- Validate MIME type, extension, and magic number.
|
|
166
|
-
- Store uploaded files outside webroot or outside direct executable/static serving paths.
|
|
167
|
-
- Integrate malware scanning or sandboxing where applicable.
|
|
168
|
-
- Enforce file size, count, and processing time limits.
|
|
169
|
-
- Block executable uploads such as `.php`, `.jsp`, `.exe`, scripts, and dangerous archive formats unless explicitly justified and sandboxed.
|
|
170
|
-
- Generate non-predictable server-side filenames; never trust user-provided names or paths.
|
|
171
|
-
- Prevent path traversal, archive slip, symlink traversal, parser confusion, and polyglot bypasses.
|
|
172
|
-
|
|
173
|
-
Verification:
|
|
174
|
-
- Tests include renamed executable, polyglot file, oversized file, archive traversal, MIME mismatch, and path traversal attempts.
|
|
175
|
-
|
|
176
|
-
### 9) Communication and API Security
|
|
177
|
-
|
|
178
|
-
Required:
|
|
179
|
-
- Expose only necessary APIs and maintain clear documentation.
|
|
180
|
-
- Rotate API keys and tokens periodically.
|
|
181
|
-
- Apply rate limiting and anti-bruteforce controls for APIs, login endpoints, password reset, MFA, exports, and expensive operations.
|
|
182
|
-
- Never send access tokens or secrets in URLs.
|
|
183
|
-
- Do not expose version banners, software details, stack traces, or debug data in responses.
|
|
184
|
-
- Use explicit API versioning; do not silently break previous behavior.
|
|
185
|
-
- Return minimum required fields only; avoid over-fetching full objects.
|
|
186
|
-
- Validate webhook signatures and replay protections.
|
|
187
|
-
|
|
188
|
-
Verification:
|
|
189
|
-
- Contract tests confirm response field minimization, authz, rate limits, version behavior, and webhook signature checks.
|
|
190
|
-
|
|
191
|
-
### 10) Configuration Security
|
|
192
|
-
|
|
193
|
-
Required:
|
|
194
|
-
- Allow only necessary HTTP methods.
|
|
195
|
-
- Enable security headers such as CSP, X-Frame-Options or frame-ancestors, X-Content-Type-Options, Referrer-Policy, and HSTS where applicable.
|
|
196
|
-
- Do not commit `.env`, credentials, private keys, production config, or local secret dumps.
|
|
197
|
-
- Do not use default usernames, passwords, demo tenants, permissive CORS, debug mode, broad IAM policies, or public buckets in production.
|
|
198
|
-
- Separate dev/test/prod configuration and fail closed on missing security-critical settings.
|
|
199
|
-
|
|
200
|
-
Verification:
|
|
201
|
-
- Config scan confirms methods, headers, environment separation, CORS, IAM, storage, and debug settings are enforced in all environments.
|
|
202
|
-
|
|
203
|
-
### 11) Dependencies and Supply Chain
|
|
204
|
-
|
|
205
|
-
Required:
|
|
206
|
-
- Use package manager lockfiles for deterministic dependency trees.
|
|
207
|
-
- Run SCA and generate or maintain an SBOM where required.
|
|
208
|
-
- Use trusted and maintained libraries only, with approval before adopting risky or security-sensitive dependencies.
|
|
209
|
-
- Enforce pre-commit or CI hooks for SAST and SCA where project policy requires them.
|
|
210
|
-
- Apply approved security patches promptly.
|
|
211
|
-
- Do not use end-of-life libraries, unpinned install scripts, unsafe postinstall behavior, or unreviewed vendored code.
|
|
212
|
-
|
|
213
|
-
Verification:
|
|
214
|
-
- CI gate fails on critical vulnerabilities, missing lockfile/SBOM, known malicious packages, or unsupported runtime/dependency versions.
|
|
215
|
-
|
|
216
|
-
### 12) AI-Assisted Coding Security
|
|
217
|
-
|
|
218
|
-
Required when AI coding tools are used:
|
|
219
|
-
- Never share source code, customer data, internal configs, secrets, or API keys with unapproved public AI tools.
|
|
220
|
-
- Use only approved AI tools with appropriate data-protection settings.
|
|
221
|
-
- Developers remain responsible for AI-generated code correctness, licensing, and security.
|
|
222
|
-
- AI-generated code must pass SAST/SCA and secure coding checks before commit.
|
|
223
|
-
- Explicitly verify high-risk classes: hardcoded secrets, SQL injection, XSS, unsafe deserialization, command injection, path traversal, authz bypass, tenant leaks, and insecure crypto.
|
|
224
|
-
- Validate AI suggestions against official documentation and security best practices.
|
|
225
|
-
- Track origin notes for complex/high-impact AI-generated code when required for audit.
|
|
226
|
-
- Ensure AI-generated code and snippets do not violate license or copyright constraints.
|
|
227
|
-
|
|
228
|
-
Verification:
|
|
229
|
-
- Review sample commits for AI-origin controls, scan evidence, and human verification of high-risk generated code.
|
|
230
|
-
|
|
231
|
-
### 13) AI System Security
|
|
232
|
-
|
|
233
|
-
Required when shipping AI runtime features:
|
|
234
|
-
- Verify data and model integrity with hashes, signatures, provenance, or trusted deployment channels before training/deployment.
|
|
235
|
-
- Detect and mitigate data poisoning through anomaly checks and source validation.
|
|
236
|
-
- Restrict, encrypt, and control access to training, evaluation, prompt, and retrieval data.
|
|
237
|
-
- Rate-limit model APIs to reduce extraction, abuse, and cost-exhaustion risk.
|
|
238
|
-
- Sanitize user input and external content against direct and indirect prompt injection, including retrieved context.
|
|
239
|
-
- Do not send sensitive data to AI prompts without classification and approval.
|
|
240
|
-
- Never rely on system prompts as the only security control.
|
|
241
|
-
- Do not hardcode secrets, hidden policy, or business logic in prompts.
|
|
242
|
-
- Enforce tenant isolation for AI context, vector stores, tools, memory, logs, and sessions.
|
|
243
|
-
- Validate and filter AI outputs before rendering, execution, query building, workflow decisions, or downstream use.
|
|
244
|
-
- Never pass AI output directly into SQL, shell, code execution, browser automation, emails, payments, or destructive operations.
|
|
245
|
-
- Require human confirmation for irreversible, external, privileged, or high-risk actions.
|
|
246
|
-
- Handle AI timeout, refusal, hallucination, malformed, or invalid outputs safely without exposing internal errors.
|
|
247
|
-
- If tool-calling agents are enabled: enforce least privilege, allowlisted tools, confirmation on real-world actions, max-step limits, and audit logs.
|
|
248
|
-
- Log and monitor model behavior anomalies while excluding sensitive data and defining retention.
|
|
249
|
-
- Reassess risk whenever model, provider, retrieval source, tool set, or prompt policy changes.
|
|
250
|
-
|
|
251
|
-
Verification:
|
|
252
|
-
- Red-team prompt-injection, data-exfiltration, tenant-isolation, tool-abuse, and unsafe-output test cases are included.
|
|
253
|
-
|
|
254
|
-
### 14) Mobile Application Security
|
|
255
|
-
|
|
256
|
-
Required when Android/iOS mobile apps exist:
|
|
257
|
-
- Detect root on Android or jailbreak on iOS and apply a risk response such as warn, restrict, or deny.
|
|
258
|
-
- Detect emulator execution and apply appropriate mitigations for sensitive operations.
|
|
259
|
-
- Implement app integrity verification to detect tampering and repackaging.
|
|
260
|
-
- Run runtime security checks at startup, resume, and before sensitive operations.
|
|
261
|
-
- Enable release obfuscation.
|
|
262
|
-
- Sign release APK/IPA with production keystore/certificate only; never use debug keys.
|
|
263
|
-
- Store credentials and tokens only in OS secure storage, and minimize local sensitive data retention.
|
|
264
|
-
|
|
265
|
-
Verification:
|
|
266
|
-
- Release checklist includes integrity, signing, obfuscation, secure storage, runtime-defense checks, and sensitive-flow testing.
|
|
267
|
-
|
|
268
|
-
## Review Checklist
|
|
269
|
-
|
|
270
|
-
### OWASP Web Top 10 coverage
|
|
271
|
-
|
|
272
|
-
Check for:
|
|
273
|
-
- Broken access control: missing ownership checks, tenant leaks, unsafe direct object references, privilege escalation.
|
|
274
|
-
- Cryptographic failures: secrets in code/logs, weak token handling, sensitive data exposure, unsafe storage or transport.
|
|
275
|
-
- Injection: SQL/NoSQL/LDAP/template/command injection, unsafe shell execution, untrusted interpolation.
|
|
276
|
-
- Insecure design: missing abuse-case handling, unsafe trust boundaries, rate-limit gaps, missing approval gates.
|
|
277
|
-
- Security misconfiguration: permissive CORS, debug modes, unsafe headers, default credentials, broad permissions.
|
|
278
|
-
- Vulnerable/outdated components: risky dependency/config changes, unreviewed generated code or vendored code.
|
|
279
|
-
- Identification/authentication failures: weak session lifecycle, token refresh/logout mistakes, replay risks.
|
|
280
|
-
- Software/data integrity failures: unsafe deserialization, unchecked downloads, supply-chain assumptions, unsigned updates.
|
|
281
|
-
- Logging/monitoring failures: missing audit trails for sensitive actions, leaked secrets/PII in logs.
|
|
282
|
-
- SSRF and unsafe outbound access: user-controlled URLs, metadata service access, webhook fetches, redirects.
|
|
283
|
-
|
|
284
|
-
### AI / LLM feature coverage
|
|
285
|
-
|
|
286
|
-
When AI or assistant behavior is touched, also check:
|
|
287
|
-
- Prompt injection and tool-instruction boundary failures.
|
|
288
|
-
- Unauthorized tool use or data access through model-controlled paths.
|
|
289
|
-
- Sensitive prompt/context leakage.
|
|
290
|
-
- Retrieval/data poisoning assumptions.
|
|
291
|
-
- Unsafe generated code, command suggestions, or policy bypasses.
|
|
292
|
-
- Missing human approval for irreversible, external, privileged, or high-risk actions.
|
|
293
|
-
|
|
294
|
-
### Common implementation hazards
|
|
295
|
-
|
|
296
|
-
Check input validation, path traversal, upload handling, redirects, CORS/CSRF, XSS, dependency scripts, environment variable handling, logs, error messages, default-deny behavior, secret handling, API response minimization, rate limits, database grants, secure headers, mobile secure storage, and tool-calling boundaries.
|
|
297
|
-
|
|
298
|
-
## Process
|
|
299
|
-
|
|
300
|
-
1. Define the reviewed scope: files, artifacts, changed behavior, endpoints, data classes, account types, configuration, and evidence available.
|
|
301
|
-
2. Read `docs/SECURITY_STANDARDS.md` and apply any project-specific policy that matches the reviewed surface.
|
|
302
|
-
3. Select relevant security domains using the Context Optimization Rules.
|
|
303
|
-
4. Inspect the diff and relevant surrounding code. For code changes, prefer exact file path + line evidence for every finding.
|
|
304
|
-
5. Evaluate each relevant required control as Verified, Missing, Not applicable, or Not reviewed.
|
|
305
|
-
6. Walk the OWASP Web Top 10 checklist and the AI/LLM checklist when applicable.
|
|
306
|
-
7. Separate confirmed findings from hypotheses and explicitly list anything not reviewed.
|
|
307
|
-
8. Rank gaps by risk: Critical, High, Medium, Low.
|
|
308
|
-
9. Define remediation actions with owner and due date when the user needs an auditable plan.
|
|
309
|
-
10. Run or cite verification tests, scans, config checks, and log checks before a release verdict.
|
|
310
|
-
11. Write a standalone security report with a verdict: Pass / Pass with follow-ups / Blocked.
|
|
311
|
-
12.
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
- Missing
|
|
320
|
-
-
|
|
321
|
-
-
|
|
322
|
-
-
|
|
323
|
-
- No
|
|
324
|
-
-
|
|
325
|
-
-
|
|
326
|
-
-
|
|
327
|
-
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
-
|
|
341
|
-
-
|
|
342
|
-
-
|
|
343
|
-
-
|
|
344
|
-
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
-
|
|
349
|
-
- Domains not
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
-
|
|
372
|
-
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
- **
|
|
385
|
-
- **
|
|
386
|
-
- **
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
-
|
|
391
|
-
-
|
|
392
|
-
-
|
|
393
|
-
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
-
|
|
400
|
-
-
|
|
401
|
-
-
|
|
402
|
-
-
|
|
403
|
-
-
|
|
404
|
-
-
|
|
405
|
-
-
|
|
406
|
-
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
- Every finding has severity, evidence, exploit path, risk/impact, recommendation, and status.
|
|
412
|
-
- Relevant baseline domains are marked Verified, Missing, Not applicable, or Not reviewed.
|
|
413
|
-
- No unresolved Critical/High findings remain: each is either fixed or explicitly accepted with owner, reason, and deadline.
|
|
414
|
-
- Release-gate blockers are resolved before Pass.
|
|
415
|
-
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
-
|
|
421
|
-
|
|
422
|
-
## Related Skills
|
|
423
|
-
|
|
424
|
-
- Independent of `hero-coding` and `hero-reviewing`; those skills may recommend this security pass but do not invoke it as a wrapper.
|
|
425
|
-
- Complements `hero-strict`: strict verification can flag that this security review is still missing
|
|
1
|
+
---
|
|
2
|
+
name: hero-security
|
|
3
|
+
description: Use when you want an independent OWASP + AI/LLM security review or release gate of changed code, plans, configuration, or sensitive surfaces
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Hero Security
|
|
7
|
+
|
|
8
|
+
## Overview
|
|
9
|
+
|
|
10
|
+
hero-security is a standalone security review skill. It is not part of `hero-coding` or `hero-reviewing`, and it does not wrap another security skill. Invoke it directly when a developer wants an adversarial security pass over a plan, implementation, configuration, diff, release candidate, or security-sensitive system design.
|
|
11
|
+
|
|
12
|
+
**Core principle:** inspect attack surfaces explicitly, map controls to the reviewed scope, report uncertainty honestly, and never claim a surface is safe if it was not reviewed.
|
|
13
|
+
|
|
14
|
+
## Outcome
|
|
15
|
+
|
|
16
|
+
Produce a security output that is actionable and auditable:
|
|
17
|
+
- Risk-ranked findings or required controls mapped to the reviewed scope.
|
|
18
|
+
- Required controls versus recommended hardening.
|
|
19
|
+
- Verification checklist with pass/fail criteria.
|
|
20
|
+
- Residual risks, owners, and follow-up actions.
|
|
21
|
+
- A release verdict when the review is used as a gate.
|
|
22
|
+
|
|
23
|
+
## When to Use
|
|
24
|
+
|
|
25
|
+
Use this skill when:
|
|
26
|
+
- The user explicitly asks for security, OWASP, compliance, abuse-case, hardening, threat modeling, vulnerability review, remediation planning, or release-gate review.
|
|
27
|
+
- The task touches authentication, authorization, auth/authz boundaries, sessions, secrets, payments, personal data, regulated data, tenant isolation, uploads, file paths, network calls, webhooks, permissions, deployment, infrastructure, mobile apps, database access, API exposure, dependency changes, or supply-chain behavior.
|
|
28
|
+
- `gitnexus_impact` or project policy marks the change as HIGH/CRITICAL or security-sensitive.
|
|
29
|
+
- A Full path feature reaches QA or pre-merge review.
|
|
30
|
+
- The feature includes AI/assistant behavior, AI-assisted coding, AI runtime features, tool use, retrieval/RAG, prompt construction, generated code, or user-supplied instructions.
|
|
31
|
+
|
|
32
|
+
This skill is intentionally independent: `hero-coding`, `hero-reviewing`, and `hero-strict` may recommend running it, but they do not own or embed the security pass.
|
|
33
|
+
|
|
34
|
+
## Inputs
|
|
35
|
+
|
|
36
|
+
Read artifact-first:
|
|
37
|
+
1. Planning artifact / PRD / technical design, if present.
|
|
38
|
+
2. Execution handoff, coding report, or implementation summary, if present.
|
|
39
|
+
3. The current diff and relevant changed files.
|
|
40
|
+
4. `docs/SECURITY_STANDARDS.md` and any existing threat model or project conventions.
|
|
41
|
+
5. Test/build/security-tool evidence that already exists.
|
|
42
|
+
6. System scope: feature, endpoints, services, clients, data stores, background jobs, and admin/internal surfaces.
|
|
43
|
+
7. Stack: language, framework, database, infrastructure, identity provider, and deployment model.
|
|
44
|
+
8. Data class: public, internal, sensitive, regulated, secrets, credentials, tokens, or tenant data.
|
|
45
|
+
9. Exposure: internal only, partner, internet-facing, mobile, webhook, or model/tool-facing.
|
|
46
|
+
10. Identity model and account types: SSO, OAuth2/OIDC, session, API key, customer, employee, admin, privileged, or service account.
|
|
47
|
+
11. Optional modules: file upload, file processing, AI, mobile, RAG, tool-calling, payments, exports, or third-party integrations.
|
|
48
|
+
|
|
49
|
+
If an input is missing, continue with what is available and mark the gap in the report.
|
|
50
|
+
|
|
51
|
+
## Context Optimization Rules
|
|
52
|
+
|
|
53
|
+
Apply only relevant control domains to keep context focused:
|
|
54
|
+
- Always include domains 1, 2, 3, 4, 5, 6, 7, 9, 10, and 11 below.
|
|
55
|
+
- Include domain 8 only if file upload or file processing exists.
|
|
56
|
+
- Include domains 12 and 13 only if AI-assisted coding, AI runtime features, RAG, prompt construction, model APIs, or tool-calling agents exist.
|
|
57
|
+
- Include domain 14 only if an Android/iOS mobile app exists.
|
|
58
|
+
- For admin, internal, privileged, and service accounts, enforce stricter credential, MFA, lockout, lifecycle, rotation, and audit controls than customer accounts.
|
|
59
|
+
- For internet-facing or multi-tenant systems, treat access control, rate limiting, tenant isolation, audit logging, and least-data responses as release-gate controls.
|
|
60
|
+
|
|
61
|
+
## Security Control Baseline
|
|
62
|
+
|
|
63
|
+
Use this baseline to classify controls as **Required**, **Missing**, **Verified**, **Not applicable**, or **Not reviewed**.
|
|
64
|
+
|
|
65
|
+
### 1) Input Handling and Data Processing
|
|
66
|
+
|
|
67
|
+
Required:
|
|
68
|
+
- Validate all client input at the server boundary: type, length, range, format, regex, and allow-list where possible.
|
|
69
|
+
- Never trust client data, including hidden fields, UI state, and client-side validation results.
|
|
70
|
+
- Encode or escape data before use in HTML, JS, CSS, SQL, LDAP, template, shell, and log contexts.
|
|
71
|
+
- Prefer allow-list validation over deny-list validation.
|
|
72
|
+
|
|
73
|
+
Verification:
|
|
74
|
+
- Negative tests cover malformed, oversized, unexpected-type, and boundary input.
|
|
75
|
+
- No dynamic query, template, shell, or expression injection path accepts raw input.
|
|
76
|
+
|
|
77
|
+
### 2) Authentication and Accounts
|
|
78
|
+
|
|
79
|
+
Required:
|
|
80
|
+
- Use established standards such as SSO, OAuth2, or OIDC where possible.
|
|
81
|
+
- Store passwords only with salted bcrypt, Argon2, or scrypt; never plaintext or reversible encryption.
|
|
82
|
+
- Do not hardcode credentials or secrets in source code, config, generated examples, logs, or repository history.
|
|
83
|
+
- Require MFA for privileged/admin accounts.
|
|
84
|
+
- Enforce first-login password change for internal or privileged accounts when password login exists.
|
|
85
|
+
- Privileged/internal credential rotation should be at most 90 days, and privileged/admin accounts cannot reuse the last 5 passwords.
|
|
86
|
+
- Privileged/service account credentials must be strong random values protected by a secret manager.
|
|
87
|
+
- Lockout policy: internal/admin accounts lock after 6 failed attempts in 15 minutes; customer accounts use progressive delay and captcha or equivalent abuse protection.
|
|
88
|
+
- Password policy: internal/admin minimum 12 characters, privileged minimum 14 with upper/lower/digit/special; customer minimum 8 and recommended 10+ with strength checks and 2FA capability.
|
|
89
|
+
|
|
90
|
+
Verification:
|
|
91
|
+
- Tests cover lockout, MFA path, password reuse, rotation, and generic auth failure behavior.
|
|
92
|
+
|
|
93
|
+
### 3) Session Management
|
|
94
|
+
|
|
95
|
+
Required:
|
|
96
|
+
- Session IDs must be cryptographically random and high entropy.
|
|
97
|
+
- Cookies must set `Secure`, `HttpOnly`, and `SameSite=Strict` or `SameSite=Lax`.
|
|
98
|
+
- Session invalidation must occur server-side on logout, privilege changes, and credential reset.
|
|
99
|
+
- Centralize auth/session controls in shared middleware or a shared library.
|
|
100
|
+
- Enforce inactivity timeout according to risk level; 15 minutes or less is recommended for sensitive/admin flows.
|
|
101
|
+
- Never send session IDs, access tokens, or refresh tokens through URLs or logs.
|
|
102
|
+
|
|
103
|
+
Verification:
|
|
104
|
+
- Evidence confirms server-side revocation, timeout behavior, cookie flags, and no token leakage in URLs/logs.
|
|
105
|
+
|
|
106
|
+
### 4) Access Control
|
|
107
|
+
|
|
108
|
+
Required:
|
|
109
|
+
- Enforce authorization server-side only; UI controls are never security controls.
|
|
110
|
+
- Deny by default and grant only required permissions.
|
|
111
|
+
- Apply least privilege and role separation across user, admin, privileged, and service accounts.
|
|
112
|
+
- No shared privileged accounts.
|
|
113
|
+
- Never create a default super admin during bootstrap.
|
|
114
|
+
- Privileged account lifecycle must be approved, time-bounded, logged, and promptly revoked.
|
|
115
|
+
- Multi-tenant systems must enforce tenant isolation on every object read, write, export, webhook, background job, and admin path.
|
|
116
|
+
|
|
117
|
+
Verification:
|
|
118
|
+
- Tests cover horizontal and vertical privilege escalation, direct object references, tenant leaks, and sensitive action authorization.
|
|
119
|
+
|
|
120
|
+
### 5) Cryptography and Data Protection
|
|
121
|
+
|
|
122
|
+
Required:
|
|
123
|
+
- Use standard algorithms and maintained libraries only, such as AES-256, RSA-2048+, or ECC where appropriate.
|
|
124
|
+
- Never create custom cryptographic algorithms or ad-hoc signing/encryption formats.
|
|
125
|
+
- Manage keys in Vault or a Secret Manager with rotation policy and scoped access.
|
|
126
|
+
- Protect data stored on web/mobile clients: minimize retention, delete when unnecessary, encrypt or mask sensitive data.
|
|
127
|
+
- Store mobile credentials/secrets only in OS secure stores such as Keychain or Keystore.
|
|
128
|
+
- Never store auth tokens in `localStorage` or `sessionStorage`; use HttpOnly cookies or secure ephemeral memory.
|
|
129
|
+
- Protect sensitive data at rest and in transit according to classification.
|
|
130
|
+
|
|
131
|
+
Verification:
|
|
132
|
+
- Evidence exists for key source, key access scope, rotation, TLS, encrypted backups, and sensitive data minimization.
|
|
133
|
+
|
|
134
|
+
### 6) Error Handling and Logging
|
|
135
|
+
|
|
136
|
+
Required:
|
|
137
|
+
- Return generic authentication errors; do not reveal user existence or exact failure reason.
|
|
138
|
+
- Log critical security events: login, logout, failed login, MFA changes, permission changes, credential resets, exports, and sensitive create/update/delete actions.
|
|
139
|
+
- Use structured logs such as JSON or syslog-compatible records.
|
|
140
|
+
- Do not expose stack traces, system paths, versions, or internal error details to end users.
|
|
141
|
+
- Never log passwords, secrets, tokens, session IDs, prompt contents containing sensitive data, or sensitive PII.
|
|
142
|
+
- Audit important business actions with actor, timestamp, source IP, action, target object, and result.
|
|
143
|
+
- Applications must not be able to modify or delete their own immutable security logs.
|
|
144
|
+
|
|
145
|
+
Verification:
|
|
146
|
+
- Sampling confirms logs are structured, useful for audit, and free of sensitive fields.
|
|
147
|
+
|
|
148
|
+
### 7) Database Security
|
|
149
|
+
|
|
150
|
+
Required:
|
|
151
|
+
- Use prepared statements or safe ORM patterns; no string concatenation SQL or dynamic query construction from raw input.
|
|
152
|
+
- Database accounts must follow least privilege; applications must not use root, `sa`, owner, or broad admin accounts.
|
|
153
|
+
- Enable audit logging for sensitive tables and sensitive actions such as CREATE, DROP, ALTER, UPDATE, DELETE, and INSERT, then forward to SIEM or equivalent monitoring.
|
|
154
|
+
- Encrypted backups are mandatory for sensitive systems.
|
|
155
|
+
- Sensitive columns or tables must be encrypted or tokenized where classification requires it.
|
|
156
|
+
- AI internal apps must have scoped DB/knowledge access, dedicated service accounts, and access logging.
|
|
157
|
+
- Each service can access only its own database; avoid cross-service shared DB accounts.
|
|
158
|
+
|
|
159
|
+
Verification:
|
|
160
|
+
- Review grants, SQL patterns, audit pipeline, backup encryption, and service account scope.
|
|
161
|
+
|
|
162
|
+
### 8) File Handling and Upload
|
|
163
|
+
|
|
164
|
+
Required when upload or file processing exists:
|
|
165
|
+
- Validate MIME type, extension, and magic number.
|
|
166
|
+
- Store uploaded files outside webroot or outside direct executable/static serving paths.
|
|
167
|
+
- Integrate malware scanning or sandboxing where applicable.
|
|
168
|
+
- Enforce file size, count, and processing time limits.
|
|
169
|
+
- Block executable uploads such as `.php`, `.jsp`, `.exe`, scripts, and dangerous archive formats unless explicitly justified and sandboxed.
|
|
170
|
+
- Generate non-predictable server-side filenames; never trust user-provided names or paths.
|
|
171
|
+
- Prevent path traversal, archive slip, symlink traversal, parser confusion, and polyglot bypasses.
|
|
172
|
+
|
|
173
|
+
Verification:
|
|
174
|
+
- Tests include renamed executable, polyglot file, oversized file, archive traversal, MIME mismatch, and path traversal attempts.
|
|
175
|
+
|
|
176
|
+
### 9) Communication and API Security
|
|
177
|
+
|
|
178
|
+
Required:
|
|
179
|
+
- Expose only necessary APIs and maintain clear documentation.
|
|
180
|
+
- Rotate API keys and tokens periodically.
|
|
181
|
+
- Apply rate limiting and anti-bruteforce controls for APIs, login endpoints, password reset, MFA, exports, and expensive operations.
|
|
182
|
+
- Never send access tokens or secrets in URLs.
|
|
183
|
+
- Do not expose version banners, software details, stack traces, or debug data in responses.
|
|
184
|
+
- Use explicit API versioning; do not silently break previous behavior.
|
|
185
|
+
- Return minimum required fields only; avoid over-fetching full objects.
|
|
186
|
+
- Validate webhook signatures and replay protections.
|
|
187
|
+
|
|
188
|
+
Verification:
|
|
189
|
+
- Contract tests confirm response field minimization, authz, rate limits, version behavior, and webhook signature checks.
|
|
190
|
+
|
|
191
|
+
### 10) Configuration Security
|
|
192
|
+
|
|
193
|
+
Required:
|
|
194
|
+
- Allow only necessary HTTP methods.
|
|
195
|
+
- Enable security headers such as CSP, X-Frame-Options or frame-ancestors, X-Content-Type-Options, Referrer-Policy, and HSTS where applicable.
|
|
196
|
+
- Do not commit `.env`, credentials, private keys, production config, or local secret dumps.
|
|
197
|
+
- Do not use default usernames, passwords, demo tenants, permissive CORS, debug mode, broad IAM policies, or public buckets in production.
|
|
198
|
+
- Separate dev/test/prod configuration and fail closed on missing security-critical settings.
|
|
199
|
+
|
|
200
|
+
Verification:
|
|
201
|
+
- Config scan confirms methods, headers, environment separation, CORS, IAM, storage, and debug settings are enforced in all environments.
|
|
202
|
+
|
|
203
|
+
### 11) Dependencies and Supply Chain
|
|
204
|
+
|
|
205
|
+
Required:
|
|
206
|
+
- Use package manager lockfiles for deterministic dependency trees.
|
|
207
|
+
- Run SCA and generate or maintain an SBOM where required.
|
|
208
|
+
- Use trusted and maintained libraries only, with approval before adopting risky or security-sensitive dependencies.
|
|
209
|
+
- Enforce pre-commit or CI hooks for SAST and SCA where project policy requires them.
|
|
210
|
+
- Apply approved security patches promptly.
|
|
211
|
+
- Do not use end-of-life libraries, unpinned install scripts, unsafe postinstall behavior, or unreviewed vendored code.
|
|
212
|
+
|
|
213
|
+
Verification:
|
|
214
|
+
- CI gate fails on critical vulnerabilities, missing lockfile/SBOM, known malicious packages, or unsupported runtime/dependency versions.
|
|
215
|
+
|
|
216
|
+
### 12) AI-Assisted Coding Security
|
|
217
|
+
|
|
218
|
+
Required when AI coding tools are used:
|
|
219
|
+
- Never share source code, customer data, internal configs, secrets, or API keys with unapproved public AI tools.
|
|
220
|
+
- Use only approved AI tools with appropriate data-protection settings.
|
|
221
|
+
- Developers remain responsible for AI-generated code correctness, licensing, and security.
|
|
222
|
+
- AI-generated code must pass SAST/SCA and secure coding checks before commit.
|
|
223
|
+
- Explicitly verify high-risk classes: hardcoded secrets, SQL injection, XSS, unsafe deserialization, command injection, path traversal, authz bypass, tenant leaks, and insecure crypto.
|
|
224
|
+
- Validate AI suggestions against official documentation and security best practices.
|
|
225
|
+
- Track origin notes for complex/high-impact AI-generated code when required for audit.
|
|
226
|
+
- Ensure AI-generated code and snippets do not violate license or copyright constraints.
|
|
227
|
+
|
|
228
|
+
Verification:
|
|
229
|
+
- Review sample commits for AI-origin controls, scan evidence, and human verification of high-risk generated code.
|
|
230
|
+
|
|
231
|
+
### 13) AI System Security
|
|
232
|
+
|
|
233
|
+
Required when shipping AI runtime features:
|
|
234
|
+
- Verify data and model integrity with hashes, signatures, provenance, or trusted deployment channels before training/deployment.
|
|
235
|
+
- Detect and mitigate data poisoning through anomaly checks and source validation.
|
|
236
|
+
- Restrict, encrypt, and control access to training, evaluation, prompt, and retrieval data.
|
|
237
|
+
- Rate-limit model APIs to reduce extraction, abuse, and cost-exhaustion risk.
|
|
238
|
+
- Sanitize user input and external content against direct and indirect prompt injection, including retrieved context.
|
|
239
|
+
- Do not send sensitive data to AI prompts without classification and approval.
|
|
240
|
+
- Never rely on system prompts as the only security control.
|
|
241
|
+
- Do not hardcode secrets, hidden policy, or business logic in prompts.
|
|
242
|
+
- Enforce tenant isolation for AI context, vector stores, tools, memory, logs, and sessions.
|
|
243
|
+
- Validate and filter AI outputs before rendering, execution, query building, workflow decisions, or downstream use.
|
|
244
|
+
- Never pass AI output directly into SQL, shell, code execution, browser automation, emails, payments, or destructive operations.
|
|
245
|
+
- Require human confirmation for irreversible, external, privileged, or high-risk actions.
|
|
246
|
+
- Handle AI timeout, refusal, hallucination, malformed, or invalid outputs safely without exposing internal errors.
|
|
247
|
+
- If tool-calling agents are enabled: enforce least privilege, allowlisted tools, confirmation on real-world actions, max-step limits, and audit logs.
|
|
248
|
+
- Log and monitor model behavior anomalies while excluding sensitive data and defining retention.
|
|
249
|
+
- Reassess risk whenever model, provider, retrieval source, tool set, or prompt policy changes.
|
|
250
|
+
|
|
251
|
+
Verification:
|
|
252
|
+
- Red-team prompt-injection, data-exfiltration, tenant-isolation, tool-abuse, and unsafe-output test cases are included.
|
|
253
|
+
|
|
254
|
+
### 14) Mobile Application Security
|
|
255
|
+
|
|
256
|
+
Required when Android/iOS mobile apps exist:
|
|
257
|
+
- Detect root on Android or jailbreak on iOS and apply a risk response such as warn, restrict, or deny.
|
|
258
|
+
- Detect emulator execution and apply appropriate mitigations for sensitive operations.
|
|
259
|
+
- Implement app integrity verification to detect tampering and repackaging.
|
|
260
|
+
- Run runtime security checks at startup, resume, and before sensitive operations.
|
|
261
|
+
- Enable release obfuscation.
|
|
262
|
+
- Sign release APK/IPA with production keystore/certificate only; never use debug keys.
|
|
263
|
+
- Store credentials and tokens only in OS secure storage, and minimize local sensitive data retention.
|
|
264
|
+
|
|
265
|
+
Verification:
|
|
266
|
+
- Release checklist includes integrity, signing, obfuscation, secure storage, runtime-defense checks, and sensitive-flow testing.
|
|
267
|
+
|
|
268
|
+
## Review Checklist
|
|
269
|
+
|
|
270
|
+
### OWASP Web Top 10 coverage
|
|
271
|
+
|
|
272
|
+
Check for:
|
|
273
|
+
- Broken access control: missing ownership checks, tenant leaks, unsafe direct object references, privilege escalation.
|
|
274
|
+
- Cryptographic failures: secrets in code/logs, weak token handling, sensitive data exposure, unsafe storage or transport.
|
|
275
|
+
- Injection: SQL/NoSQL/LDAP/template/command injection, unsafe shell execution, untrusted interpolation.
|
|
276
|
+
- Insecure design: missing abuse-case handling, unsafe trust boundaries, rate-limit gaps, missing approval gates.
|
|
277
|
+
- Security misconfiguration: permissive CORS, debug modes, unsafe headers, default credentials, broad permissions.
|
|
278
|
+
- Vulnerable/outdated components: risky dependency/config changes, unreviewed generated code or vendored code.
|
|
279
|
+
- Identification/authentication failures: weak session lifecycle, token refresh/logout mistakes, replay risks.
|
|
280
|
+
- Software/data integrity failures: unsafe deserialization, unchecked downloads, supply-chain assumptions, unsigned updates.
|
|
281
|
+
- Logging/monitoring failures: missing audit trails for sensitive actions, leaked secrets/PII in logs.
|
|
282
|
+
- SSRF and unsafe outbound access: user-controlled URLs, metadata service access, webhook fetches, redirects.
|
|
283
|
+
|
|
284
|
+
### AI / LLM feature coverage
|
|
285
|
+
|
|
286
|
+
When AI or assistant behavior is touched, also check:
|
|
287
|
+
- Prompt injection and tool-instruction boundary failures.
|
|
288
|
+
- Unauthorized tool use or data access through model-controlled paths.
|
|
289
|
+
- Sensitive prompt/context leakage.
|
|
290
|
+
- Retrieval/data poisoning assumptions.
|
|
291
|
+
- Unsafe generated code, command suggestions, or policy bypasses.
|
|
292
|
+
- Missing human approval for irreversible, external, privileged, or high-risk actions.
|
|
293
|
+
|
|
294
|
+
### Common implementation hazards
|
|
295
|
+
|
|
296
|
+
Check input validation, path traversal, upload handling, redirects, CORS/CSRF, XSS, dependency scripts, environment variable handling, logs, error messages, default-deny behavior, secret handling, API response minimization, rate limits, database grants, secure headers, mobile secure storage, and tool-calling boundaries.
|
|
297
|
+
|
|
298
|
+
## Process
|
|
299
|
+
|
|
300
|
+
1. Define the reviewed scope: files, artifacts, changed behavior, endpoints, data classes, account types, configuration, and evidence available.
|
|
301
|
+
2. Read `docs/SECURITY_STANDARDS.md` and apply any project-specific policy that matches the reviewed surface.
|
|
302
|
+
3. Select relevant security domains using the Context Optimization Rules.
|
|
303
|
+
4. Inspect the diff and relevant surrounding code. For code changes, prefer exact file path + line evidence for every finding.
|
|
304
|
+
5. Evaluate each relevant required control as Verified, Missing, Not applicable, or Not reviewed.
|
|
305
|
+
6. Walk the OWASP Web Top 10 checklist and the AI/LLM checklist when applicable.
|
|
306
|
+
7. Separate confirmed findings from hypotheses and explicitly list anything not reviewed.
|
|
307
|
+
8. Rank gaps by risk: Critical, High, Medium, Low.
|
|
308
|
+
9. Define remediation actions with owner and due date when the user needs an auditable plan.
|
|
309
|
+
10. Run or cite verification tests, scans, config checks, and log checks before a release verdict.
|
|
310
|
+
11. Write a standalone security report at `docs/security-reports/YYYY-MM-DD-<slug>.md` with a verdict: Pass / Pass with follow-ups / Blocked.
|
|
311
|
+
12. State the verdict and report path in chat.
|
|
312
|
+
13. If any Critical/High findings exist, they must be fixed or explicitly accepted with a documented reason before the work is considered done.
|
|
313
|
+
|
|
314
|
+
Do not run exploitative tests against external systems. Do not recommend detection evasion, persistence, destructive actions, destructive payloads, denial-of-service, credential theft, supply-chain compromise, or broad targeting.
|
|
315
|
+
|
|
316
|
+
## Release Gate
|
|
317
|
+
|
|
318
|
+
Block release when any of the following is true:
|
|
319
|
+
- Missing server-side authorization checks for sensitive actions.
|
|
320
|
+
- Missing input validation for external inputs.
|
|
321
|
+
- Secrets, credentials, tokens, private keys, or regulated data exposed in code, logs, prompts, repository, artifacts, URLs, or client storage.
|
|
322
|
+
- SQL/NoSQL/command/template injection path exists due to dynamic concatenation or unsafe interpolation.
|
|
323
|
+
- No MFA for privileged/admin accounts.
|
|
324
|
+
- No rate limiting or anti-bruteforce control on auth-sensitive endpoints.
|
|
325
|
+
- Critical dependency, runtime, image, or infrastructure vulnerability remains unresolved without documented acceptance.
|
|
326
|
+
- Tenant isolation is unverified for multi-tenant sensitive data.
|
|
327
|
+
- AI/tool-calling feature can perform irreversible, external, privileged, or high-risk action without confirmation and least privilege.
|
|
328
|
+
- File upload accepts executable, oversized, path-traversal, or parser-confusion payloads without effective controls.
|
|
329
|
+
|
|
330
|
+
## Output Artifact
|
|
331
|
+
|
|
332
|
+
`docs/security-reports/YYYY-MM-DD-<slug>.md` — a standalone security review report. `hero-security` owns this artifact; do not append its findings into coding/review/test reports as a substitute for the security report.
|
|
333
|
+
|
|
334
|
+
Use this format:
|
|
335
|
+
|
|
336
|
+
```markdown
|
|
337
|
+
# Security Review: <slug>
|
|
338
|
+
|
|
339
|
+
## Scope reviewed
|
|
340
|
+
- Files / modules:
|
|
341
|
+
- Endpoints / services / clients:
|
|
342
|
+
- Data class and exposure:
|
|
343
|
+
- Account types and identity model:
|
|
344
|
+
- Artifacts:
|
|
345
|
+
- Commands or evidence read:
|
|
346
|
+
|
|
347
|
+
## Applied domains
|
|
348
|
+
- Domain numbers and names:
|
|
349
|
+
- Domains not applicable:
|
|
350
|
+
- Domains not reviewed:
|
|
351
|
+
|
|
352
|
+
## Findings
|
|
353
|
+
| Severity | Area | Evidence | Exploit path | Risk / impact | Recommendation | Status |
|
|
354
|
+
|---|---|---|---|---|---|---|
|
|
355
|
+
|
|
356
|
+
## Required fixes before release
|
|
357
|
+
- ...
|
|
358
|
+
|
|
359
|
+
## Recommended improvements
|
|
360
|
+
- ...
|
|
361
|
+
|
|
362
|
+
## Verification
|
|
363
|
+
- Tests / scans / config checks / log checks performed:
|
|
364
|
+
- Missing verification:
|
|
365
|
+
|
|
366
|
+
## OWASP coverage
|
|
367
|
+
- Web Top 10 categories checked:
|
|
368
|
+
- AI/LLM categories checked, if applicable:
|
|
369
|
+
|
|
370
|
+
## Residual risks
|
|
371
|
+
- Accepted risk:
|
|
372
|
+
- Owner:
|
|
373
|
+
- Deadline:
|
|
374
|
+
|
|
375
|
+
## Not reviewed / uncertainty
|
|
376
|
+
- ...
|
|
377
|
+
|
|
378
|
+
## Verdict
|
|
379
|
+
- Pass / Pass with follow-ups / Blocked
|
|
380
|
+
- Required fixes before completion:
|
|
381
|
+
```
|
|
382
|
+
|
|
383
|
+
Severity guide:
|
|
384
|
+
- **Critical:** likely unauthorized access, data loss/exfiltration, RCE, secret exposure, supply-chain compromise, payment compromise, or tenant isolation break.
|
|
385
|
+
- **High:** exploitable sensitive action/data risk, missing core authz/authn control, unsafe privileged/tool action, or realistic injection path.
|
|
386
|
+
- **Medium:** realistic abuse path with limited impact or defense-in-depth gap on a sensitive surface.
|
|
387
|
+
- **Low:** hardening, clarity, logging, monitoring, or low-impact misconfiguration.
|
|
388
|
+
|
|
389
|
+
Security finding style:
|
|
390
|
+
- Do not over-compress risk explanations.
|
|
391
|
+
- Keep severity, affected surface, exploit path, evidence, required fix, owner/deadline when applicable, and verification status explicit.
|
|
392
|
+
- Preserve exact endpoints, paths, auth scopes, secret names, headers, API names, commands, file paths, line references, error strings, dependency names, package versions, and configuration keys.
|
|
393
|
+
- Concision never outranks safety clarity.
|
|
394
|
+
- If no findings are found, say what was reviewed and what remains unreviewed; do not say "secure" without scope.
|
|
395
|
+
|
|
396
|
+
## Common Anti-Patterns
|
|
397
|
+
|
|
398
|
+
Flag these explicitly when observed:
|
|
399
|
+
- Trusting client-side validation, hidden UI state, or disabled buttons as security controls.
|
|
400
|
+
- Relying on system prompts as a security boundary.
|
|
401
|
+
- Logging tokens, prompts with sensitive data, or sensitive payloads for debugging.
|
|
402
|
+
- Reusing privileged or cross-service DB credentials.
|
|
403
|
+
- Returning full entities from APIs instead of least-data responses.
|
|
404
|
+
- Storing tokens in `localStorage` or `sessionStorage`.
|
|
405
|
+
- Creating default super admins, default credentials, broad IAM roles, or public buckets.
|
|
406
|
+
- Passing AI output directly into SQL, shell, browser automation, or irreversible actions.
|
|
407
|
+
- Shipping uploads without magic-number validation, malware scanning where needed, or non-predictable server-side filenames.
|
|
408
|
+
|
|
409
|
+
## Definition of Done
|
|
410
|
+
|
|
411
|
+
- Every finding has severity, evidence, exploit path, risk/impact, recommendation, and status.
|
|
412
|
+
- Relevant baseline domains are marked Verified, Missing, Not applicable, or Not reviewed.
|
|
413
|
+
- No unresolved Critical/High findings remain: each is either fixed or explicitly accepted with owner, reason, and deadline.
|
|
414
|
+
- Release-gate blockers are resolved before Pass.
|
|
415
|
+
- Standalone security report is saved at `docs/security-reports/YYYY-MM-DD-<slug>.md`.
|
|
416
|
+
- Findings and verdict are stated in chat with a link/path to the standalone report, noting any missing inputs, missing verification, residual risks, or unreviewed surfaces.
|
|
417
|
+
|
|
418
|
+
## ACTIVE_STATE.md Update
|
|
419
|
+
|
|
420
|
+
- If a finding blocks the work, add it to the Blockers/Pending Actions section of `docs/ACTIVE_STATE.md`.
|
|
421
|
+
|
|
422
|
+
## Related Skills
|
|
423
|
+
|
|
424
|
+
- Independent of `hero-coding` and `hero-reviewing`; those skills may recommend this security pass but do not invoke it as a wrapper.
|
|
425
|
+
- Complements `hero-strict`: strict verification can flag that this security review is still missing.
|
|
426
|
+
- Points at `docs/SECURITY_STANDARDS.md` for project-level policy and standards.
|
|
427
|
+
- Does not use `hero-report` as a substitute for its own report; security findings belong in `docs/security-reports/...`.
|