security: harden LLM prompts and infrastructure secrets#29
Merged
Conversation
- Wrap raw user queries in UNTRUSTED_DATA boundary markers in query_agent.py and reranker.py using wrap_external_content from core.safety.content_wrapper - Sanitize dataset content (question/answer/subject snippets) in reranker prompts using sanitize_prompt_literal to strip injection patterns and Unicode control characters - Add QDRANT__SERVICE__API_KEY env var support to docker-compose.yml (SEC-H5) - Replace hardcoded postgres password in Helm values.yaml with empty required placeholder (SEC-H6) - Add auth/billing/CORS/Qdrant config fields to Helm values.yaml (SEC-M7) - Expose SUPABASE_URL, SUPABASE_JWT_SECRET, POLAR_WEBHOOK_SECRET, QDRANT_API_KEY as k8s Secrets in Helm secret.yaml and deployment-api.yaml - Add 18 unit tests in tests/unit/test_prompt_safety.py covering injection stripping, boundary marker wrapping, and unicode control char removal Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
marinone94
added a commit
that referenced
this pull request
Mar 30, 2026
30/46 findings now fixed. All Critical and High security vulnerabilities resolved. Remaining items: GDPR endpoints, DPAs, rate limiter Redis, Langfuse instrumentation. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
marinone94
pushed a commit
that referenced
this pull request
Mar 30, 2026
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.
Summary
wrap_external_contentinquery_agent.pyreranker.pydocker-compose.ymlFiles changed
agents/query_agent.py— wrap user query in safety boundary markersagents/reranker.py— sanitize snippets + wrap query and results blockdocker-compose.yml—QDRANT__SERVICE__API_KEYenv vardeploy/helm/cherry-evals/values.yaml— auth/billing/CORS/Qdrant config keys, remove hardcoded passworddeploy/helm/cherry-evals/templates/secret.yaml— Supabase, Polar, Qdrant secretsdeploy/helm/cherry-evals/templates/deployment-api.yaml— all new env varstests/unit/test_prompt_safety.py— 18 new testsTest plan
uv run pytestpasses (595 passed, 1 skipped)🤖 Generated with Claude Code