mirror of
https://github.com/ciur/papermerge.git
synced 2026-04-25 03:55:58 +03:00
[GH-ISSUE #579] HTTP 500 in /api/users/me #452
Labels
No labels
2.1
3.0
3.0.1
3.0.2
3.0.3
3.0.3
3.1
3.2
3.2
3.3
3.5
3.x
Fixed. Waiting for feedback.
Fixed. Waiting for feedback.
UX
Version 2.1 - alpha
XSS
announcement
beta
blocker
bug
cannot reproduce
confirmed
confirmed
critical
demo
dependencies
deployment
detchnical debt
discussion
docker
documentation
donations
duplicate
enhancement
feature request
frontend
fundraising
good first issue
good issue
help wanted
high
implemented
important
improvement
incomplete
invalid
investigation
kubernetes
low
low impact
medium
medium
medium impact
migration from 2.0
migration from 2.1
missing-language
missing-ocr-language
no-activity
note
ocr
outofscope
packaging
performance
popular request
pull-request
pypi
question
raspberry pi
roadmap
search
security
setup
status
task
technical debt
updates
user xp
version 1.4.0 - demo
will be implemented
will not be implemented
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/papermerge#452
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @oliverrahner on GitHub (Jan 18, 2024).
Original GitHub issue: https://github.com/ciur/papermerge/issues/579
Originally assigned to: @ciur on GitHub.
Description
Situation:
docker-compose.ymlbelow)/api/users/mefails with an HTTP 500The JWT for the request to
/api/users/meis this:In the logs I see:
The actual database query is this:
So seemingly, somewhere username and user id get mixed up, because the query tries to find a user that has his id as name.
When I change the username to the user's id, I can log in, and other issues appear then but maybe that's something for a follow up.
Info:
docker-compose.yml:@schischo commented on GitHub (Jan 18, 2024):
same here, but with sqlite3
@oliverrahner commented on GitHub (Jan 18, 2024):
Found the next level of the issue:
user.idis not a UUID, but a 16-byte (32-char) hex string.That's why
is_valid_uuidreturnsfalseon this value, leading to a search for username instead of user ID.@oliverrahner commented on GitHub (Jan 18, 2024):
The problem is this line:
github.com/papermerge/auth-server@0f19caf2c6/auth_server/crud.py (L84)So it only relates to user accounts that are created via the
auth-server, the creation from insidecoreseems to be fine, because it does not convert the UUIDs to a pure.hex()representation.@ciur commented on GitHub (Jan 19, 2024):
@oliverrahner thank you for awesome report!
Issue seems to happen only with mysql/mariadb/sqlite, but not with postgres.
I will fix
auth_server.crud.create_userfunction to insert UUIDs similarely to the one from thepapermerge.core.db.users.create_user.@oliverrahner commented on GitHub (Jan 19, 2024):
Sqlalchemy seems to map UUID field types to char columns for mysql (with a fixed 32 char size!), which makes the format very explicit, leading to the issue with these differences…
The fixed size also means that you wouldn’t be able to save the UUID including the dashes, making the fix more complex 😏
@ciur commented on GitHub (Jan 21, 2024):
@oliverrahner @schischo
I've published 3.0.2 which should fix current issue (uuid/mysql/sqlite thingy).
Also in documentation I've updated docker-compose examples to include healthcheck key - which ensures that webapp/workers will start only after database process (not just db container) is up and running.
@oliverrahner commented on GitHub (Jan 21, 2024):
@ciur I can confirm this fixed my issue!