hero-mmt-kit 1.1.1 → 1.1.3
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 +15 -0
- package/package.json +1 -1
- package/templates/docs/SECURITY_CONTROL_BASELINE.md +208 -0
- package/templates/docs/SECURITY_REPORT_FORMAT.md +61 -0
- package/templates/docs/SECURITY_REVIEW_CHECKLIST.md +45 -0
- package/templates/docs/SECURITY_STANDARDS.md +2 -0
- package/templates/skills/NOTICE +9 -0
- package/templates/skills/hero-coding/SKILL.md +1 -1
- package/templates/skills/hero-security/SKILL.md +21 -299
- package/templates/skills/systematic-debugging/SKILL.md +3 -0
- package/templates/skills/systematic-debugging/instrumented-debugging.md +149 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,21 @@ 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.3] - 2026-07-16
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- `instrumented-debugging.md`, a hero-mmt-kit-original supporting technique added to the vendored `systematic-debugging` skill (alongside `root-cause-tracing.md`, `defense-in-depth.md`, and `condition-based-waiting.md`): for a logic/data bug reproducible from known input, trigger it via a temporary unit test built directly from that input, place tagged `console.log`/`print` checkpoints at breakpoint-equivalent locations, and read the collected trace instead of attaching a debugger. Mandatory cleanup removes the temporary test and all checkpoint lines before the session ends.
|
|
12
|
+
- `systematic-debugging/SKILL.md` Phase 1 and its Supporting Techniques list now point to `instrumented-debugging.md`; `hero-coding/SKILL.md` step 4 surfaces it as an option when a mid-implementation bug is reproducible from a known API payload.
|
|
13
|
+
- `templates/skills/NOTICE` documents this as a hero-mmt-kit design choice layered on top of the vendored skill, following the same precedent set for `subagent-driven-development`'s backported additions.
|
|
14
|
+
|
|
15
|
+
## [1.1.2] - 2026-07-14
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
|
|
19
|
+
- 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.
|
|
20
|
+
- 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.
|
|
21
|
+
|
|
7
22
|
## [1.1.1] - 2026-07-14
|
|
8
23
|
|
|
9
24
|
### Fixed
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hero-mmt-kit",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
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).
|
package/templates/skills/NOTICE
CHANGED
|
@@ -30,6 +30,15 @@ on top of hero-mmt-kit's own Review Budget tiering system, which upstream does n
|
|
|
30
30
|
have. The backported additions remain obra/superpowers-origin content under MIT;
|
|
31
31
|
Review Budget tiering is a hero-mmt-kit original design choice.
|
|
32
32
|
|
|
33
|
+
Note on systematic-debugging: this skill received a hero-mmt-kit-original
|
|
34
|
+
supporting technique, `instrumented-debugging.md` (structured console/log
|
|
35
|
+
checkpoint placement for a reproducible API/logic bug, used in place of
|
|
36
|
+
attaching a debugger), added alongside the vendored `root-cause-tracing.md`,
|
|
37
|
+
`defense-in-depth.md`, and `condition-based-waiting.md` technique files. This
|
|
38
|
+
addition is a hero-mmt-kit design choice; the vendored Phase 1-4 process and
|
|
39
|
+
the other supporting files remain unchanged obra/superpowers-origin content
|
|
40
|
+
under MIT.
|
|
41
|
+
|
|
33
42
|
Framework-authored skills shipped by hero-mmt-kit:
|
|
34
43
|
using-hero, hero-planning, hero-coding, hero-reviewing,
|
|
35
44
|
hero-unit-test, hero-security, hero-strict, hero-report
|
|
@@ -29,7 +29,7 @@ If there's no plan artifact, proceed on the strength of the request itself and n
|
|
|
29
29
|
1. Read the plan artifact fully before starting (if one exists). Don't begin editing from a partial read.
|
|
30
30
|
2. Implement using the vendored `executing-plans` skill's discipline: work through tasks in bite-sized steps, run the verification each task specifies, and mark tasks complete as you go rather than at the end.
|
|
31
31
|
3. For independent or parallel work streams, use the vendored `subagent-driven-development` and `dispatching-parallel-agents` skills to delegate. Keep dependent work sequential; only fan out work that has no shared state or ordering constraint.
|
|
32
|
-
4. If unexpected bugs surface mid-implementation, switch to the vendored `systematic-debugging` skill instead of guessing at fixes.
|
|
32
|
+
4. If unexpected bugs surface mid-implementation, switch to the vendored `systematic-debugging` skill instead of guessing at fixes. For a bug reproducible from known input (a specific API payload), its `instrumented-debugging` technique triggers via a temporary unit test built from that input, with checkpoint logs in place of manual breakpoints.
|
|
33
33
|
5. Run relevant verification — build, lint, targeted tests — as you go, not only at the end. Catching a break right after the edit that caused it is cheaper than catching it after ten more edits.
|
|
34
34
|
6. Give a concise chat summary: what changed, the evidence collected, and any remaining risks or deviations from the plan. Don't write a report file by default — see Report Convention below.
|
|
35
35
|
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
319
|
-
|
|
320
|
-
|
|
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
|
-
|
|
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.
|
|
@@ -107,6 +107,8 @@ You MUST complete each phase before proceeding to the next.
|
|
|
107
107
|
|
|
108
108
|
**This reveals:** Which layer fails (secrets → workflow ✓, workflow → build ✗)
|
|
109
109
|
|
|
110
|
+
**For a single reproducible API/logic bug from known input** (payload known, no debugger attached, no need to run the app): see `instrumented-debugging.md` in this directory — trigger via a temporary unit test built from that input, with checkpoint logs replacing manual breakpoints.
|
|
111
|
+
|
|
110
112
|
5. **Trace Data Flow**
|
|
111
113
|
|
|
112
114
|
**WHEN error is deep in call stack:**
|
|
@@ -282,6 +284,7 @@ These techniques are part of systematic debugging and available in this director
|
|
|
282
284
|
- **`root-cause-tracing.md`** - Trace bugs backward through call stack to find original trigger
|
|
283
285
|
- **`defense-in-depth.md`** - Add validation at multiple layers after finding root cause
|
|
284
286
|
- **`condition-based-waiting.md`** - Replace arbitrary timeouts with condition polling
|
|
287
|
+
- **`instrumented-debugging.md`** - Place structured log checkpoints at breakpoint-equivalent locations, triggered by a temporary unit test built from known input, instead of attaching a debugger
|
|
285
288
|
|
|
286
289
|
**Related skills:**
|
|
287
290
|
- **superpowers:test-driven-development** - For creating failing test case (Phase 4, Step 1)
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
# Instrumented Debugging (Checkpoints Instead of Breakpoints)
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
Sometimes you have a concrete, known input — a specific API payload, method, and route — but you don't want to attach a debugger or run the app in debug mode. You still need to see what the code actually did with that data at each point along the way.
|
|
6
|
+
|
|
7
|
+
**Core principle:** Place structured log checkpoints at the same locations you'd otherwise set breakpoints, trigger the code with a **temporary unit test** whose input is built directly from the data provided, then read the collected trace instead of stepping through it live.
|
|
8
|
+
|
|
9
|
+
This is a hero-mmt-kit-original addition to `systematic-debugging` (see `NOTICE`), used within its Phase 1 (Root Cause Investigation) when the bug is reproducible from known input but not being debugged interactively.
|
|
10
|
+
|
|
11
|
+
**This does not execute a real HTTP request against a running app.** The trigger is a unit test that calls the entry point function directly (or drives it in-process, e.g. via the project's existing supertest-style helper if one exists) — no server needs to be up, no real network call is made.
|
|
12
|
+
|
|
13
|
+
## When to Use
|
|
14
|
+
|
|
15
|
+
- The bug is reproducible from **one known input** (method + route + payload, or equivalent function arguments) — all of it known up front.
|
|
16
|
+
- It looks like a **logic or data bug** — wrong value, wrong branch taken, wrong transformation — not a crash, performance issue, or security defect.
|
|
17
|
+
- You'd rather not attach a debugger or run the app in debug mode.
|
|
18
|
+
|
|
19
|
+
**Don't use this for:**
|
|
20
|
+
- Bugs you can't reproduce from a known input — go gather more evidence first (main `SKILL.md`, Phase 1).
|
|
21
|
+
- Crashes with a clear stack trace — read the trace, don't instrument around it.
|
|
22
|
+
- Anything requiring inspecting memory/perf timing — this technique captures values at points in time, not performance profiles.
|
|
23
|
+
- Bugs that only manifest through the real network/process boundary (e.g. serialization over an actual socket, real middleware ordering across processes) — those need an actual running app, which is out of scope for this technique.
|
|
24
|
+
|
|
25
|
+
## Required Input Contract
|
|
26
|
+
|
|
27
|
+
Before writing the test or inserting any checkpoint, confirm you have all of the following. If anything is missing, ask — don't guess:
|
|
28
|
+
|
|
29
|
+
1. **Method + route/endpoint** (e.g. `POST /api/orders/:id/apply-discount`) — used to locate the entry point, not to make a real call.
|
|
30
|
+
2. **The payload** — body/params/query/headers, as a curl command or as plain data (JSON body, path params, etc.) — this becomes the unit test's input, verbatim.
|
|
31
|
+
3. **Expected vs. actual behavior** — what the return value/response/state should be, and what it actually is.
|
|
32
|
+
|
|
33
|
+
## The Process
|
|
34
|
+
|
|
35
|
+
### 1. Locate the Entry Point
|
|
36
|
+
|
|
37
|
+
Find the function the given route resolves to — route handler/controller, or the service/business-logic function it delegates to if that's a closer match to the reported symptom. Grep for the route string, or use GitNexus `route_map` / `api_impact` if the repo is indexed. Don't guess which file handles it — confirm by reading it.
|
|
38
|
+
|
|
39
|
+
### 2. Map the Likely Call Path
|
|
40
|
+
|
|
41
|
+
Read the code to sketch the path the input takes: handler → service/business logic → repository/DB → external calls → response construction. This is a static read, not a guess — open each file in the chain before instrumenting it.
|
|
42
|
+
|
|
43
|
+
### 3. Find the Project's Existing Test Pattern
|
|
44
|
+
|
|
45
|
+
Look for an existing test file covering this module or a sibling route/handler. Reuse its conventions: test framework (Jest/Vitest/Mocha/pytest/...), how it mocks the DB/external calls, and — if the entry point is an HTTP handler — how it invokes routes in-process (e.g. `supertest(app).post(...)`, a test client, or a direct call with constructed `req`/`res` objects). Don't invent a new test-setup style if the project already has one.
|
|
46
|
+
|
|
47
|
+
### 4. Choose Checkpoint Locations (Minimal First Pass)
|
|
48
|
+
|
|
49
|
+
Pick roughly **3–6** points, each one a location you'd otherwise set a breakpoint:
|
|
50
|
+
- Function/handler entry — log the raw inputs.
|
|
51
|
+
- Before/after any branch that affects the outcome (the `if` that decides which path is taken).
|
|
52
|
+
- Before/after the suspect data is transformed or persisted.
|
|
53
|
+
- Right before the return value/response is constructed.
|
|
54
|
+
|
|
55
|
+
Instrumenting everything at once defeats the purpose — it's as noisy as not instrumenting at all. Start narrow. If the first pass doesn't localize the divergence, add a **denser second pass** only around the checkpoint where things started going wrong.
|
|
56
|
+
|
|
57
|
+
### 5. Insert Tagged Checkpoints
|
|
58
|
+
|
|
59
|
+
Use a unique, greppable tag per debugging session so the output can be filtered from normal test noise, and log actual values — not just "reached this line":
|
|
60
|
+
|
|
61
|
+
```javascript
|
|
62
|
+
// Node/Express example
|
|
63
|
+
console.error(`[DBG:ORD-482] applyDiscount:entry`, { orderId, discountCode, cartTotal });
|
|
64
|
+
...
|
|
65
|
+
console.error(`[DBG:ORD-482] applyDiscount:afterLookup`, { discountCode, discount });
|
|
66
|
+
...
|
|
67
|
+
console.error(`[DBG:ORD-482] applyDiscount:branch`, { eligible, reason });
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
```python
|
|
71
|
+
# Python example
|
|
72
|
+
print(f"[DBG:ORD-482] apply_discount:entry order_id={order_id} code={discount_code} total={cart_total}")
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
Use whatever the language/runtime's cheapest, most direct output mechanism is (`console.error`, `print`, `System.out.println`, `log.Printf`, ...) — this is throwaway instrumentation, not permanent logging, so it doesn't need to go through the project's logger.
|
|
76
|
+
|
|
77
|
+
### 6. Write the Temporary Test
|
|
78
|
+
|
|
79
|
+
Create a throwaway test file (clearly named, e.g. `tmp.instrumented-debug.test.ts`) that:
|
|
80
|
+
- Builds the input exactly from the payload provided (parse the curl `-d`/`--data` body into the same shape the code expects; map path/query params; construct a minimal `req`/`res` if calling a raw handler, or use the project's in-process route-testing helper found in step 3).
|
|
81
|
+
- Calls the entry point directly — no server start, no real network call.
|
|
82
|
+
- Asserts nothing yet, or asserts only the expected-vs-actual outcome from the bug report — its job here is to **trigger** the checkpoints, not to be a polished regression test.
|
|
83
|
+
|
|
84
|
+
### 7. Run the Test and Collect the Trace
|
|
85
|
+
|
|
86
|
+
Run just that one test file with the project's test runner (e.g. `npx jest tmp.instrumented-debug.test.ts`, `pytest test_tmp_instrumented.py`). Test runners pass through `console.error`/`print` output by default — capture it and filter by the session tag:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
npx jest tmp.instrumented-debug.test.ts 2>&1 | grep 'DBG:ORD-482'
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
### 8. Analyze Checkpoint-by-Checkpoint
|
|
93
|
+
|
|
94
|
+
Walk the checkpoints in order, comparing the logged value against what you expected at that point. The **first checkpoint where the actual value diverges from the expected one** is where the root cause lives — or where you need to trace further back (switch to `root-cause-tracing.md` in this directory if the divergence itself needs tracing to an even earlier source). Once localized, continue into the main `SKILL.md` process: Phase 2 (Pattern Analysis) → Phase 3 (Hypothesis and Testing) → Phase 4 (Implementation).
|
|
95
|
+
|
|
96
|
+
### 9. Mandatory Cleanup
|
|
97
|
+
|
|
98
|
+
Before ending the debugging session:
|
|
99
|
+
|
|
100
|
+
- Delete the temporary test file created in step 6.
|
|
101
|
+
- Remove **every** checkpoint line inserted in step 5.
|
|
102
|
+
- Run `git status`/`git diff` and confirm no debug-only test file or log lines remain in the working tree.
|
|
103
|
+
- If the temporary test turns out to be worth keeping as a real regression test, or a particular log genuinely belongs permanently, that is a **separate, explicit decision** — call it out to the user rather than silently leaving debug scaffolding behind disguised as real code.
|
|
104
|
+
|
|
105
|
+
## Example
|
|
106
|
+
|
|
107
|
+
**Bug report:** `POST /api/orders/482/apply-discount` with body `{ "discountCode": "SAVE10", "cartTotal": 45 }` should return a discount of `10`, but returns `0`.
|
|
108
|
+
|
|
109
|
+
**Checkpoints inserted** (3, first pass):
|
|
110
|
+
|
|
111
|
+
```javascript
|
|
112
|
+
function applyDiscount(orderId, discountCode, cartTotal) {
|
|
113
|
+
console.error(`[DBG:ORD-482] entry`, { orderId, discountCode, cartTotal });
|
|
114
|
+
|
|
115
|
+
const discount = lookupDiscount(discountCode);
|
|
116
|
+
console.error(`[DBG:ORD-482] afterLookup`, { discount });
|
|
117
|
+
|
|
118
|
+
const eligible = cartTotal >= discount.minimumSpend;
|
|
119
|
+
console.error(`[DBG:ORD-482] branch`, { eligible, minimumSpend: discount.minimumSpend });
|
|
120
|
+
|
|
121
|
+
return eligible ? discount.amount : 0;
|
|
122
|
+
}
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
**Temporary test** (`tmp.instrumented-debug.test.ts`), input built directly from the reported payload:
|
|
126
|
+
|
|
127
|
+
```javascript
|
|
128
|
+
const { applyDiscount } = require('../src/orders/discount');
|
|
129
|
+
|
|
130
|
+
test('tmp: trace apply-discount for order 482', () => {
|
|
131
|
+
applyDiscount(482, 'SAVE10', 45);
|
|
132
|
+
});
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
**Trace collected** (`npx jest tmp.instrumented-debug.test.ts 2>&1 | grep DBG:ORD-482`):
|
|
136
|
+
|
|
137
|
+
```
|
|
138
|
+
[DBG:ORD-482] entry { orderId: 482, discountCode: 'SAVE10', cartTotal: 45 }
|
|
139
|
+
[DBG:ORD-482] afterLookup { discount: { amount: 10, minimumSpend: 50 } }
|
|
140
|
+
[DBG:ORD-482] branch { eligible: false, minimumSpend: 50 }
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
**Analysis:** `discountCode` and `discount` lookup are correct — the divergence is at the branch: `cartTotal` (45) is below `minimumSpend` (50), so `eligible` is correctly `false` per the code, but the user expected `SAVE10` to apply regardless of cart total. Root cause is a **data/spec mismatch**, not a code bug: `SAVE10`'s `minimumSpend` was configured wrong. Fix at the source (the discount config), not by patching the branch.
|
|
144
|
+
|
|
145
|
+
**Cleanup:** `tmp.instrumented-debug.test.ts` deleted, all three `console.error` lines removed, `git status` confirmed clean before closing the session.
|
|
146
|
+
|
|
147
|
+
## Key Principle
|
|
148
|
+
|
|
149
|
+
Checkpoints are a stand-in for breakpoints, and a temporary unit test is the stand-in for manually driving the app — reproducible from known input, minimal, tagged, read once, then both the test and the logs are removed. Finding the divergent checkpoint doesn't end the process; it tells you where Phase 2 (Pattern Analysis) should start looking.
|