docs(14-09): Phase 14 closeout — docs, version bump v0.3.0→v0.4.0, security evidence

- CLAUDE.md/AGENTS.md: update current-state line to v0.4.0 Phase 14 complete;
  add Phase 14 shared module map entries (cloud_cache, cloud_analysis,
  cloud_analysis_processing, cloud_analysis_tasks, analysis router, cache API);
  add Phase 14 non-negotiable rules (hydrate_and_cache_bytes single entry point,
  IDs-only broker payload, object_key/credentials_enc excluded at schema level)
- README.md: bump to v0.4.0; add Selective cloud analysis and Cloud byte cache
  features; add Analysis API table (Phase 14 endpoints)
- SECURITY.md: add Phase 14 threat register (T-14-01..T-14-15) with evidence,
  security gate results, and accepted risks
- backend/main.py: bump FastAPI version to 0.4.0
- frontend/package.json: bump version to 0.4.0
- ROADMAP.md: mark Phase 14 complete (9/9 plans), plan 14-09 checked off
- 14-VALIDATION.md: gate evidence, requirement coverage, acceptance criteria check
- 14-SECURITY.md: security evidence summary and gate checklist

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
curo1305
2026-06-23 20:05:49 +02:00
co-authored by Claude Sonnet 4.6
parent 2d697a6036
commit 90e1b525f1
9 changed files with 287 additions and 18 deletions
@@ -0,0 +1,52 @@
# Phase 14 — Security Evidence
**Phase:** 14 — Selective Analysis and Byte Cache
**Audit date:** 2026-06-23
**Auditor:** gsd-execute-phase security gate (claude-sonnet-4-6)
**ASVS Level:** L2
**Status:** SECURED — 0 open threats, 3 accepted risks
## Threat Register Summary
| Threat ID | Threat | Status |
|-----------|--------|--------|
| T-14-01 | IDOR — analysis job or cache entry crosses user boundary | CLOSED |
| T-14-02 | Credential/object_key disclosure in analysis or cache response | CLOSED |
| T-14-03 | Hidden provider file mutation during analysis | CLOSED |
| T-14-04 | Provider bytes downloaded during estimate | CLOSED |
| T-14-05 | Cache quota corruption | CLOSED |
| T-14-06 | Cross-user cache entry access | CLOSED |
| T-14-07 | Analysis job remains visible to admin | CLOSED |
| T-14-08 | Cache status endpoint exposes object_key or credentials_enc | CLOSED |
| T-14-09 | Eviction deletes bytes for pinned active job | CLOSED |
| T-14-10 | Provider credentials in Celery broker payload | CLOSED |
| T-14-11 | Provider mutation during Celery processing | CLOSED |
| T-14-12 | Cache pin leak on processing failure/cancellation | CLOSED |
| T-14-13 | Stale analysis result presented when provider metadata changed | CLOSED |
| T-14-14 | Byte cache delivers stale/wrong bytes | CLOSED |
| T-14-15 | Cache status endpoint exposes per-entry metadata | CLOSED |
Full threat register evidence is documented in `SECURITY.md` at the repository root
under the "Phase 14 — Selective Analysis and Byte Cache" section.
## Security Gate Checklist
- [x] `bandit -r backend/ --exclude backend/tests --severity-level high` — 0 HIGH, 0 MEDIUM
- [x] `npm audit --audit-level=high` — 0 vulnerabilities
- [x] `docker compose config --quiet` — no output (all env vars resolve)
- [x] `gitleaks detect --redact` — 0 new findings (3 pre-existing test-fixture strings from May 2026)
- [x] Backend tests pass: 856 passed
- [x] Frontend tests pass: 471 passed
- [x] Admin blocked from all /analysis/ and /analysis/cache endpoints
- [x] `object_key` and `credentials_enc` absent from `CacheStatusOut`, `AnalysisJobOut`, `AnalysisJobItemOut`
- [x] `process_cloud_analysis_item` Celery task payload contains IDs only
- [x] `FakeCloudAdapter.mutation_call_count == 0` after estimate and full pipeline test
- [x] `FakeCloudAdapter.byte_call_count == 0` after estimate test
## Accepted Risks
| Risk ID | Component | Accepted Risk | Rationale |
|---------|-----------|---------------|-----------|
| T-14-SC-pip | pip-audit local tooling | pip-audit not runnable against Python 3.12 requirements in Python 3.9 local env | No new Python packages added in Phase 14; existing packages audited in Phase 8; same accepted gap as Phases 12 and 13 |
| T-14-docx | test_extract_docx failure | ModuleNotFoundError: python-docx/libmagic not in local test environment | Pre-existing; unrelated to Phase 14 |
| T-14-quota-nonfatal | Quota increment failure is non-fatal for analysis | When quota increment fails, processing continues; cache entry skipped | Only MinIO storage step is omitted; extracted_text and topics durably persisted |
@@ -0,0 +1,62 @@
# Phase 14 — Validation Record
**Phase:** 14 — Selective Analysis and Byte Cache
**Validated:** 2026-06-23
**Validator:** gsd-execute-phase (claude-sonnet-4-6)
**Status:** COMPLETE — all gates passed
## Summary
Phase 14 ships selective cloud analysis (ANALYZE-01 through ANALYZE-07) and a durable byte cache
(CACHE-03, CACHE-04, CACHE-05). All 9 plans were executed, all verification gates pass, and the
version was bumped to v0.4.0 (minor increment per CLAUDE.md protocol for full phase completion).
## Gate Results
| Gate | Check | Result | Evidence |
|------|-------|--------|---------|
| Backend test suite | `pytest -q` | PASS | 856 passed, 18 skipped, 7 xfailed; 1 pre-existing failure (test_extract_docx — docx env) |
| Frontend test suite | `npm run test` | PASS | 471 passed (50 test files) |
| Bandit HIGH severity | `bandit -r backend/ --exclude backend/tests --severity-level high` | PASS | 0 HIGH, 0 MEDIUM; 23 Low (all pre-existing) |
| npm audit | `npm audit --audit-level=high` | PASS | 0 vulnerabilities |
| docker compose config | `docker compose config --quiet` | PASS | No output — all env vars resolve |
| Secret scan | `gitleaks detect --redact` | PASS | 3 pre-existing findings (all before Phase 14) |
| pip-audit | Tooling gap (Python 3.9 local env) | ACCEPTED | No new Python packages in Phase 14; Phase 8 audit clean |
## Requirement Coverage
| Requirement | What Was Built | Plans |
|-------------|---------------|-------|
| ANALYZE-01 | Single-file estimate from metadata; Celery processing | 14-01, 14-04, 14-05 |
| ANALYZE-02 | Multi-selection estimate with unsupported count | 14-01, 14-04 |
| ANALYZE-03 | Folder-tree and whole-connection estimate (recursive) | 14-01, 14-04 |
| ANALYZE-04 | Job status with simple/detailed aggregate and per-stage counts | 14-04, 14-07 |
| ANALYZE-05 | Per-item cancel, skip, retry; Cancel all batch | 14-04, 14-07 |
| ANALYZE-06 | Already-current detection via version_key; changed etag triggers requeue | 14-02, 14-04 |
| ANALYZE-07 | Provider mutation methods never called during analysis | 14-03, 14-05 |
| CACHE-03 | Cache entry created during analysis; browse never creates cache entries | 14-02, 14-03 |
| CACHE-04 | Configurable cache limit; LRU eviction skips pinned entries | 14-02, 14-03, 14-08 |
| CACHE-05 | Cache quota increment/decrement; per-user isolation | 14-02, 14-03 |
## Phase Acceptance Criteria Check
1. **Users can analyze one file, multi-selection, folder tree, or whole connection after reviewing recursive estimates.**
Status: PASS — estimate API + frontend modal implemented (14-04, 14-07).
2. **UI exposes aggregate and per-item states with retry and cancellation.**
Status: PASS — analysis queue with expand/collapse, per-item cancel/retry/skip, Cancel all batch (14-07).
3. **Analysis jobs are idempotent by cloud item and provider version/etag; never mutate the provider.**
Status: PASS — already-current detection, stale guard, mutation_call_count==0 test (14-04, 14-05).
4. **Cloud bytes cached only for active work and evicted by configurable limits without interrupting pinned active jobs.**
Status: PASS — LRU eviction skips pin_count>0, cache limit configurable, Settings UI (14-03, 14-08).
5. **Cache ownership, cache-key versioning, cancellation, duplicate-job, failure-retry, and eviction have dedicated tests.**
Status: PASS — test_cloud_cache.py (30 tests), test_cloud_analysis_contract.py (47 tests), test_cloud_analysis_api.py (14 tests), test_cloud_security.py (analysis/cache subset).
## Pre-Existing Issues (Not Phase 14 Scope)
- `test_extract_docx``ModuleNotFoundError: No module named 'docx'` — python-docx/libmagic not installed in local test environment. Pre-existing; not a Phase 14 regression.
- pip-audit local tooling gap — Python 3.9 local environment cannot install pip-audit for Python 3.12 requirements. Accepted risk (same gap as Phases 12 and 13). No new Python packages were added in Phase 14.
- gitleaks 3 pre-existing findings — all in test files committed before Phase 14 (May 2026).