fix: bind vault blobs to authenticated metadata#276
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughExtended vault encryption to bind AEAD associated data (version, media_id, file_hash) into AES-GCM authentication. Updated ChangesVault encryption with authenticated associated data binding
Sequence Diagram(s)sequenceDiagram
participant Client
participant VaultAPI as vault.hide_media / vault.stream_hidden_media
participant Crypto as find_api.core.crypto
participant AESGCM as AES-256-GCM
Client->>VaultAPI: hide media request
VaultAPI->>VaultAPI: aad = build_vault_aad(media.id, media.file_hash)
VaultAPI->>Crypto: encrypt_file(source, dest, associated_data=aad)
Crypto->>AESGCM: authenticate_additional_data(aad) / encrypt stream
Client->>VaultAPI: stream hidden media request
VaultAPI->>VaultAPI: aad = build_vault_aad(media.id, media.file_hash)
VaultAPI->>Crypto: decrypt_file_stream(iv, encrypted_path, associated_data=aad)
Crypto->>AESGCM: authenticate_additional_data(aad) / decrypt & verify
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
PR Context Summary
Suggested issue links
Use |
ApprovabilityVerdict: Needs human review This PR modifies core cryptographic functions to add AEAD metadata binding, which is security-sensitive code. Changes to encryption/decryption behavior in crypto modules warrant human review to verify the implementation is correct. No code changes detected at You can customize Macroscope's approvability policy. Learn more. |
|
Thanks for the automated checks. I see CodeRabbit, GitGuardian, Macroscope correctness, and PR context triage are green, while Macroscope approvability correctly asks for human review because this touches cryptographic AEAD behavior. Could a maintainer please review the security-sensitive crypto change when available? Also, before merge, could you mirror the linked issue scoring labels onto this PR ( |
|
Quick review/scoring follow-up: this security/privacy PR is green from the automated checks I can see, but it still needs human review because it touches vault encryption/authenticated metadata. If accepted, could you please mirror the linked issue labels onto the PR before merge? The linked issue is #264 ( |
|
Fixed the backend formatting failure by running Ruff formatting on the vault AEAD regression test file and pushing head 306da90. Local checks: python3 -m ruff format --check tests/test_vault.py and git diff --check both pass. GitHub Actions should rerun now. |
|
Actionable comments posted: 0 |
|
Refreshed this branch with the latest upstream Merge result:
Validation available locally:
I could not run backend pytest locally on this machine because the repo requires Python |
|
Refreshed this branch with latest upstream main in commit 746f116 to clear the behind state again. Validation available locally:
Full backend pytest still needs the repo Python version (>=3.12,<3.13); this machine only has Python 3.9.6. The PR remains intentionally pending human review because it touches vault AEAD/security behavior. |
|
Refreshed this branch with latest upstream Merge result:
Validation available locally:
The PR still intentionally needs human review because it touches vault encryption/authenticated metadata behavior. |
|
Refreshed this branch with latest upstream |
Summary
vault:v1,media_id, andfile_hashTests
backend/.codex-venv/bin/python -m py_compile src/find_api/core/crypto.py src/find_api/routers/vault.py tests/test_vault.pybackend/.codex-venv/bin/python -m pytest tests/test_vault.py -qbackend/.codex-venv/bin/python -m pytest tests/test_gallery.py tests/test_search.py tests/test_clusters.py tests/test_people.py tests/test_vault.py -qgit diff --checkCloses #264
Summary by CodeRabbit
New Features
Tests
Documentation