security: add bcrypt password hashing helpers#722
Conversation
|
🎉 Welcome to Hybrid Recommender, @saurabhhhcodes! This is your first contribution here! Labels added: PR Description Checklist: ✅ PR description looks complete! What happens next:
⏱️ Please respond to review comments within 48 hours. |
🎉 Welcome to Hybrid Recommender, @saurabhhhcodes!Thank you for your first pull request! Here's what happens next:
⏱️ Please respond to any review comments within 48 hours. 📖 Resources: Happy contributing! 🚀 |
|
Pushed a CI repair follow-up in What changed:
Local verification:
I also tried the E2E suite locally; it now reaches dependency import and stops because my local Python env is missing |
|
Follow-up pushed in Fix:
Local re-checks after the dependency-file change:
The next Actions run should verify the full E2E path with project requirements installed. |
|
Pushed another narrow E2E import fix in The latest Actions run got past the SentenceTransformers dependency, then failed during app import because Local verification after the patch:
Fresh Actions are queued again now. |
|
Pushed Fix:
Local verification:
Fresh Actions are queued again. |
|
Final CI update: the fresh Actions run on Passing checks:
This confirms the bcrypt helper PR plus the import/startup repairs are clean in GitHub CI. Ready for maintainer review. |
leonagoel
left a comment
There was a problem hiding this comment.
Hey @saurabhhhcodes! 👋
PR #722 has conflicts in 2 files that need resolving before we can merge:
- backend/main.py (5 conflicts)
- requirements.txt
Please fix locally:
git checkout security/bcrypt-password-hashing-326
git fetch origin
git merge origin/main
Resolve conflicts in both files, then:
git add backend/main.py requirements.txt
git commit -m "resolve merge conflicts with main"
git push
Thanks! 😊
|
Resolved the merge conflicts with current Resolution notes:
Validation run locally:
I also attempted the E2E suite locally, but this machine does not have the repo dependencies installed ( |
|
Small workflow follow-up pushed in Root cause: the E2E job’s Python setup step had both Fix:
Validation:
Fresh CI should now be able to start normally. |
|
CI is green now after the rebase follow-up fixes. Latest run passed E2E API tests, pipeline smoke test, and flake8: https://github.com/leonagoel/hybrid-recommender/actions/runs/26693448969 |
|
Hi @leonagoel, the requested conflict resolution is complete now. The PR is mergeable again and the latest CI run is green across E2E API tests, flake8, and pipeline smoke test. Could you please re-review when you get a chance? |
|
PR #758 ("test : added unit tests for causal_config validation errors") was just merged into Please rebase your branch to avoid conflicts: Keeping your branch up to date prevents merge conflicts. 🚀 |
|
PR #760 ("test : added unit tests for causal_model bounds") was just merged into Please rebase your branch to avoid conflicts: Keeping your branch up to date prevents merge conflicts. 🚀 |
|
PR #762 ("test : added unit tests for propensity_model smoothing bounds") was just merged into Please rebase your branch to avoid conflicts: Keeping your branch up to date prevents merge conflicts. 🚀 |
|
PR #764 ("test : added unit tests for compute_product_sentiment in nlp_engine") was just merged into Please rebase your branch to avoid conflicts: Keeping your branch up to date prevents merge conflicts. 🚀 |
|
PR #766 ("test : added unit tests for supplementary evaluation metrics") was just merged into Please rebase your branch to avoid conflicts: Keeping your branch up to date prevents merge conflicts. 🚀 |
|
PR #768 ("test : added unit tests for DatasetManager") was just merged into Please rebase your branch to avoid conflicts: Keeping your branch up to date prevents merge conflicts. 🚀 |
|
PR #770 ("test : added unit tests for db supabase client initialization") was just merged into Please rebase your branch to avoid conflicts: Keeping your branch up to date prevents merge conflicts. 🚀 |
|
PR #772 ("Feature: Implement Redis caching for database queries") was just merged into Please rebase your branch to avoid conflicts: Keeping your branch up to date prevents merge conflicts. 🚀 |
|
PR #773 ("Feature: Set up automated unit and integration test suite") was just merged into Please rebase your branch to avoid conflicts: Keeping your branch up to date prevents merge conflicts. 🚀 |
|
PR #774 ("Feature: Implement API rate-limiting middleware") was just merged into Please rebase your branch to avoid conflicts: Keeping your branch up to date prevents merge conflicts. 🚀 |
|
PR #1040 ("fixed: Duplicate PR template files cause Git conflicts on case-insens…") was just merged into Please rebase your branch to avoid conflicts: Keeping your branch up to date prevents merge conflicts. 🚀 |
|
PR #1527 ("fix(model): fix IndentationError in select_bandit_arm and unindented bandit arm weight assignment") was just merged into Please rebase your branch to avoid conflicts: Keeping your branch up to date prevents merge conflicts. 🚀 |
2263c9d to
35fbc64
Compare
|
PR #1633 ("fix: Duplicate results-processing loop removed from search_items(#1631)") was just merged into Please rebase your branch to avoid conflicts: Keeping your branch up to date prevents merge conflicts. 🚀 |
|
PR #1640 ("fix: resolve hybrid_model merge conflicts and add explanation string") was just merged into Please rebase your branch to avoid conflicts: Keeping your branch up to date prevents merge conflicts. 🚀 |
|
PR #1641 ("Fix/svd memory leak") was just merged into Please rebase your branch to avoid conflicts: Keeping your branch up to date prevents merge conflicts. 🚀 |
|
PR #1642 ("Feature/evaluation dashboard") was just merged into Please rebase your branch to avoid conflicts: Keeping your branch up to date prevents merge conflicts. 🚀 |
|
PR #1643 ("Feature/streamlit tfidf config") was just merged into Please rebase your branch to avoid conflicts: Keeping your branch up to date prevents merge conflicts. 🚀 |
|
PR #1644 ("Fix/strict csrf origin validation") was just merged into Please rebase your branch to avoid conflicts: Keeping your branch up to date prevents merge conflicts. 🚀 |
|
PR #1645 ("Feature/svd online updating") was just merged into Please rebase your branch to avoid conflicts: Keeping your branch up to date prevents merge conflicts. 🚀 |
|
PR #1647 ("fix: add title query param endpoint to resolve HTTP 422 (#1075)") was just merged into Please rebase your branch to avoid conflicts: Keeping your branch up to date prevents merge conflicts. 🚀 |
|
PR #1648 ("fix(federated): prevent regularization decay in aggregate_updates") was just merged into Please rebase your branch to avoid conflicts: Keeping your branch up to date prevents merge conflicts. 🚀 |
|
PR #1650 ("fix: remove duplicate code block in hybrid_model.py causing Indentati…") was just merged into Please rebase your branch to avoid conflicts: Keeping your branch up to date prevents merge conflicts. 🚀 |
|
PR #1653 ("fix: remove duplicate /api/recommend route") was just merged into Please rebase your branch to avoid conflicts: Keeping your branch up to date prevents merge conflicts. 🚀 |
|
PR #1654 ("build: add faiss dependency for two-tower retrieval") was just merged into Please rebase your branch to avoid conflicts: Keeping your branch up to date prevents merge conflicts. 🚀 |
|
PR #1655 ("fix: enforce stronger signup password validation") was just merged into Please rebase your branch to avoid conflicts: Keeping your branch up to date prevents merge conflicts. 🚀 |
|
PR #1660 ("security: reject unissued csrf tokens") was just merged into Please rebase your branch to avoid conflicts: Keeping your branch up to date prevents merge conflicts. 🚀 |
|
PR #1661 ("feat: add KNN-based user collaborative filtering (Issue #51)") was just merged into Please rebase your branch to avoid conflicts: Keeping your branch up to date prevents merge conflicts. 🚀 |
|
PR #1665 ("fix: add missing faiss-cpu dependency to requirements.txt ") was just merged into Please rebase your branch to avoid conflicts: Keeping your branch up to date prevents merge conflicts. 🚀 |
|
PR #1515 ("feat: harden realtime recommendation WebSocket flow") was just merged into Please rebase your branch to avoid conflicts: Keeping your branch up to date prevents merge conflicts. 🚀 |
|
PR #1668 ("fix(ci): resolve syntax and indentation errors breaking upstream main") was just merged into Please rebase your branch to avoid conflicts: Keeping your branch up to date prevents merge conflicts. 🚀 |
|
PR #1669 ("feat(rate-limit): implement Token Bucket algorithm for rate-limiting middleware for search API protection") was just merged into Please rebase your branch to avoid conflicts: Keeping your branch up to date prevents merge conflicts. 🚀 |
|
PR #1676 ("docs: add required Supabase initialization steps to Docker setup guide") was just merged into Please rebase your branch to avoid conflicts: Keeping your branch up to date prevents merge conflicts. 🚀 |
|
PR #1677 ("fix: implement background cache cleanup to prevent OOM") was just merged into Please rebase your branch to avoid conflicts: Keeping your branch up to date prevents merge conflicts. 🚀 |
|
PR #1678 ("feat: add recommendation feedback loop support") was just merged into Please rebase your branch to avoid conflicts: Keeping your branch up to date prevents merge conflicts. 🚀 |
|
PR #1679 ("fix: use gin_trgm_ops for GIN trigram index") was just merged into Please rebase your branch to avoid conflicts: Keeping your branch up to date prevents merge conflicts. 🚀 |
1924c65 to
44930e0
Compare
What changed
backend.password_hashingwith bcrypt hashing at cost factor 12.SECURITY.mdand addedbcryptto requirements.Why
Issue #326 calls out weak password hashing with MD5. The current app delegates user email/password auth to Supabase Auth, so there is no live repository-managed MD5 password path to replace. This patch closes the local-password handling gap by providing a single approved helper for any backend/admin credential flow in this repo, while explicitly rejecting MD5-style hashes.
How to test
Local result:
pytest tests/test_password_hashing.py -q-> 5 passed, 1 existing pytest config warning about unknownenvoptionScreenshots (if UI change)
Not applicable; backend security helper and tests only.
Checklist
ruff checkfor touched files)Related issue
Closes #326
AI assistance disclosure