Repository navigation
fix(security): remediate token logging, doc decompression limits, and storage/auth concurrency - #17
Merged
Conversation
…word recovery Remove raw token and recovery URL printing from stdout/stderr during registration and password reset workflows. Add automated test coverage confirming plaintext tokens are not leaked to server logs.
Apply the 50 MB uncompressed zip safety guard to both .docx and .doc archives before parsing with python-docx, preventing decompression bomb expansion in renamed OOXML documents. Reject non-zip legacy binary files with an informative error.
…t uploads Reserve account storage bytes atomically in database before uploading to object storage, releasing reservations on failure. Count reserved and active attachments towards storage limit to prevent concurrent uploads from exceeding quota.
Validate, consume (used_at IS NULL), and apply password changes in a single database transaction, preventing concurrent recovery requests from overwriting passwords multiple times. Add single-transaction email verification consumption and automated concurrency test coverage.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
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
Remediates four security and concurrency vulnerabilities covering token leakage in server logs, decompression safety in Word
.docfile parsing, atomic storage quota reservation across concurrent uploads, and atomic single-transaction password reset token consumption.Key Changes
Eliminate Sensitive Token Logging (
backend/routers/auth.py,tests/test_auth_api.py):print()statements outputting raw email verification and password reset recovery links with usable tokens.test_tokens_not_printed_to_logs) capturing stdout/stderr to ensure no token leakage.Enforce Decompression Safety Limit on Word
.docFiles (backend/services/document_parser.py,tests/test_document_parser.py):.docxor.doc) is verified against the 50 MB uncompressed limit before invokingdocx.Document."Legacy .doc binary format is not supported...")..docfiles parse, and legacy binary.docfiles are rejected.Enforce Atomic Storage Quota Reservations (
backend/storage.py,backend/services/resume_files.py,tests/test_atomic_limits.py):reserve_upload_bytesandfinalize_attachmentmethods toStorageServiceusing transactional locking.activeandreservedattachments inget_user_upload_bytescalculation.failedstate on network or insertion failure.test_concurrent_uploads_cannot_exceed_storage_quota) verifying simultaneous uploads obey exact storage quotas.Atomic Password Reset & Verification Token Consumption (
backend/storage.py,backend/routers/auth.py,tests/test_atomic_limits.py):consume_reset_token_and_update_passwordto atomically validate the token, check expiration, consume it (used_at IS NULL), invalidate other prior tokens, and update the password and session version in a single transaction.consume_verify_token_and_verify_user) and hardenedconsume_auth_tokento return rowcount boolean.test_concurrent_password_reset_confirm_only_succeeds_once) confirming racing confirmation requests can only consume a token once.Verification & Test Results
pytest):npm test -- --run):npm run build):git diff --check):