BUG:Backend lets an album be locked with no password, making it permanently inaccessible
I maintainer di solito rispondono entro 3 giorni
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- Mezza giornata
- Idoneità per principianti
- 65/100
Direzione di ricerca
Start with the password validation in backend/app/schemas/album.py, where the field validator on the create request is skipped when password is omitted, and with the update_album handler that checks current_password only when the album is already locked. Reproduce both requests from the issue against the album endpoints and confirm they return 200 with a locked album that has no password hash. Done when locking without a new password returns a 400 or 422 on both create and update, and tests cover both paths.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Is there an existing issue for this?
- I have searched the existing issues
What happened?
The album create/update endpoints accept is_locked: true without a password. The album is saved as locked with password_hash = NULL, so verify_album_password rejects every password from then on. Its photos can't be viewed, it can't be unlocked, and the password can't be changed. Deleting it is the only way out.
Cause
The "locked albums need a password" check in backend/app/schemas/album.py is a @field_validator("password"). In Pydantic v2, field validators don't run on default values, so when the request leaves out password entirely, the check is skipped.
UpdateAlbumRequest has a second gap: the check passes whenever current_password is non-empty. But update_album only verifies current_password if the album is already locked, so for an unlocked album any string works.
Steps to reproduce
-
Create path:
POST /albums/ {"name": "A", "is_locked": true}→
200. ThenPOST /albums/{id}/images/getwith any password →401 Invalid Password.PUT /albums/{id}to unlock →401 Incorrect Password. -
Update path (on an existing unlocked album):
PUT /albums/{id} {"name": "B", "is_locked": true, "current_password": "junk", "password": null}→
200 Album updated successfully. The album is now locked with no password and can't be opened.
Expected
Both requests should be rejected with a 400/422 when an album is being locked without a new password.
Notes
The Create/Edit dialogs validate this on the client, so normal UI use doesn't hit it. The backend shouldn't rely on that check, though, and any other client or a future UI change could brick albums.
Suggested fix
- Replace the
passwordfield validator inCreateAlbumRequestwith a@model_validator(mode="after")so it always runs. - In
update_album, return 400 when an album that isn't locked yet is being locked withoutpassword. - Add tests for both paths.
I checked these and I don't think this is a duplicate:
- #1617: locked albums can be deleted without a password (
delete_album). - #1631: images can be added/removed on locked albums without a password.
- #1662: frontend unlock caching; a wrong password briefly opens the album.
All three are about a missing or wrong password check on an album that has a password. This issue is about the backend letting an album be locked with no password stored at all (password_hash = NULL), because the @field_validator("password") in schemas/album.py is skipped when password is omitted, plus the current_password bypass in update_album. After that, no password can open, unlock or edit the album.
The open fixes for those issues (#1675, #1701, #1691) don't touch this validator, so they wouldn't fix this.
I'd like to work on this if it's approved.
Record
- I agree to follow this project's Code of Conduct
- Lingua principale
- Python
- Stelle
- 322
- Fork
- 793
- Merge medio
- 6g 10h
- PR unite (30g)
- 20
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di AOSSIE-Org/PictoPy
-
bug enhancement
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
AOSSIE-Org/PictoPy#1802 · 2 commenti ·
I maintainer di solito rispondono entro 3 giorni
-
BUG: XMP metadata export permanently overwrites file modification timestamp (mtime), destroying photo datesForse già presa @swastiksharma45 l’ha presa 2 giorni fa. Apertabug enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
AOSSIE-Org/PictoPy#1788 · 6 commenti ·
I maintainer di solito rispondono entro 3 giorni
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
AOSSIE-Org/PictoPy#1786 · 1 commento ·
I maintainer di solito rispondono entro 3 giorni
-
BUG: Semantic search sees portrait phone photos sideways (SigLIP ignores EXIF orientation)Forse già presa @omkar-suryavanshi l’ha presa 3 giorni fa. Apertabug enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
AOSSIE-Org/PictoPy#1780 · 5 commenti ·
I maintainer di solito rispondono entro 3 giorni
-
BUG: Share password loses leading/trailing spaces so the password you set doesn't workForse già presa @ManyaJain111 l’ha presa 2 giorni fa. Apertabug good first issue
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
AOSSIE-Org/PictoPy#1779 · 2 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 3 giorni
Tutte le issue di AOSSIE-Org/PictoPy
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
hermes hooks doctor smoke test never checks the hook exit code — a crashing hook (exit=1) renders ✓ "ran clean" and "All shell hooks look healthy"Forse già presa @cestercian l’ha presa oggi. Apertacomp/cli P2 type/bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
NousResearch/hermes-agent#162259 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
[request] gRpc/1.86.0Apertaupstream update
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
conan-io/conan-center-index#31597 ·
I maintainer di solito rispondono entro 1 giorno
-
community-request
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
NVIDIA-NeMo/Run#727 ·
I maintainer di solito rispondono entro 1 giorno
-
bot-triaged module: higher order operators module: pickle module: pt2-dispatcher oncall: pt2 triaged
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
pytorch/pytorch#207247 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno