chati-dev 1.3.3 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -6
- package/framework/agents/build/dev.md +343 -0
- package/framework/agents/clarity/architect.md +113 -0
- package/framework/agents/clarity/brief.md +183 -0
- package/framework/agents/clarity/brownfield-wu.md +182 -0
- package/framework/agents/clarity/detail.md +111 -0
- package/framework/agents/clarity/greenfield-wu.md +154 -0
- package/framework/agents/clarity/phases.md +1 -0
- package/framework/agents/clarity/tasks.md +1 -0
- package/framework/agents/clarity/ux.md +113 -0
- package/framework/agents/deploy/devops.md +1 -0
- package/framework/agents/quality/qa-implementation.md +1 -0
- package/framework/agents/quality/qa-planning.md +1 -0
- package/framework/config.yaml +3 -3
- package/framework/constitution.md +58 -1
- package/framework/context/governance.md +37 -0
- package/framework/context/protocols.md +34 -0
- package/framework/context/quality.md +27 -0
- package/framework/context/root.md +24 -0
- package/framework/data/entity-registry.yaml +1 -1
- package/framework/domains/agents/architect.yaml +51 -0
- package/framework/domains/agents/brief.yaml +47 -0
- package/framework/domains/agents/brownfield-wu.yaml +49 -0
- package/framework/domains/agents/detail.yaml +47 -0
- package/framework/domains/agents/dev.yaml +49 -0
- package/framework/domains/agents/devops.yaml +43 -0
- package/framework/domains/agents/greenfield-wu.yaml +47 -0
- package/framework/domains/agents/orchestrator.yaml +49 -0
- package/framework/domains/agents/phases.yaml +47 -0
- package/framework/domains/agents/qa-implementation.yaml +43 -0
- package/framework/domains/agents/qa-planning.yaml +44 -0
- package/framework/domains/agents/tasks.yaml +48 -0
- package/framework/domains/agents/ux.yaml +50 -0
- package/framework/domains/constitution.yaml +77 -0
- package/framework/domains/global.yaml +64 -0
- package/framework/domains/workflows/brownfield-discovery.yaml +16 -0
- package/framework/domains/workflows/brownfield-fullstack.yaml +26 -0
- package/framework/domains/workflows/brownfield-service.yaml +22 -0
- package/framework/domains/workflows/brownfield-ui.yaml +22 -0
- package/framework/domains/workflows/greenfield-fullstack.yaml +26 -0
- package/framework/hooks/constitution-guard.js +101 -0
- package/framework/hooks/mode-governance.js +92 -0
- package/framework/hooks/model-governance.js +76 -0
- package/framework/hooks/prism-engine.js +89 -0
- package/framework/hooks/session-digest.js +60 -0
- package/framework/hooks/settings.json +44 -0
- package/framework/i18n/en.yaml +3 -3
- package/framework/i18n/es.yaml +3 -3
- package/framework/i18n/fr.yaml +3 -3
- package/framework/i18n/pt.yaml +3 -3
- package/framework/intelligence/context-engine.md +2 -2
- package/framework/intelligence/decision-engine.md +1 -1
- package/framework/migrations/v1.4-to-v2.0.yaml +167 -0
- package/framework/migrations/v2.0-to-v2.0.1.yaml +132 -0
- package/framework/orchestrator/chati.md +350 -7
- package/framework/schemas/session.schema.json +15 -0
- package/framework/tasks/architect-api-design.md +63 -0
- package/framework/tasks/architect-consolidate.md +47 -0
- package/framework/tasks/architect-db-design.md +73 -0
- package/framework/tasks/architect-design.md +95 -0
- package/framework/tasks/architect-security-review.md +62 -0
- package/framework/tasks/architect-stack-selection.md +53 -0
- package/framework/tasks/brief-consolidate.md +249 -0
- package/framework/tasks/brief-constraint-identify.md +277 -0
- package/framework/tasks/brief-extract-requirements.md +339 -0
- package/framework/tasks/brief-stakeholder-map.md +176 -0
- package/framework/tasks/brief-validate-completeness.md +121 -0
- package/framework/tasks/brownfield-wu-architecture-map.md +394 -0
- package/framework/tasks/brownfield-wu-deep-discovery.md +312 -0
- package/framework/tasks/brownfield-wu-dependency-scan.md +359 -0
- package/framework/tasks/brownfield-wu-migration-plan.md +483 -0
- package/framework/tasks/brownfield-wu-report.md +325 -0
- package/framework/tasks/brownfield-wu-risk-assess.md +424 -0
- package/framework/tasks/detail-acceptance-criteria.md +372 -0
- package/framework/tasks/detail-consolidate.md +138 -0
- package/framework/tasks/detail-edge-case-analysis.md +300 -0
- package/framework/tasks/detail-expand-prd.md +389 -0
- package/framework/tasks/detail-nfr-extraction.md +223 -0
- package/framework/tasks/dev-code-review.md +404 -0
- package/framework/tasks/dev-consolidate.md +543 -0
- package/framework/tasks/dev-debug.md +322 -0
- package/framework/tasks/dev-implement.md +252 -0
- package/framework/tasks/dev-iterate.md +411 -0
- package/framework/tasks/dev-pr-prepare.md +497 -0
- package/framework/tasks/dev-refactor.md +342 -0
- package/framework/tasks/dev-test-write.md +306 -0
- package/framework/tasks/devops-ci-setup.md +412 -0
- package/framework/tasks/devops-consolidate.md +712 -0
- package/framework/tasks/devops-deploy-config.md +598 -0
- package/framework/tasks/devops-monitoring-setup.md +658 -0
- package/framework/tasks/devops-release-prepare.md +673 -0
- package/framework/tasks/greenfield-wu-analyze-empty.md +169 -0
- package/framework/tasks/greenfield-wu-report.md +266 -0
- package/framework/tasks/greenfield-wu-scaffold-detection.md +203 -0
- package/framework/tasks/greenfield-wu-tech-stack-assess.md +255 -0
- package/framework/tasks/orchestrator-deviation.md +260 -0
- package/framework/tasks/orchestrator-escalate.md +276 -0
- package/framework/tasks/orchestrator-handoff.md +243 -0
- package/framework/tasks/orchestrator-health.md +372 -0
- package/framework/tasks/orchestrator-mode-switch.md +262 -0
- package/framework/tasks/orchestrator-resume.md +189 -0
- package/framework/tasks/orchestrator-route.md +169 -0
- package/framework/tasks/orchestrator-spawn-terminal.md +358 -0
- package/framework/tasks/orchestrator-status.md +260 -0
- package/framework/tasks/orchestrator-suggest-mode.md +372 -0
- package/framework/tasks/phases-breakdown.md +91 -0
- package/framework/tasks/phases-dependency-mapping.md +67 -0
- package/framework/tasks/phases-mvp-scoping.md +94 -0
- package/framework/tasks/qa-impl-consolidate.md +522 -0
- package/framework/tasks/qa-impl-performance-test.md +487 -0
- package/framework/tasks/qa-impl-regression-check.md +413 -0
- package/framework/tasks/qa-impl-sast-scan.md +402 -0
- package/framework/tasks/qa-impl-test-execute.md +344 -0
- package/framework/tasks/qa-impl-verdict.md +339 -0
- package/framework/tasks/qa-planning-consolidate.md +309 -0
- package/framework/tasks/qa-planning-coverage-plan.md +338 -0
- package/framework/tasks/qa-planning-gate-define.md +339 -0
- package/framework/tasks/qa-planning-risk-matrix.md +631 -0
- package/framework/tasks/qa-planning-test-strategy.md +217 -0
- package/framework/tasks/tasks-acceptance-write.md +75 -0
- package/framework/tasks/tasks-consolidate.md +57 -0
- package/framework/tasks/tasks-decompose.md +80 -0
- package/framework/tasks/tasks-estimate.md +66 -0
- package/framework/tasks/ux-a11y-check.md +49 -0
- package/framework/tasks/ux-component-map.md +55 -0
- package/framework/tasks/ux-consolidate.md +46 -0
- package/framework/tasks/ux-user-flow.md +46 -0
- package/framework/tasks/ux-wireframe.md +76 -0
- package/package.json +1 -1
- package/scripts/bundle-framework.js +2 -0
- package/scripts/changelog-generator.js +222 -0
- package/scripts/codebase-mapper.js +728 -0
- package/scripts/commit-message-generator.js +167 -0
- package/scripts/coverage-analyzer.js +260 -0
- package/scripts/dependency-analyzer.js +280 -0
- package/scripts/framework-analyzer.js +308 -0
- package/scripts/generate-constitution-domain.js +253 -0
- package/scripts/health-check.js +481 -0
- package/scripts/ide-sync.js +327 -0
- package/scripts/performance-analyzer.js +325 -0
- package/scripts/plan-tracker.js +278 -0
- package/scripts/populate-entity-registry.js +481 -0
- package/scripts/pr-review.js +317 -0
- package/scripts/rollback-manager.js +310 -0
- package/scripts/stuck-detector.js +343 -0
- package/scripts/test-quality-assessment.js +257 -0
- package/scripts/validate-agents.js +367 -0
- package/scripts/validate-tasks.js +465 -0
- package/src/autonomy/autonomous-gate.js +293 -0
- package/src/autonomy/index.js +51 -0
- package/src/autonomy/mode-manager.js +225 -0
- package/src/autonomy/mode-suggester.js +283 -0
- package/src/autonomy/progress-reporter.js +268 -0
- package/src/autonomy/safety-net.js +320 -0
- package/src/context/bracket-tracker.js +79 -0
- package/src/context/domain-loader.js +107 -0
- package/src/context/engine.js +144 -0
- package/src/context/formatter.js +184 -0
- package/src/context/index.js +4 -0
- package/src/context/layers/l0-constitution.js +28 -0
- package/src/context/layers/l1-global.js +37 -0
- package/src/context/layers/l2-agent.js +39 -0
- package/src/context/layers/l3-workflow.js +42 -0
- package/src/context/layers/l4-task.js +24 -0
- package/src/decision/analyzer.js +167 -0
- package/src/decision/engine.js +270 -0
- package/src/decision/index.js +38 -0
- package/src/decision/registry-healer.js +450 -0
- package/src/decision/registry-updater.js +330 -0
- package/src/gates/circuit-breaker.js +119 -0
- package/src/gates/g1-planning-complete.js +153 -0
- package/src/gates/g2-qa-planning.js +153 -0
- package/src/gates/g3-implementation.js +188 -0
- package/src/gates/g4-qa-implementation.js +207 -0
- package/src/gates/g5-deploy-ready.js +180 -0
- package/src/gates/gate-base.js +144 -0
- package/src/gates/index.js +46 -0
- package/src/installer/brownfield-upgrader.js +249 -0
- package/src/installer/core.js +55 -3
- package/src/installer/file-hasher.js +51 -0
- package/src/installer/manifest.js +117 -0
- package/src/installer/templates.js +17 -15
- package/src/installer/transaction.js +229 -0
- package/src/installer/validator.js +18 -1
- package/src/intelligence/registry-manager.js +2 -2
- package/src/memory/agent-memory.js +255 -0
- package/src/memory/gotchas-injector.js +72 -0
- package/src/memory/gotchas.js +361 -0
- package/src/memory/index.js +35 -0
- package/src/memory/search.js +233 -0
- package/src/memory/session-digest.js +239 -0
- package/src/merger/env-merger.js +112 -0
- package/src/merger/index.js +56 -0
- package/src/merger/replace-merger.js +51 -0
- package/src/merger/yaml-merger.js +127 -0
- package/src/orchestrator/agent-selector.js +285 -0
- package/src/orchestrator/deviation-handler.js +350 -0
- package/src/orchestrator/handoff-engine.js +271 -0
- package/src/orchestrator/index.js +67 -0
- package/src/orchestrator/intent-classifier.js +264 -0
- package/src/orchestrator/pipeline-manager.js +492 -0
- package/src/orchestrator/pipeline-state.js +223 -0
- package/src/orchestrator/session-manager.js +409 -0
- package/src/tasks/executor.js +195 -0
- package/src/tasks/handoff.js +226 -0
- package/src/tasks/index.js +4 -0
- package/src/tasks/loader.js +210 -0
- package/src/tasks/router.js +182 -0
- package/src/terminal/collector.js +216 -0
- package/src/terminal/index.js +30 -0
- package/src/terminal/isolation.js +129 -0
- package/src/terminal/monitor.js +277 -0
- package/src/terminal/spawner.js +269 -0
- package/src/upgrade/checker.js +1 -1
- package/src/wizard/i18n.js +3 -3
|
@@ -0,0 +1,402 @@
|
|
|
1
|
+
---
|
|
2
|
+
id: qa-impl-sast-scan
|
|
3
|
+
agent: qa-implementation
|
|
4
|
+
trigger: qa-impl-test-execute
|
|
5
|
+
phase: build
|
|
6
|
+
requires_input: false
|
|
7
|
+
parallelizable: false
|
|
8
|
+
outputs: [sast-report.yaml]
|
|
9
|
+
handoff_to: qa-impl-regression-check
|
|
10
|
+
autonomous_gate: false
|
|
11
|
+
criteria:
|
|
12
|
+
- SAST scan executed successfully
|
|
13
|
+
- Zero critical vulnerabilities
|
|
14
|
+
- High severity vulnerabilities under threshold
|
|
15
|
+
- Findings categorized and prioritized
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
# Static Analysis Security Testing
|
|
19
|
+
|
|
20
|
+
## Purpose
|
|
21
|
+
Run static analysis security testing (SAST) to identify security vulnerabilities, code quality issues, and potential bugs in the codebase before deployment.
|
|
22
|
+
|
|
23
|
+
## Prerequisites
|
|
24
|
+
- test-results.yaml with PASS status (all tests passing)
|
|
25
|
+
- SAST tools configured (eslint-plugin-security, semgrep, or similar)
|
|
26
|
+
- Codebase committed to version control (for diff analysis)
|
|
27
|
+
- qa-plan.yaml with SAST thresholds
|
|
28
|
+
|
|
29
|
+
## Steps
|
|
30
|
+
|
|
31
|
+
1. **Verify SAST Tool Configuration**
|
|
32
|
+
- Check for eslint-plugin-security in package.json or .eslintrc
|
|
33
|
+
- Verify additional SAST tools if configured (semgrep, snyk code)
|
|
34
|
+
- Ensure SAST rules are enabled (not just warnings)
|
|
35
|
+
- Validate rule severity levels (error vs warning vs info)
|
|
36
|
+
|
|
37
|
+
2. **Run ESLint Security Scan**
|
|
38
|
+
- Execute: `npm run lint -- --plugin security` or `eslint . --ext .js,.ts`
|
|
39
|
+
- Capture all findings with file, line, rule, severity
|
|
40
|
+
- Parse ESLint output (JSON format recommended)
|
|
41
|
+
- Save raw output to sast-results/eslint-output.json
|
|
42
|
+
|
|
43
|
+
3. **Run Additional SAST Tools (if configured)**
|
|
44
|
+
- **Semgrep**: `semgrep --config auto --json`
|
|
45
|
+
- **npm audit**: `npm audit --json` (dependency vulnerabilities)
|
|
46
|
+
- **Snyk Code**: `snyk code test --json` (if available)
|
|
47
|
+
- Collect findings from each tool
|
|
48
|
+
- Normalize findings to common format
|
|
49
|
+
|
|
50
|
+
4. **Categorize Findings by Severity**
|
|
51
|
+
- **CRITICAL**: Remote code execution, SQL injection, command injection, hardcoded secrets
|
|
52
|
+
- **HIGH**: Cross-site scripting, path traversal, insecure deserialization, weak crypto
|
|
53
|
+
- **MEDIUM**: Information disclosure, missing input validation, error handling issues
|
|
54
|
+
- **LOW**: Code quality, complexity, deprecated APIs, minor security practices
|
|
55
|
+
|
|
56
|
+
5. **Categorize Findings by Type**
|
|
57
|
+
- **Security vulnerabilities**: Exploitable flaws
|
|
58
|
+
- **Code quality issues**: Maintainability, readability, best practices
|
|
59
|
+
- **Performance issues**: Inefficient algorithms, memory leaks
|
|
60
|
+
- **Compatibility issues**: Deprecated APIs, version-specific problems
|
|
61
|
+
|
|
62
|
+
6. **Filter False Positives**
|
|
63
|
+
- Review findings for common false positives:
|
|
64
|
+
- Safe uses of eval() (e.g., in sandboxed contexts)
|
|
65
|
+
- Path operations on validated inputs
|
|
66
|
+
- Non-user-facing information disclosure
|
|
67
|
+
- Mark suspected false positives for manual review
|
|
68
|
+
- Document filtering decisions in sast-report.yaml
|
|
69
|
+
|
|
70
|
+
7. **Map Findings to Risk Areas**
|
|
71
|
+
- Cross-reference findings with risk-matrix.yaml
|
|
72
|
+
- Flag findings in critical-risk modules (state management, file operations)
|
|
73
|
+
- Prioritize findings in high-risk modules (orchestrator, agents)
|
|
74
|
+
- Note findings in low-risk modules for later review
|
|
75
|
+
|
|
76
|
+
8. **Check Against Quality Gates**
|
|
77
|
+
- **BLOCKER threshold**: 0 critical vulnerabilities (from quality-gates.yaml)
|
|
78
|
+
- **CRITICAL threshold**: < 3 high severity vulnerabilities
|
|
79
|
+
- **MAJOR threshold**: < 10 medium severity issues
|
|
80
|
+
- Calculate gate status (PASS, FAIL, WARN)
|
|
81
|
+
|
|
82
|
+
9. **Analyze Trends (if historical data available)**
|
|
83
|
+
- Compare findings with previous scan (if available)
|
|
84
|
+
- Track new vulnerabilities introduced in this sprint
|
|
85
|
+
- Track resolved vulnerabilities since last scan
|
|
86
|
+
- Calculate vulnerability velocity (new - resolved per sprint)
|
|
87
|
+
|
|
88
|
+
10. **Generate Remediation Guidance**
|
|
89
|
+
- For each CRITICAL/HIGH finding:
|
|
90
|
+
- Provide fix recommendation (code example if possible)
|
|
91
|
+
- Link to security best practices documentation
|
|
92
|
+
- Estimate fix effort (trivial, minor, major)
|
|
93
|
+
- Suggest alternative approaches if fix is complex
|
|
94
|
+
|
|
95
|
+
11. **Create Exceptions List**
|
|
96
|
+
- Document accepted vulnerabilities (with justification):
|
|
97
|
+
- Why vulnerability is not exploitable in this context
|
|
98
|
+
- Compensating controls in place
|
|
99
|
+
- Timeline for eventual remediation
|
|
100
|
+
- Require approval for critical/high exceptions
|
|
101
|
+
|
|
102
|
+
12. **Compile SAST Report**
|
|
103
|
+
- Summarize findings by severity and type
|
|
104
|
+
- List all CRITICAL and HIGH findings with details
|
|
105
|
+
- Provide overall gate status (PASS, FAIL, CONDITIONAL)
|
|
106
|
+
- Include remediation roadmap
|
|
107
|
+
- Update session.yaml with scan results
|
|
108
|
+
|
|
109
|
+
## Decision Points
|
|
110
|
+
|
|
111
|
+
- **False Positive Threshold**: If >30% of findings appear to be false positives, consider adjusting SAST rules or adding project-specific exclusions. Document rule adjustments in .eslintrc with comments.
|
|
112
|
+
|
|
113
|
+
- **High Severity Exceptions**: If high-severity findings are in third-party dependencies (not fixable immediately), decide whether to accept risk or block release. Recommend: Accept with compensating controls + plan to upgrade dependency.
|
|
114
|
+
|
|
115
|
+
- **Code Quality vs Security**: If scan finds many code quality issues but few security issues, decide whether to report separately or include in SAST report. Recommend: Include summary in SAST report, detail in separate code-quality report.
|
|
116
|
+
|
|
117
|
+
## Error Handling
|
|
118
|
+
|
|
119
|
+
**SAST Tool Not Installed**
|
|
120
|
+
- If eslint-plugin-security is not installed, attempt: `npm install --save-dev eslint-plugin-security`
|
|
121
|
+
- If installation fails, log warning and proceed with basic eslint scan
|
|
122
|
+
- Flag missing SAST tool in report
|
|
123
|
+
- Recommend: Install proper SAST tooling for future scans
|
|
124
|
+
|
|
125
|
+
**Scan Timeout or Failure**
|
|
126
|
+
- If scan hangs or crashes, check for large files or complex code
|
|
127
|
+
- Try scanning in chunks (by directory)
|
|
128
|
+
- If still fails, proceed with partial results
|
|
129
|
+
- Log error and recommend manual security review
|
|
130
|
+
|
|
131
|
+
**Unparseable Output**
|
|
132
|
+
- If SAST tool output is in unexpected format, save raw output
|
|
133
|
+
- Attempt manual parsing for critical findings
|
|
134
|
+
- Provide summary based on exit code (non-zero = issues found)
|
|
135
|
+
- Recommend: Configure tool for JSON output
|
|
136
|
+
|
|
137
|
+
**Dependency Vulnerability Scan Failure**
|
|
138
|
+
- If npm audit fails (network issue, registry unavailable), log warning
|
|
139
|
+
- Proceed with code SAST only
|
|
140
|
+
- Flag missing dependency scan in report
|
|
141
|
+
- Recommend: Retry later or use alternative (Snyk, GitHub Dependabot)
|
|
142
|
+
|
|
143
|
+
## Output Format
|
|
144
|
+
|
|
145
|
+
```yaml
|
|
146
|
+
# sast-report.yaml
|
|
147
|
+
version: 1.0.0
|
|
148
|
+
created: YYYY-MM-DD
|
|
149
|
+
agent: qa-implementation
|
|
150
|
+
phase: build
|
|
151
|
+
|
|
152
|
+
summary:
|
|
153
|
+
status: CONDITIONAL # PASS, FAIL, CONDITIONAL
|
|
154
|
+
total_findings: 23
|
|
155
|
+
critical: 0
|
|
156
|
+
high: 2
|
|
157
|
+
medium: 8
|
|
158
|
+
low: 13
|
|
159
|
+
false_positives_suspected: 3
|
|
160
|
+
|
|
161
|
+
tools:
|
|
162
|
+
eslint:
|
|
163
|
+
version: 8.x
|
|
164
|
+
plugins: [security, node, import]
|
|
165
|
+
exit_code: 1 # non-zero indicates issues
|
|
166
|
+
findings: 18
|
|
167
|
+
output_file: sast-results/eslint-output.json
|
|
168
|
+
|
|
169
|
+
npm_audit:
|
|
170
|
+
version: npm 10.x
|
|
171
|
+
findings: 5
|
|
172
|
+
output_file: sast-results/npm-audit.json
|
|
173
|
+
|
|
174
|
+
semgrep:
|
|
175
|
+
enabled: false
|
|
176
|
+
|
|
177
|
+
snyk_code:
|
|
178
|
+
enabled: false
|
|
179
|
+
|
|
180
|
+
findings:
|
|
181
|
+
critical: []
|
|
182
|
+
|
|
183
|
+
high:
|
|
184
|
+
- id: SAST-001
|
|
185
|
+
severity: HIGH
|
|
186
|
+
type: security
|
|
187
|
+
rule: detect-non-literal-fs-filename
|
|
188
|
+
file: chati.dev/utils/file-ops.js
|
|
189
|
+
line: 78
|
|
190
|
+
message: "Potential path traversal: fs.readFile with non-literal filename"
|
|
191
|
+
code_snippet: |
|
|
192
|
+
const data = fs.readFileSync(userProvidedPath, 'utf8');
|
|
193
|
+
risk_area: file_operations
|
|
194
|
+
risk_level: high
|
|
195
|
+
exploitable: true
|
|
196
|
+
cvss_score: 7.5
|
|
197
|
+
recommendation: |
|
|
198
|
+
Validate and sanitize userProvidedPath before use:
|
|
199
|
+
```javascript
|
|
200
|
+
const safePath = path.normalize(userProvidedPath).replace(/^(\.\.(\/|\\|$))+/, '');
|
|
201
|
+
if (!safePath.startsWith(ALLOWED_BASE_DIR)) {
|
|
202
|
+
throw new Error('Invalid path');
|
|
203
|
+
}
|
|
204
|
+
const data = fs.readFileSync(safePath, 'utf8');
|
|
205
|
+
```
|
|
206
|
+
effort: minor
|
|
207
|
+
references:
|
|
208
|
+
- https://owasp.org/www-community/attacks/Path_Traversal
|
|
209
|
+
|
|
210
|
+
- id: SAST-002
|
|
211
|
+
severity: HIGH
|
|
212
|
+
type: security
|
|
213
|
+
rule: detect-child-process
|
|
214
|
+
file: chati.dev/cli/commands/upgrade.js
|
|
215
|
+
line: 156
|
|
216
|
+
message: "Command injection risk: exec with user input"
|
|
217
|
+
code_snippet: |
|
|
218
|
+
exec(`npm install ${packageName}@latest`);
|
|
219
|
+
risk_area: upgrade
|
|
220
|
+
risk_level: high
|
|
221
|
+
exploitable: true
|
|
222
|
+
cvss_score: 8.1
|
|
223
|
+
recommendation: |
|
|
224
|
+
Use execFile with array arguments to prevent injection:
|
|
225
|
+
```javascript
|
|
226
|
+
execFile('npm', ['install', `${packageName}@latest`]);
|
|
227
|
+
```
|
|
228
|
+
effort: trivial
|
|
229
|
+
references:
|
|
230
|
+
- https://owasp.org/www-community/attacks/Command_Injection
|
|
231
|
+
|
|
232
|
+
medium:
|
|
233
|
+
- id: SAST-003
|
|
234
|
+
severity: MEDIUM
|
|
235
|
+
type: security
|
|
236
|
+
rule: detect-no-csrf-before-method-override
|
|
237
|
+
file: chati.dev/orchestrator.js
|
|
238
|
+
line: 234
|
|
239
|
+
message: "Missing input validation on user input"
|
|
240
|
+
risk_area: orchestrator
|
|
241
|
+
risk_level: medium
|
|
242
|
+
exploitable: false
|
|
243
|
+
recommendation: "Add Joi/Yup schema validation for user input"
|
|
244
|
+
effort: minor
|
|
245
|
+
|
|
246
|
+
low:
|
|
247
|
+
- id: SAST-004
|
|
248
|
+
severity: LOW
|
|
249
|
+
type: code_quality
|
|
250
|
+
rule: no-console
|
|
251
|
+
file: chati.dev/agents/brief.js
|
|
252
|
+
line: 89
|
|
253
|
+
message: "console.log found in production code"
|
|
254
|
+
risk_area: agents
|
|
255
|
+
risk_level: low
|
|
256
|
+
recommendation: "Replace with proper logging (winston, pino)"
|
|
257
|
+
effort: trivial
|
|
258
|
+
|
|
259
|
+
false_positives:
|
|
260
|
+
- id: SAST-005
|
|
261
|
+
finding: "eval() usage detected"
|
|
262
|
+
file: chati.dev/parsers/template-renderer.js
|
|
263
|
+
line: 112
|
|
264
|
+
justification: "Template rendering in sandboxed VM context, not user-controllable"
|
|
265
|
+
reviewed_by: qa-implementation
|
|
266
|
+
accepted: true
|
|
267
|
+
|
|
268
|
+
- id: SAST-006
|
|
269
|
+
finding: "Regex complexity (ReDoS risk)"
|
|
270
|
+
file: chati.dev/validators/yaml-schema.js
|
|
271
|
+
line: 45
|
|
272
|
+
justification: "Regex operates on trusted YAML schema, not user input"
|
|
273
|
+
reviewed_by: qa-implementation
|
|
274
|
+
accepted: true
|
|
275
|
+
|
|
276
|
+
dependency_vulnerabilities:
|
|
277
|
+
critical: 0
|
|
278
|
+
high: 0
|
|
279
|
+
medium: 1
|
|
280
|
+
low: 4
|
|
281
|
+
|
|
282
|
+
findings:
|
|
283
|
+
- id: DEP-001
|
|
284
|
+
severity: MEDIUM
|
|
285
|
+
package: yaml@2.3.1
|
|
286
|
+
vulnerability: Prototype Pollution
|
|
287
|
+
cvss_score: 5.3
|
|
288
|
+
cwe: CWE-1321
|
|
289
|
+
fixed_in: yaml@2.3.4
|
|
290
|
+
recommendation: "Upgrade to yaml@2.3.4 or later"
|
|
291
|
+
exploitable: false # not user-facing in this context
|
|
292
|
+
|
|
293
|
+
quality_gates:
|
|
294
|
+
critical_threshold:
|
|
295
|
+
target: 0
|
|
296
|
+
actual: 0
|
|
297
|
+
status: PASS
|
|
298
|
+
|
|
299
|
+
high_threshold:
|
|
300
|
+
target: "< 3"
|
|
301
|
+
actual: 2
|
|
302
|
+
status: PASS
|
|
303
|
+
|
|
304
|
+
medium_threshold:
|
|
305
|
+
target: "< 10"
|
|
306
|
+
actual: 8
|
|
307
|
+
status: PASS
|
|
308
|
+
|
|
309
|
+
overall_status: CONDITIONAL # Due to HIGH findings requiring fixes
|
|
310
|
+
|
|
311
|
+
risk_mapping:
|
|
312
|
+
critical_risk_areas:
|
|
313
|
+
- area: state_management
|
|
314
|
+
findings: 0
|
|
315
|
+
|
|
316
|
+
- area: mode_governance
|
|
317
|
+
findings: 0
|
|
318
|
+
|
|
319
|
+
- area: file_operations
|
|
320
|
+
findings: 1 HIGH (SAST-001)
|
|
321
|
+
|
|
322
|
+
high_risk_areas:
|
|
323
|
+
- area: orchestrator
|
|
324
|
+
findings: 1 MEDIUM (SAST-003)
|
|
325
|
+
|
|
326
|
+
- area: upgrade
|
|
327
|
+
findings: 1 HIGH (SAST-002)
|
|
328
|
+
|
|
329
|
+
trends:
|
|
330
|
+
previous_scan_date: YYYY-MM-DD (or null if first scan)
|
|
331
|
+
new_vulnerabilities: 2
|
|
332
|
+
resolved_vulnerabilities: 0
|
|
333
|
+
vulnerability_velocity: +2 per sprint
|
|
334
|
+
|
|
335
|
+
remediation_roadmap:
|
|
336
|
+
priority_1_blocking:
|
|
337
|
+
- SAST-001: Path traversal in file-ops.js (HIGH, exploitable)
|
|
338
|
+
- SAST-002: Command injection in upgrade.js (HIGH, exploitable)
|
|
339
|
+
|
|
340
|
+
priority_2_pre_release:
|
|
341
|
+
- SAST-003: Missing input validation in orchestrator.js (MEDIUM)
|
|
342
|
+
- DEP-001: Upgrade yaml package (MEDIUM)
|
|
343
|
+
|
|
344
|
+
priority_3_post_release:
|
|
345
|
+
- Code quality issues (LOW severity)
|
|
346
|
+
- Replace console.log with proper logging
|
|
347
|
+
|
|
348
|
+
estimated_effort:
|
|
349
|
+
priority_1: 2-4 hours
|
|
350
|
+
priority_2: 2-3 hours
|
|
351
|
+
priority_3: 1-2 hours
|
|
352
|
+
|
|
353
|
+
exceptions:
|
|
354
|
+
- id: SAST-005
|
|
355
|
+
vulnerability: eval() in template renderer
|
|
356
|
+
severity: MEDIUM (if exploitable)
|
|
357
|
+
justification: Sandboxed VM context, template source trusted
|
|
358
|
+
compensating_controls:
|
|
359
|
+
- Templates stored in chati.dev/templates (not user-modifiable)
|
|
360
|
+
- VM sandbox with no access to filesystem or network
|
|
361
|
+
approved_by: Tech Lead
|
|
362
|
+
review_date: quarterly
|
|
363
|
+
residual_risk: LOW
|
|
364
|
+
|
|
365
|
+
assessment:
|
|
366
|
+
status: CONDITIONAL
|
|
367
|
+
rationale: |
|
|
368
|
+
- 0 CRITICAL vulnerabilities (meets threshold)
|
|
369
|
+
- 2 HIGH vulnerabilities (meets threshold < 3)
|
|
370
|
+
- Both HIGH vulnerabilities are exploitable and require fixes
|
|
371
|
+
- 1 MEDIUM dependency vulnerability (upgrade available)
|
|
372
|
+
|
|
373
|
+
blocking_issues:
|
|
374
|
+
- SAST-001: Path traversal in file-ops.js (HIGH, exploitable)
|
|
375
|
+
- SAST-002: Command injection in upgrade.js (HIGH, exploitable)
|
|
376
|
+
|
|
377
|
+
conditional_pass_criteria:
|
|
378
|
+
- Fix both HIGH severity exploitable vulnerabilities
|
|
379
|
+
- Upgrade yaml package to 2.3.4+
|
|
380
|
+
- Re-run SAST scan to verify fixes
|
|
381
|
+
- Medium and low findings can be deferred to next sprint
|
|
382
|
+
|
|
383
|
+
recommendations:
|
|
384
|
+
- Priority 1: Fix SAST-001 with path validation (2 hours)
|
|
385
|
+
- Priority 2: Fix SAST-002 with execFile (1 hour)
|
|
386
|
+
- Priority 3: Upgrade yaml dependency (30 minutes)
|
|
387
|
+
- Schedule code quality fixes for next sprint
|
|
388
|
+
|
|
389
|
+
next_steps:
|
|
390
|
+
- Return to dev agent for HIGH vulnerability remediation
|
|
391
|
+
- Re-run qa-impl-sast-scan after fixes
|
|
392
|
+
- If rerun passes (0 HIGH exploitable), proceed to qa-impl-regression-check
|
|
393
|
+
- Track LOW/MEDIUM findings in backlog for future sprints
|
|
394
|
+
|
|
395
|
+
handoff:
|
|
396
|
+
to: dev
|
|
397
|
+
reason: HIGH severity exploitable vulnerabilities
|
|
398
|
+
priority_fixes:
|
|
399
|
+
- file-ops.js: Add path validation to prevent traversal
|
|
400
|
+
- upgrade.js: Replace exec with execFile for command injection prevention
|
|
401
|
+
- package.json: Upgrade yaml@2.3.1 to yaml@2.3.4
|
|
402
|
+
```
|