User can download transaction history CSV/PDF
Why it matters
GDPR Article 20 (Right to Data Portability) and CCPA Section 1798.110 both require that users can receive their personal data, including transaction history, in a machine-readable format. CFPB Rule 1033 (Personal Financial Data Rights) additionally requires that financial institutions make consumer financial data available for download upon request. The failure to provide user-facing transaction export is simultaneously a privacy compliance gap, a regulatory compliance gap, and a usability failure — users who want to reconcile their own records or switch financial providers cannot do so without this feature. An export scoped only to admin or compliance roles does not satisfy these requirements; the user must be able to retrieve their own data directly.
Severity rationale
Low because the absence of user export does not expose data to unauthorized parties, but it creates regulatory non-compliance with GDPR Article 20 and CFPB 1033 and prevents legitimate user data access.
Remediation
Add a user-scoped export endpoint at src/app/api/user/transactions/export/route.ts that is strictly limited to the authenticated user's own records:
export async function GET(req: Request) {
const session = await getServerSession();
if (!session) return new Response('Unauthorized', { status: 401 });
const { startDate, endDate, format = 'csv' } =
Object.fromEntries(new URL(req.url).searchParams);
const rows = await db('transaction_logs')
.where({ user_id: session.user.id }) // never accept userId from query params
.whereBetween('timestamp', [startDate, endDate])
.orderBy('timestamp');
if (format === 'csv') {
const csv = [Object.keys(rows[0]).join(','),
...rows.map(r => Object.values(r).join(','))].join('\n');
return new Response(csv, {
headers: {
'Content-Type': 'text/csv',
'Content-Disposition': 'attachment; filename=transactions.csv'
}
});
}
return Response.json(rows);
}
Use the session to derive user_id server-side — never read it from request parameters, which can be tampered with to access other users' records.
DetectionPro
The detection method for this pattern is part of AuditBuffet Pro.
The full method (what to look for, pass and fail conditions, and how results get reported) ships inside the Financial Audit Trail Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
External references
- gdpr · Art. 20 — Right to data portability — users can receive their personal data in machine-readable format
- external · CFPB-1033 — CFPB Personal Financial Data Rights Rule (12 CFR Part 1033) — consumer access to transaction data
- ccpa · §1798.110 — Right to know — consumers can request disclosure of personal information collected
Taxons
History
- 2026-04-18·v1.0.0·Initial import from finserv-audit-trail·automated