PictoPy icon indicating copy to clipboard operation
PictoPy copied to clipboard

BUG: Backend: Backend crashes when password contains null bytes (x00)

Open DeveloperAmrit opened this issue 10 months ago • 5 comments

Is there an existing issue for this?

  • [x] I have searched the existing issues

What happened?

How to reproduce

  1. Send this payload to POST /albums/
{
  "name": "Test Album",
  "is_hidden": true,
  "password": "pass\u0000word"
}

Description

Hypothesis fuzz testing revealed that the backend crashes with a 500 Internal Server Error if a user attempts to create or update a hidden album with a password containing a null byte (e.g., "\x00").

Root cause

The bycrypt library used for password hashing throws a ValueError when it encounters a null byte. This exception was not being caught in the database layer, propagating up as an unhandled server error.

Source of crash

  • line 130 db_insert_album function in albums.py
  • line 135 db_update_album function in albums.py

Expected behaviour The API should return 422 Unprocessable Entity indicating the input is invalid, rather than crashing the server.

Proposed changes

  • Add a field validator in schemas/album.py

I would like to work on this issue.

Record

  • [x] I agree to follow this project's Code of Conduct

DeveloperAmrit avatar Jan 11 '26 08:01 DeveloperAmrit

👋 Thanks for opening this issue! The maintainers will review it shortly. Till then, do not open any PR. This is a strict rule we like to follow around here :)

github-actions[bot] avatar Jan 11 '26 08:01 github-actions[bot]

I would like to work on this issue

DeveloperAmrit avatar Jan 12 '26 09:01 DeveloperAmrit

hello @rahulharpal1603 sir i want wo work on this issue please assign it to me

Abhinandankaushik avatar Jan 25 '26 19:01 Abhinandankaushik

Hello @Abhinandankaushik, i am already working on this

DeveloperAmrit avatar Jan 25 '26 23:01 DeveloperAmrit

@rohan-pandeyy please can you assigned e this

Saurabhyadav0 avatar Nov 29 '26 10:11 Saurabhyadav0