Skip to content

refactor(server)!: sanitize error messages to avoid leaking resource details#28154

Open
timonrieger wants to merge 13 commits intomainfrom
refactor/api-info-leaks
Open

refactor(server)!: sanitize error messages to avoid leaking resource details#28154
timonrieger wants to merge 13 commits intomainfrom
refactor/api-info-leaks

Conversation

@timonrieger
Copy link
Copy Markdown
Collaborator

@timonrieger timonrieger commented Apr 29, 2026

Summary

Error messages for missing resources have been standardized to “Not found”, avoiding disclosure of internal resource types

Always call compareBcrypt in the login path regardless of whether the
email is registered. When no user is found, a dummy hash is used so the
bcrypt KDF still runs and response latency is constant, making it
impossible to enumerate valid email addresses by measuring response time.
…nce oracle

Two distinct error messages in the OAuth callback endpoint revealed
whether an email address was already registered in the database.
An attacker controlling the OAuth provider's email claim could probe
the user table without authentication. Both cases now return the same
generic message.
…oracle

Error messages on registration and profile-update that named whether an
email address was already taken allowed callers to enumerate registered
accounts. All three sites now return the same generic message regardless
of whether the address is in use.
…robe

Surfacing the Postgres unique-constraint name in the error response let
any authenticated user brute-force whether a custom slug was already in
use by another user's shared link, leaking the existence of other links.
…cle via status code

GET /users/:id/profile-image returned HTTP 400 for an unknown user ID
but HTTP 404 when the user existed without a photo, letting callers
distinguish the two cases. Both now return 404 so the response is
identical regardless of whether the UUID maps to an account.
…stence oracle

Album owners could probe arbitrary UUIDs via the add-user endpoint and
determine whether they belonged to registered accounts by receiving
'User not found'. The message is now ambiguous about whether the ID was
unrecognised or the user is inactive.
@timonrieger timonrieger force-pushed the refactor/api-info-leaks branch from 6a2fd80 to 81b8d89 Compare April 30, 2026 09:54
@timonrieger timonrieger marked this pull request as ready for review April 30, 2026 10:02
Comment thread e2e/src/specs/server/api/activity.e2e-spec.ts
Comment thread server/src/services/auth.service.ts
This reverts commit c1bd7a1.
…esource and permission details"

This reverts commit b96421a.
requireAccess threw BadRequestException which is incorrect HTTP semantics.
Access denial is a client authorization problem (403 Forbidden), not a
malformed request (400 Bad Request). Keep the descriptive permission name
in the message since the full permission set is public API surface.
@timonrieger timonrieger changed the title refactor(server)!: sanitize error messages to avoid leaking resource and permission details refactor(server)!: sanitize error messages to avoid leaking resource details Apr 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants