Repository navigation
Harden auth/upload security, pin dependencies, and add OSS project docs - #11
Merged
Merged
Conversation
- Refuse to start in production with the default/placeholder SECRET_KEY - Rate-limit login attempts per IP+email to blunt brute-forcing - Enforce a max upload size and content-type allowlist on document uploads, plus an early Content-Length guard middleware - Prompt for the admin bootstrap password via getpass instead of a CLI arg - Flag docker-compose.yml credentials as dev-only - Add SECURITY.md, CONTRIBUTING.md, and CODE_OF_CONDUCT.md Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
- Add requirements.in / requirements-dev.in as the loose, hand-edited source of truth; requirements.txt / requirements-dev.txt are now fully pinned lockfiles (every direct and transitive dependency) generated via `uv pip compile`, so installs are reproducible across dev/CI/prod - Explicitly depend on sqlalchemy[asyncio] to pull in greenlet, which sqladmin requires unconditionally (it imports sqlalchemy.ext.asyncio internally) -- previously undeclared, so a clean install could fail to import the app - Fix test suite fallout from the new login rate limiter: reset its in-memory state between tests, and add coverage for rate limiting and the document upload size/content-type limits - Document the lockfile regeneration workflow in CONTRIBUTING.md Verified: clean-room install + ruff + full pytest suite (41 passed) against the pinned versions on Python 3.12. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
3 tasks done
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
SECRET_KEY(was a full auth-bypass risk on any misconfigured self-hosted instance)Content-Lengthguard middlewaregetpassinstead of a CLI arg (was visible in shell history)pip-compile-style lockfiles (requirements.in/requirements-dev.in→ generatedrequirements.txt/requirements-dev.txt) for reproducible installs; along the way, fixed an existing bug wheresqladmin's unconditional use ofsqlalchemy.ext.asynciorequiredgreenlet, which was never actually declared anywhereSECURITY.md,CONTRIBUTING.md,CODE_OF_CONDUCT.md; flagdocker-compose.ymlcreds as dev-only; document the security model (including the single-tenant authorization design) in the README/SECURITY.mdHeads up: this restructures
requirements.txtfrom a hand-edited file into a generated lockfile (source of truth is nowrequirements.in). The open dependabot PR #10 (bumpingsqlalchemy>=2.0→>=2.1.4in the old flatrequirements.txt) will conflict/go stale once this merges — recommend closing it, since the lockfile already pinssqlalchemy==2.1.6with the[asyncio]extra.Testing
ruff check .passespip install -r requirements.txt -r requirements-dev.txtonly, no manual patches) succeedspytestpasses (41 passed) against real Postgres on the pinned dependency versionsSECRET_KEYfail-fast, login rate limiting (429 after repeated attempts), and upload rejection (oversized + disallowed content-type) behaviors🤖 Generated with Claude Code