mirror of
https://github.com/immich-app/immich.git
synced 2026-05-18 03:10:24 +03:00
fix(server): replace album user-not-found message to prevent UUID-existence 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.
This commit is contained in:
@@ -107,7 +107,7 @@ export class AlbumService extends BaseService {
|
||||
for (const { userId } of albumUsers) {
|
||||
const exists = await this.userRepository.get(userId, {});
|
||||
if (!exists) {
|
||||
throw new BadRequestException('User not found');
|
||||
throw new BadRequestException('Invalid user');
|
||||
}
|
||||
|
||||
if (userId == auth.user.id) {
|
||||
@@ -302,7 +302,7 @@ export class AlbumService extends BaseService {
|
||||
|
||||
const user = await this.userRepository.get(userId, {});
|
||||
if (!user) {
|
||||
throw new BadRequestException('User not found');
|
||||
throw new BadRequestException('Invalid user');
|
||||
}
|
||||
|
||||
await this.albumUserRepository.create({ userId, albumId: id, role });
|
||||
|
||||
Reference in New Issue
Block a user