BUG: Share page returns HTTP 500 when the unlock cookie contains a non-ASCII character

Open Beginner friendly
#1,696 6 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 6 days

@swastiksharma45 is already working on this.

Since Nov 6, 2026.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
python
Domain
backend, security

Research direction

Start with backend/app/share/registry.py and inspect share_registry_is_unlocked, then find the tests covering share unlock cookies. Reproduce with a cookie containing é and verify the behavior on the share, photo, and thumbnail routes. Done means a non-ASCII wrong cookie shows the password page on /s/<token> and returns 404 on photo and thumbnail pages, with a regression test.

Written by the indexing model from the issue text.

Description

bug
Is there an existing issue for this?
  • I have searched the existing issues
What happened?

If someone opens a password-protected album share with a cookie that has a non-English character (like "é"), the server returns an error (HTTP 500). It should just show the password page.

Why it happens: in backend/app/share/registry.py, the function share_registry_is_unlocked checks the cookie using hmac.compare_digest. This function throws a TypeError when the text has a non-ASCII character. The visitor sends the cookie, so anyone with the share link can cause this.

How to reproduce: open the link of a password-protected share with a cookie that has a non-English character, like pictopy_share_unlock=café. The server returns 500 instead of the password page.

What should happen: a wrong cookie should be treated like any other wrong cookie. Show the password page on /s/<token>, and return 404 on the photo and thumbnail pages.

Fix idea: compare bytes instead of text, and add a test for it.

I would like to work on this!

Record
  • I agree to follow this project's Code of Conduct
Dominant language
Python
Stars
313
Forks
755
Avg merge
6d 36m
Merged PRs (30d)
8

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from AOSSIE-Org/PictoPy

All issues in AOSSIE-Org/PictoPy

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.