hero-mmt-kit 1.1.0 → 1.1.2

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 CHANGED
@@ -4,6 +4,20 @@ Notable changes to `hero-mmt-kit` are documented here from `1.0.0` onward.
4
4
 
5
5
  Format follows [Keep a Changelog](https://keepachangelog.com/); versioning follows [SemVer](https://semver.org/).
6
6
 
7
+ ## [1.1.2] - 2026-07-14
8
+
9
+ ### Changed
10
+
11
+ - Extracted `hero-security`'s embedded reference knowledge (the 14-domain security control baseline, OWASP/AI-LLM review checklist, release-gate criteria, report template, and severity guide) out of `SKILL.md` into standalone docs — `docs/SECURITY_CONTROL_BASELINE.md`, `docs/SECURITY_REVIEW_CHECKLIST.md`, and `docs/SECURITY_REPORT_FORMAT.md` — referenced from the skill via `@docs/...`. `hero-security/SKILL.md` shrank from 427 to ~150 lines and now covers only process/behavioral guidance.
12
+ - Consolidated all `hero-security` documentation into the project's single `docs/` folder alongside the existing `docs/SECURITY_STANDARDS.md`, instead of splitting it between the project's `docs/` and a skill-local `docs/` subfolder under `.claude/skills/hero-security/`. `SECURITY_STANDARDS.md` now cross-links the three new files.
13
+
14
+ ## [1.1.1] - 2026-07-14
15
+
16
+ ### Fixed
17
+
18
+ - `hero-planning` no longer stalls in Plan Mode asking "should I implement now?" — after the plan is written and self-reviewed, it exits plan mode, reports the saved path, and stops without offering to implement or auto-invoking `hero-coding`.
19
+ - Unified the plan artifact path to `docs/plans/YYYY-MM-DD-<slug>.md` everywhere. The vendored `writing-plans` skill previously defaulted to `docs/superpowers/plans/...`, which didn't match `hero-planning`'s own convention; `writing-plans` and the `requesting-code-review` example now use the same path.
20
+
7
21
  ## [1.1.0] - 2026-07-11
8
22
 
9
23
  ### Added
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hero-mmt-kit",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "A focused Claude Code framework for human-led development — six direct-use skills (planning, coding, reviewing, unit testing, security, strict mode) plus an on-demand report writer, with simple state tracking. Works for new and existing (brownfield) projects.",
5
5
  "keywords": [
6
6
  "claude-code",
@@ -0,0 +1,208 @@
1
+ # Security Control Baseline
2
+
3
+ > The 14-domain control checklist `hero-security` grades every review against. Fixed framework reference content — not project-specific like [SECURITY_STANDARDS.md](./SECURITY_STANDARDS.md), which holds this project's own filled-in policy.
4
+
5
+ Use this baseline to classify controls as **Required**, **Missing**, **Verified**, **Not applicable**, or **Not reviewed**.
6
+
7
+ ## 1) Input Handling and Data Processing
8
+
9
+ Required:
10
+ - Validate all client input at the server boundary: type, length, range, format, regex, and allow-list where possible.
11
+ - Never trust client data, including hidden fields, UI state, and client-side validation results.
12
+ - Encode or escape data before use in HTML, JS, CSS, SQL, LDAP, template, shell, and log contexts.
13
+ - Prefer allow-list validation over deny-list validation.
14
+
15
+ Verification:
16
+ - Negative tests cover malformed, oversized, unexpected-type, and boundary input.
17
+ - No dynamic query, template, shell, or expression injection path accepts raw input.
18
+
19
+ ## 2) Authentication and Accounts
20
+
21
+ Required:
22
+ - Use established standards such as SSO, OAuth2, or OIDC where possible.
23
+ - Store passwords only with salted bcrypt, Argon2, or scrypt; never plaintext or reversible encryption.
24
+ - Do not hardcode credentials or secrets in source code, config, generated examples, logs, or repository history.
25
+ - Require MFA for privileged/admin accounts.
26
+ - Enforce first-login password change for internal or privileged accounts when password login exists.
27
+ - Privileged/internal credential rotation should be at most 90 days, and privileged/admin accounts cannot reuse the last 5 passwords.
28
+ - Privileged/service account credentials must be strong random values protected by a secret manager.
29
+ - Lockout policy: internal/admin accounts lock after 6 failed attempts in 15 minutes; customer accounts use progressive delay and captcha or equivalent abuse protection.
30
+ - 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.
31
+
32
+ Verification:
33
+ - Tests cover lockout, MFA path, password reuse, rotation, and generic auth failure behavior.
34
+
35
+ ## 3) Session Management
36
+
37
+ Required:
38
+ - Session IDs must be cryptographically random and high entropy.
39
+ - Cookies must set `Secure`, `HttpOnly`, and `SameSite=Strict` or `SameSite=Lax`.
40
+ - Session invalidation must occur server-side on logout, privilege changes, and credential reset.
41
+ - Centralize auth/session controls in shared middleware or a shared library.
42
+ - Enforce inactivity timeout according to risk level; 15 minutes or less is recommended for sensitive/admin flows.
43
+ - Never send session IDs, access tokens, or refresh tokens through URLs or logs.
44
+
45
+ Verification:
46
+ - Evidence confirms server-side revocation, timeout behavior, cookie flags, and no token leakage in URLs/logs.
47
+
48
+ ## 4) Access Control
49
+
50
+ Required:
51
+ - Enforce authorization server-side only; UI controls are never security controls.
52
+ - Deny by default and grant only required permissions.
53
+ - Apply least privilege and role separation across user, admin, privileged, and service accounts.
54
+ - No shared privileged accounts.
55
+ - Never create a default super admin during bootstrap.
56
+ - Privileged account lifecycle must be approved, time-bounded, logged, and promptly revoked.
57
+ - Multi-tenant systems must enforce tenant isolation on every object read, write, export, webhook, background job, and admin path.
58
+
59
+ Verification:
60
+ - Tests cover horizontal and vertical privilege escalation, direct object references, tenant leaks, and sensitive action authorization.
61
+
62
+ ## 5) Cryptography and Data Protection
63
+
64
+ Required:
65
+ - Use standard algorithms and maintained libraries only, such as AES-256, RSA-2048+, or ECC where appropriate.
66
+ - Never create custom cryptographic algorithms or ad-hoc signing/encryption formats.
67
+ - Manage keys in Vault or a Secret Manager with rotation policy and scoped access.
68
+ - Protect data stored on web/mobile clients: minimize retention, delete when unnecessary, encrypt or mask sensitive data.
69
+ - Store mobile credentials/secrets only in OS secure stores such as Keychain or Keystore.
70
+ - Never store auth tokens in `localStorage` or `sessionStorage`; use HttpOnly cookies or secure ephemeral memory.
71
+ - Protect sensitive data at rest and in transit according to classification.
72
+
73
+ Verification:
74
+ - Evidence exists for key source, key access scope, rotation, TLS, encrypted backups, and sensitive data minimization.
75
+
76
+ ## 6) Error Handling and Logging
77
+
78
+ Required:
79
+ - Return generic authentication errors; do not reveal user existence or exact failure reason.
80
+ - Log critical security events: login, logout, failed login, MFA changes, permission changes, credential resets, exports, and sensitive create/update/delete actions.
81
+ - Use structured logs such as JSON or syslog-compatible records.
82
+ - Do not expose stack traces, system paths, versions, or internal error details to end users.
83
+ - Never log passwords, secrets, tokens, session IDs, prompt contents containing sensitive data, or sensitive PII.
84
+ - Audit important business actions with actor, timestamp, source IP, action, target object, and result.
85
+ - Applications must not be able to modify or delete their own immutable security logs.
86
+
87
+ Verification:
88
+ - Sampling confirms logs are structured, useful for audit, and free of sensitive fields.
89
+
90
+ ## 7) Database Security
91
+
92
+ Required:
93
+ - Use prepared statements or safe ORM patterns; no string concatenation SQL or dynamic query construction from raw input.
94
+ - Database accounts must follow least privilege; applications must not use root, `sa`, owner, or broad admin accounts.
95
+ - 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.
96
+ - Encrypted backups are mandatory for sensitive systems.
97
+ - Sensitive columns or tables must be encrypted or tokenized where classification requires it.
98
+ - AI internal apps must have scoped DB/knowledge access, dedicated service accounts, and access logging.
99
+ - Each service can access only its own database; avoid cross-service shared DB accounts.
100
+
101
+ Verification:
102
+ - Review grants, SQL patterns, audit pipeline, backup encryption, and service account scope.
103
+
104
+ ## 8) File Handling and Upload
105
+
106
+ Required when upload or file processing exists:
107
+ - Validate MIME type, extension, and magic number.
108
+ - Store uploaded files outside webroot or outside direct executable/static serving paths.
109
+ - Integrate malware scanning or sandboxing where applicable.
110
+ - Enforce file size, count, and processing time limits.
111
+ - Block executable uploads such as `.php`, `.jsp`, `.exe`, scripts, and dangerous archive formats unless explicitly justified and sandboxed.
112
+ - Generate non-predictable server-side filenames; never trust user-provided names or paths.
113
+ - Prevent path traversal, archive slip, symlink traversal, parser confusion, and polyglot bypasses.
114
+
115
+ Verification:
116
+ - Tests include renamed executable, polyglot file, oversized file, archive traversal, MIME mismatch, and path traversal attempts.
117
+
118
+ ## 9) Communication and API Security
119
+
120
+ Required:
121
+ - Expose only necessary APIs and maintain clear documentation.
122
+ - Rotate API keys and tokens periodically.
123
+ - Apply rate limiting and anti-bruteforce controls for APIs, login endpoints, password reset, MFA, exports, and expensive operations.
124
+ - Never send access tokens or secrets in URLs.
125
+ - Do not expose version banners, software details, stack traces, or debug data in responses.
126
+ - Use explicit API versioning; do not silently break previous behavior.
127
+ - Return minimum required fields only; avoid over-fetching full objects.
128
+ - Validate webhook signatures and replay protections.
129
+
130
+ Verification:
131
+ - Contract tests confirm response field minimization, authz, rate limits, version behavior, and webhook signature checks.
132
+
133
+ ## 10) Configuration Security
134
+
135
+ Required:
136
+ - Allow only necessary HTTP methods.
137
+ - Enable security headers such as CSP, X-Frame-Options or frame-ancestors, X-Content-Type-Options, Referrer-Policy, and HSTS where applicable.
138
+ - Do not commit `.env`, credentials, private keys, production config, or local secret dumps.
139
+ - Do not use default usernames, passwords, demo tenants, permissive CORS, debug mode, broad IAM policies, or public buckets in production.
140
+ - Separate dev/test/prod configuration and fail closed on missing security-critical settings.
141
+
142
+ Verification:
143
+ - Config scan confirms methods, headers, environment separation, CORS, IAM, storage, and debug settings are enforced in all environments.
144
+
145
+ ## 11) Dependencies and Supply Chain
146
+
147
+ Required:
148
+ - Use package manager lockfiles for deterministic dependency trees.
149
+ - Run SCA and generate or maintain an SBOM where required.
150
+ - Use trusted and maintained libraries only, with approval before adopting risky or security-sensitive dependencies.
151
+ - Enforce pre-commit or CI hooks for SAST and SCA where project policy requires them.
152
+ - Apply approved security patches promptly.
153
+ - Do not use end-of-life libraries, unpinned install scripts, unsafe postinstall behavior, or unreviewed vendored code.
154
+
155
+ Verification:
156
+ - CI gate fails on critical vulnerabilities, missing lockfile/SBOM, known malicious packages, or unsupported runtime/dependency versions.
157
+
158
+ ## 12) AI-Assisted Coding Security
159
+
160
+ Required when AI coding tools are used:
161
+ - Never share source code, customer data, internal configs, secrets, or API keys with unapproved public AI tools.
162
+ - Use only approved AI tools with appropriate data-protection settings.
163
+ - Developers remain responsible for AI-generated code correctness, licensing, and security.
164
+ - AI-generated code must pass SAST/SCA and secure coding checks before commit.
165
+ - Explicitly verify high-risk classes: hardcoded secrets, SQL injection, XSS, unsafe deserialization, command injection, path traversal, authz bypass, tenant leaks, and insecure crypto.
166
+ - Validate AI suggestions against official documentation and security best practices.
167
+ - Track origin notes for complex/high-impact AI-generated code when required for audit.
168
+ - Ensure AI-generated code and snippets do not violate license or copyright constraints.
169
+
170
+ Verification:
171
+ - Review sample commits for AI-origin controls, scan evidence, and human verification of high-risk generated code.
172
+
173
+ ## 13) AI System Security
174
+
175
+ Required when shipping AI runtime features:
176
+ - Verify data and model integrity with hashes, signatures, provenance, or trusted deployment channels before training/deployment.
177
+ - Detect and mitigate data poisoning through anomaly checks and source validation.
178
+ - Restrict, encrypt, and control access to training, evaluation, prompt, and retrieval data.
179
+ - Rate-limit model APIs to reduce extraction, abuse, and cost-exhaustion risk.
180
+ - Sanitize user input and external content against direct and indirect prompt injection, including retrieved context.
181
+ - Do not send sensitive data to AI prompts without classification and approval.
182
+ - Never rely on system prompts as the only security control.
183
+ - Do not hardcode secrets, hidden policy, or business logic in prompts.
184
+ - Enforce tenant isolation for AI context, vector stores, tools, memory, logs, and sessions.
185
+ - Validate and filter AI outputs before rendering, execution, query building, workflow decisions, or downstream use.
186
+ - Never pass AI output directly into SQL, shell, code execution, browser automation, emails, payments, or destructive operations.
187
+ - Require human confirmation for irreversible, external, privileged, or high-risk actions.
188
+ - Handle AI timeout, refusal, hallucination, malformed, or invalid outputs safely without exposing internal errors.
189
+ - If tool-calling agents are enabled: enforce least privilege, allowlisted tools, confirmation on real-world actions, max-step limits, and audit logs.
190
+ - Log and monitor model behavior anomalies while excluding sensitive data and defining retention.
191
+ - Reassess risk whenever model, provider, retrieval source, tool set, or prompt policy changes.
192
+
193
+ Verification:
194
+ - Red-team prompt-injection, data-exfiltration, tenant-isolation, tool-abuse, and unsafe-output test cases are included.
195
+
196
+ ## 14) Mobile Application Security
197
+
198
+ Required when Android/iOS mobile apps exist:
199
+ - Detect root on Android or jailbreak on iOS and apply a risk response such as warn, restrict, or deny.
200
+ - Detect emulator execution and apply appropriate mitigations for sensitive operations.
201
+ - Implement app integrity verification to detect tampering and repackaging.
202
+ - Run runtime security checks at startup, resume, and before sensitive operations.
203
+ - Enable release obfuscation.
204
+ - Sign release APK/IPA with production keystore/certificate only; never use debug keys.
205
+ - Store credentials and tokens only in OS secure storage, and minimize local sensitive data retention.
206
+
207
+ Verification:
208
+ - Release checklist includes integrity, signing, obfuscation, secure storage, runtime-defense checks, and sensitive-flow testing.
@@ -0,0 +1,61 @@
1
+ # Security Report Format
2
+
3
+ > The standalone report template and severity guide `hero-security` writes findings into, at `docs/security-reports/YYYY-MM-DD-<slug>.md`.
4
+
5
+ `hero-security` owns this artifact; do not append its findings into coding/review/test reports as a substitute for the security report.
6
+
7
+ Use this format:
8
+
9
+ ```markdown
10
+ # Security Review: <slug>
11
+
12
+ ## Scope reviewed
13
+ - Files / modules:
14
+ - Endpoints / services / clients:
15
+ - Data class and exposure:
16
+ - Account types and identity model:
17
+ - Artifacts:
18
+ - Commands or evidence read:
19
+
20
+ ## Applied domains
21
+ - Domain numbers and names:
22
+ - Domains not applicable:
23
+ - Domains not reviewed:
24
+
25
+ ## Findings
26
+ | Severity | Area | Evidence | Exploit path | Risk / impact | Recommendation | Status |
27
+ |---|---|---|---|---|---|---|
28
+
29
+ ## Required fixes before release
30
+ - ...
31
+
32
+ ## Recommended improvements
33
+ - ...
34
+
35
+ ## Verification
36
+ - Tests / scans / config checks / log checks performed:
37
+ - Missing verification:
38
+
39
+ ## OWASP coverage
40
+ - Web Top 10 categories checked:
41
+ - AI/LLM categories checked, if applicable:
42
+
43
+ ## Residual risks
44
+ - Accepted risk:
45
+ - Owner:
46
+ - Deadline:
47
+
48
+ ## Not reviewed / uncertainty
49
+ - ...
50
+
51
+ ## Verdict
52
+ - Pass / Pass with follow-ups / Blocked
53
+ - Required fixes before completion:
54
+ ```
55
+
56
+ ## Severity guide
57
+
58
+ - **Critical:** likely unauthorized access, data loss/exfiltration, RCE, secret exposure, supply-chain compromise, payment compromise, or tenant isolation break.
59
+ - **High:** exploitable sensitive action/data risk, missing core authz/authn control, unsafe privileged/tool action, or realistic injection path.
60
+ - **Medium:** realistic abuse path with limited impact or defense-in-depth gap on a sensitive surface.
61
+ - **Low:** hardening, clarity, logging, monitoring, or low-impact misconfiguration.
@@ -0,0 +1,45 @@
1
+ # Security Review Checklist
2
+
3
+ > OWASP/AI-LLM checklist and release-gate criteria `hero-security` walks on every pass. Fixed framework reference content, cross-referenced from [SECURITY_STANDARDS.md](./SECURITY_STANDARDS.md).
4
+
5
+ ## OWASP Web Top 10 coverage
6
+
7
+ Check for:
8
+ - Broken access control: missing ownership checks, tenant leaks, unsafe direct object references, privilege escalation.
9
+ - Cryptographic failures: secrets in code/logs, weak token handling, sensitive data exposure, unsafe storage or transport.
10
+ - Injection: SQL/NoSQL/LDAP/template/command injection, unsafe shell execution, untrusted interpolation.
11
+ - Insecure design: missing abuse-case handling, unsafe trust boundaries, rate-limit gaps, missing approval gates.
12
+ - Security misconfiguration: permissive CORS, debug modes, unsafe headers, default credentials, broad permissions.
13
+ - Vulnerable/outdated components: risky dependency/config changes, unreviewed generated code or vendored code.
14
+ - Identification/authentication failures: weak session lifecycle, token refresh/logout mistakes, replay risks.
15
+ - Software/data integrity failures: unsafe deserialization, unchecked downloads, supply-chain assumptions, unsigned updates.
16
+ - Logging/monitoring failures: missing audit trails for sensitive actions, leaked secrets/PII in logs.
17
+ - SSRF and unsafe outbound access: user-controlled URLs, metadata service access, webhook fetches, redirects.
18
+
19
+ ## AI / LLM feature coverage
20
+
21
+ When AI or assistant behavior is touched, also check:
22
+ - Prompt injection and tool-instruction boundary failures.
23
+ - Unauthorized tool use or data access through model-controlled paths.
24
+ - Sensitive prompt/context leakage.
25
+ - Retrieval/data poisoning assumptions.
26
+ - Unsafe generated code, command suggestions, or policy bypasses.
27
+ - Missing human approval for irreversible, external, privileged, or high-risk actions.
28
+
29
+ ## Common implementation hazards
30
+
31
+ 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.
32
+
33
+ ## Release Gate
34
+
35
+ Block release when any of the following is true:
36
+ - Missing server-side authorization checks for sensitive actions.
37
+ - Missing input validation for external inputs.
38
+ - Secrets, credentials, tokens, private keys, or regulated data exposed in code, logs, prompts, repository, artifacts, URLs, or client storage.
39
+ - SQL/NoSQL/command/template injection path exists due to dynamic concatenation or unsafe interpolation.
40
+ - No MFA for privileged/admin accounts.
41
+ - No rate limiting or anti-bruteforce control on auth-sensitive endpoints.
42
+ - Critical dependency, runtime, image, or infrastructure vulnerability remains unresolved without documented acceptance.
43
+ - Tenant isolation is unverified for multi-tenant sensitive data.
44
+ - AI/tool-calling feature can perform irreversible, external, privileged, or high-risk action without confirmation and least privilege.
45
+ - File upload accepts executable, oversized, path-traversal, or parser-confusion payloads without effective controls.
@@ -3,6 +3,8 @@
3
3
  > A **measurable** security baseline for this project. It is the bar `hero-security` grades against. Shift-left: most of it is considered during threat modeling in `hero-planning`.
4
4
  >
5
5
  > Fill the `<TBD>`s per your stack/compliance when locked in the first PRD/TDD.
6
+ >
7
+ > `hero-security`'s fixed review methodology lives alongside this file: [SECURITY_CONTROL_BASELINE.md](./SECURITY_CONTROL_BASELINE.md) (14-domain control checklist), [SECURITY_REVIEW_CHECKLIST.md](./SECURITY_REVIEW_CHECKLIST.md) (OWASP/AI-LLM checklist + release gate), [SECURITY_REPORT_FORMAT.md](./SECURITY_REPORT_FORMAT.md) (report template + severity guide).
6
8
 
7
9
  ## 1. General baseline (every project)
8
10
  - **Secrets**: NEVER hardcode secrets/keys/API tokens in code or logs. Use env vars / a secret manager. `.env` must be in `.gitignore`. Enable secret-scanning (§4).
@@ -29,8 +29,8 @@ Skip it for typo fixes, trivial config edits, or an obvious one-file change —
29
29
 
30
30
  1. **Brainstorm with the human first.** Invoke the vendored `brainstorming` skill to clarify goals, requirements, constraints, edge cases, and open questions before writing anything down. Don't skip this by guessing at intent — surface ambiguity and resolve it in conversation.
31
31
  2. **Assess blast radius for existing-behavior changes.** For refactors or changes to existing behavior, run `gitnexus_impact` (upstream) if GitNexus is available, and report the blast radius — direct callers, affected processes, risk level — before proceeding.
32
- 3. **Write the plan.** Use the vendored `writing-plans` skill's structure to produce: scope, approach, files/areas touched, risks, and a step-by-step breakdown.
33
- 4. **Get explicit approval.** The plan is not ready for `hero-coding` until the human has approved it — via Claude Code's Plan Mode, or an explicit "looks good" in chat. Do not proceed on an assumed yes.
32
+ 3. **Write the plan.** Use the vendored `writing-plans` skill's structure to produce: scope, approach, files/areas touched, risks, and a step-by-step breakdown. Save it to the artifact path below (this matches `writing-plans`' own default save path). Skip its "Execution Handoff" step-choice prompt entirely — that prompt does not apply inside hero-planning.
33
+ 4. **Exit plan mode and stop — do not ask to implement.** Once the plan file is written and self-reviewed, exit plan mode (e.g. via `ExitPlanMode`) purely so the human can read the saved file in a normal turn. Report the saved path and stop. Do not ask "should I proceed to implement?", do not treat exiting plan mode as approval to start coding, and do not invoke `hero-coding` automatically. The human reviews the file on their own and comes back with edits, or their own explicit go-ahead, when ready.
34
34
 
35
35
  ## Output Artifact
36
36
 
@@ -45,8 +45,8 @@ Plan writing style:
45
45
  ## Definition of Done
46
46
 
47
47
  - The plan covers scope, approach, touched files, risks, and a step-by-step breakdown.
48
- - The human has explicitly approved the plan.
49
- - The plan is saved at the artifact path above.
48
+ - The plan is saved at the artifact path above (not `writing-plans`' default location).
49
+ - Plan mode has been exited without asking the human to approve implementation — the plan is left for the human to review and request changes to on their own terms.
50
50
 
51
51
  ## ACTIVE_STATE.md Update
52
52
 
@@ -55,5 +55,5 @@ Plan writing style:
55
55
  ## Related Skills
56
56
 
57
57
  - Wraps the vendored `brainstorming` skill (requirements/edge-case discovery with the human) and `writing-plans` skill (plan structure).
58
- - Hands off to `hero-coding` once the plan is approved.
58
+ - Hands off to `hero-coding` only when the human explicitly asks to implement — never automatically right after the plan is saved.
59
59
  - For refactors, lean on `gitnexus_impact` and `gitnexus_rename` during planning and later execution.
@@ -50,250 +50,25 @@ If an input is missing, continue with what is available and mark the gap in the
50
50
 
51
51
  ## Context Optimization Rules
52
52
 
53
- Apply only relevant control domains to keep context focused:
53
+ Apply only relevant control domains to keep context focused (full domain list: @docs/SECURITY_CONTROL_BASELINE.md):
54
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.
55
+ - Include domain 8 (File Handling and Upload) only if file upload or file processing exists.
56
+ - Include domains 12 and 13 (AI-Assisted Coding Security, AI System Security) only if AI-assisted coding, AI runtime features, RAG, prompt construction, model APIs, or tool-calling agents exist.
57
+ - Include domain 14 (Mobile Application Security) only if an Android/iOS mobile app exists.
58
58
  - For admin, internal, privileged, and service accounts, enforce stricter credential, MFA, lockout, lifecycle, rotation, and audit controls than customer accounts.
59
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
60
 
61
61
  ## Security Control Baseline
62
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.
63
+ 14 domains (Input Handling, Authentication, Session Management, Access Control, Cryptography, Error Handling/Logging, Database Security, File Handling, Communication/API, Configuration, Dependencies/Supply Chain, AI-Assisted Coding Security, AI System Security, Mobile Application Security), each classified as **Required**, **Missing**, **Verified**, **Not applicable**, or **Not reviewed**, with its own Required controls and Verification steps.
267
64
 
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.
65
+ Full baseline: @docs/SECURITY_CONTROL_BASELINE.md
283
66
 
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.
67
+ ## Review Checklist
293
68
 
294
- ### Common implementation hazards
69
+ OWASP Web Top 10 coverage, AI/LLM feature coverage (prompt injection, tool abuse, data leakage), and common implementation hazards to check on every pass, plus the release-gate blocking conditions.
295
70
 
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.
71
+ Full checklist and release gate: @docs/SECURITY_REVIEW_CHECKLIST.md
297
72
 
298
73
  ## Process
299
74
 
@@ -315,76 +90,15 @@ Do not run exploitative tests against external systems. Do not recommend detecti
315
90
 
316
91
  ## Release Gate
317
92
 
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.
93
+ Blocks release on missing server-side authz, missing input validation, exposed secrets/credentials, injection paths, missing MFA on privileged accounts, missing rate limiting on auth-sensitive endpoints, unresolved critical dependency/infra vulnerabilities, unverified tenant isolation, unconfirmed high-risk AI/tool actions, or unsafe file upload handling.
94
+
95
+ Full blocking conditions: @docs/SECURITY_REVIEW_CHECKLIST.md
329
96
 
330
97
  ## Output Artifact
331
98
 
332
99
  `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
100
 
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.
101
+ Report format and severity guide: @docs/SECURITY_REPORT_FORMAT.md
388
102
 
389
103
  Security finding style:
390
104
  - Do not over-compress risk explanations.
@@ -425,3 +139,11 @@ Flag these explicitly when observed:
425
139
  - Complements `hero-strict`: strict verification can flag that this security review is still missing.
426
140
  - Points at `docs/SECURITY_STANDARDS.md` for project-level policy and standards.
427
141
  - Does not use `hero-report` as a substitute for its own report; security findings belong in `docs/security-reports/...`.
142
+
143
+ ## Knowledge References
144
+
145
+ All reference knowledge lives alongside `docs/SECURITY_STANDARDS.md` in the project's `docs/` folder:
146
+ - @docs/SECURITY_STANDARDS.md — this project's own filled-in security policy (project-specific).
147
+ - @docs/SECURITY_CONTROL_BASELINE.md — the 14-domain security control baseline (fixed framework reference).
148
+ - @docs/SECURITY_REVIEW_CHECKLIST.md — OWASP/AI-LLM review checklist and release-gate blocking conditions.
149
+ - @docs/SECURITY_REPORT_FORMAT.md — the standalone report template and severity guide.
@@ -62,7 +62,7 @@ HEAD_SHA=$(git rev-parse HEAD)
62
62
 
63
63
  [Dispatch code reviewer subagent]
64
64
  DESCRIPTION: Added verifyIndex() and repairIndex() with 4 issue types
65
- PLAN_OR_REQUIREMENTS: Task 2 from docs/superpowers/plans/deployment-plan.md
65
+ PLAN_OR_REQUIREMENTS: Task 2 from docs/plans/deployment-plan.md
66
66
  BASE_SHA: a7981ec
67
67
  HEAD_SHA: 3df7661
68
68
 
@@ -15,7 +15,7 @@ Assume they are a skilled developer, but know almost nothing about our toolset o
15
15
 
16
16
  **Context:** If working in an isolated worktree, it should have been created via the `superpowers:using-git-worktrees` skill at execution time.
17
17
 
18
- **Save plans to:** `docs/superpowers/plans/YYYY-MM-DD-<feature-name>.md`
18
+ **Save plans to:** `docs/plans/YYYY-MM-DD-<feature-name>.md`
19
19
  - (User preferences for plan location override this default)
20
20
 
21
21
  ## Scope Check
@@ -149,7 +149,7 @@ If you find issues, fix them inline. No need to re-review — just fix and move
149
149
 
150
150
  After saving the plan, offer execution choice:
151
151
 
152
- **"Plan complete and saved to `docs/superpowers/plans/<filename>.md`. Three execution options:**
152
+ **"Plan complete and saved to `docs/plans/<filename>.md`. Three execution options:**
153
153
 
154
154
  **1. Direct / Pragmatic (default for clear bounded work)** - I implement in this session, run targeted checks, and report verified/unverified scope
155
155