Repository navigation
Remove hardcoded API key, fix XSS in chat rendering - #2
Draft
killerpanda101 wants to merge 3 commits into
Draft
killerpanda101 wants to merge 3 commits into
killerpanda101 wants to merge 3 commits into
Conversation
- Load OPENAI_API_KEY from env/.env instead of hardcoding it in app.py - html.escape chat messages before rendering with unsafe_allow_html (XSS via PDF/LLM content) - Handle PDF pages with no extractable text (extract_text() may return None) - Ignore .env and update README Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGgdMjDH3WUa81iXsg3kwF
- .gitignore for secrets, OS/editor files and language build artifacts - Untrack files that are now ignored (kept on disk) - pre-commit config (gitleaks, private keys, large files) and CI secret scan Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGgdMjDH3WUa81iXsg3kwF
Owner
Author
|
Also added repo safeguards in a follow-up commit: a language-appropriate Generated by Claude Code |
Full-history scans fail on secrets that were committed before this PR; those must be rotated, not re-flagged on every run. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01WGgdMjDH3WUa81iXsg3kwF
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
app.pysetOPENAI_API_KEYto a literal string (and the README told users to do the same). It now reads it from the environment /.env(load_dotenv()was imported but never called) and shows a clear error if missing..envis git-ignored.unsafe_allow_html=True. They are nowhtml.escaped.PdfReader.extract_text()can returnNone(e.g. image-only pages), which crashed with aTypeError.Action needed
The old key string remains in git history. If it was ever a real key, revoke/rotate it in the OpenAI dashboard.
Not run end-to-end (needs an OpenAI key);
py_compilepasses.Generated by Claude Code