Repository navigation
Security audit hardening - #1
Merged
Merged
Conversation
Infrastructure and injection hardening from a full security review: - H-1: default server.host to 127.0.0.1 (was 0.0.0.0) and warn at startup when bound off-box with no auth_token, so a fresh install can't silently expose private conversations to the LAN. - M-3: SSRF guard (app/netguard.py) on the photo-download path — reject URLs resolving to loopback/private/link-local/reserved IPs, revalidating every redirect hop. Deliberately not applied to the LLM endpoint (localhost Ollama is legitimate); the settings-API SSRF lever is closed by the auth default. - M-1/M-2: cap upload sizes (reject early via UploadFile.size) and decompressed output during backup restore and character import, defeating zip bombs. - L-1: set SameSite=Strict and Secure (under HTTPS) on the auth-token cookie. - I-2: security-headers middleware (CSP matched to the no-build frontend, X-Content-Type-Options, X-Frame-Options, Referrer-Policy, Permissions-Policy). - M-4: fence untrusted web-search and recall results in the prompt so small models don't obey instructions/markers embedded in fetched content. Adds tests for the SSRF guard and the decompression-bomb rejection. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses findings from a full security review of the app. All changes verified: 96 tests pass, ruff clean.
Fixes
server.hostis now127.0.0.1(was0.0.0.0); a startup warning fires when bound off-box with noauth_token, so a fresh install can't silently expose private conversations to the LAN.app/netguard.pyrejects outbound URLs resolving to loopback/private/link-local/reserved IPs, revalidating every redirect hop; applied to the photo-download path. Not applied to the LLM endpoint (localhost Ollama is legitimate) — the settings-API SSRF lever is closed by the auth default instead.UploadFile.size, and cap decompressed output during backup restore and character import.SameSite=StrictandSecure(under HTTPS) on thecai_tokencookie.X-Content-Type-Options,X-Frame-Options,Referrer-Policy,Permissions-Policy.Tests
Adds coverage for the SSRF guard and the decompression-bomb rejection.
Other
Includes removal of the luna sample character (separate commit).
🤖 Generated with Claude Code