fix(federation): tighten peering-notifications GET response to spec shape

db.select() returned every column including userId; spec §4.9
defined the response row WITHOUT userId. The leak is harmless today
(user queries their own rows) but expands the public API surface
beyond the spec, and would become part of the contract once Task 10
generates client types. Switching to explicit column projection.
This commit is contained in:
Jannis Braun
2026-04-26 22:27:43 +02:00
parent 4064d822cd
commit e82ccbde62
2 changed files with 12 additions and 5 deletions
+9 -1
View File
@@ -1873,7 +1873,15 @@ export async function federationRoutes(app: FastifyInstance): Promise<void> {
: eq(schema.peerApprovalNotifications.userId, userId);
const notifications = db
.select()
.select({
id: schema.peerApprovalNotifications.id,
kind: schema.peerApprovalNotifications.kind,
peerOrigin: schema.peerApprovalNotifications.peerOrigin,
triggerReason: schema.peerApprovalNotifications.triggerReason,
triggerTarget: schema.peerApprovalNotifications.triggerTarget,
createdAt: schema.peerApprovalNotifications.createdAt,
readAt: schema.peerApprovalNotifications.readAt,
})
.from(schema.peerApprovalNotifications)
.where(whereClause)
.orderBy(desc(schema.peerApprovalNotifications.createdAt))