> For the complete documentation index, see [llms.txt](https://faction-os.gitbook.io/faction-os-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://faction-os.gitbook.io/faction-os-docs/.spec_system/archive/sessions/phase01-session06-llm-fallback-and-scan-privacy/security-compliance.md).

# Security & Compliance Report

**Session ID**: `phase01-session06-llm-fallback-and-scan-privacy` **Package**: apps/server **Reviewed**: 2026-05-29 **Result**: PASS

***

## Scope

**Files reviewed** (session deliverables only):

* `apps/server/src/lib/llmRequestValidation.ts` - LLM route validation.
* `apps/server/src/lib/llmPrivacy.ts` - provider-transfer, scan-root, and redaction helpers.
* `apps/server/src/lib/llmClient.ts` - provider opt-in, timeout, and redacted provider inputs.
* `apps/server/src/llm/engines/onDemandAnalysis.ts` - analysis input/output redaction.
* `apps/server/src/llm/engines/planDecomposer.ts` - provider-bound prompt redaction.
* `apps/server/src/llm/engines/idleSuggestionEngine.ts` - idle context redaction.
* `apps/server/src/llm/engines/transcriptMiner.ts` - transcript and finding redaction.
* `apps/server/src/routes/llm.ts` - route validation, scan allowlist, privacy headers, redacted memory output.
* `apps/server/tests/llm.test.ts` - route and privacy tests.
* `apps/server/tests/codebaseWalker.test.ts` - walker ignore/cap/symlink tests.
* `apps/server/README_server.md` - server LLM privacy docs.
* `docs/api/README_api.md` - concise API docs.
* `docs/api/event-api-hook-contracts.md` - detailed route contracts.
* `docs/privacy-and-security.md` - privacy posture docs.

**Review method**: Static review of changed deliverables, focused/full tests, typecheck, Biome, ASCII/LF checks, and `git diff --check`.

***

## Security Assessment

### Overall: PASS

| Category                      | Status | Severity | Details                                                                                                                                      |
| ----------------------------- | ------ | -------- | -------------------------------------------------------------------------------------------------------------------------------------------- |
| Injection (SQLi, CMDi, LDAPi) | PASS   | --       | No database or shell execution was added. Filesystem walking remains bounded to approved roots.                                              |
| Hardcoded Secrets             | PASS   | --       | No secrets or provider keys were added. Provider transfer remains env-controlled.                                                            |
| Sensitive Data Exposure       | PASS   | --       | LLM route inputs are bounded; provider transfer requires explicit opt-in; scan roots, memory findings, and provider-bound text are redacted. |
| Insecure Dependencies         | PASS   | --       | No dependency manifests were changed.                                                                                                        |
| Security Misconfiguration     | PASS   | --       | `ANTHROPIC_API_KEY` alone is not sufficient for provider transfer; fallback remains default.                                                 |

### Findings

No security findings.

***

## GDPR Compliance Assessment

### Overall: PASS

This session did not introduce new personal data collection or a new third-party processor. It reduced accidental exposure risk for existing LLM, scan, and memory surfaces.

| Category                   | Status | Details                                                                                                                   |
| -------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------- |
| Data Collection & Purpose  | PASS   | Existing LLM scan/memory routes remain for local analysis and transcript-mined findings.                                  |
| Consent Mechanism          | PASS   | Provider transfer now requires explicit `FACTIONOS_ALLOW_LLM_PROVIDER_TRANSFER=true` in addition to provider credentials. |
| Data Minimization          | PASS   | File counts, content sizes, scan roots, route fields, provider-bound text, and memory output are bounded/redacted.        |
| Right to Erasure           | PASS   | No new persistence was added; retained unified erasure gap remains documented as a release risk.                          |
| PII in Logs                | PASS   | New warnings are compact and do not log raw prompts, paths, file contents, or tokens.                                     |
| Third-Party Data Transfers | PASS   | Anthropic transfer behavior is documented and blocked by default.                                                         |

### Personal Data Inventory

| Data Element               | Source                               | Storage                                                       | Purpose              | Retention                        | Deletion Path                                                           |
| -------------------------- | ------------------------------------ | ------------------------------------------------------------- | -------------------- | -------------------------------- | ----------------------------------------------------------------------- |
| File contents for analysis | `/llm/analyze`, `/llm/scan-codebase` | Process memory; optional Anthropic transfer only when enabled | Local code analysis  | Request-scoped in route path     | Not persisted by this session                                           |
| Memory findings            | Transcript miner                     | `~/.factionos/memory.jsonl`                                   | Local project memory | Local file until user removes it | Manual deletion today; unified erasure remains future release hardening |

### Findings

No GDPR findings.

***

## Recommendations

None for this session. Retain the broader release-hardening item for a unified archive/memory erasure command.

***

## Sign-Off

* **Result**: PASS
* **Reviewed by**: AI validation (validate)
* **Date**: 2026-05-29


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://faction-os.gitbook.io/faction-os-docs/.spec_system/archive/sessions/phase01-session06-llm-fallback-and-scan-privacy/security-compliance.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
