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:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user