Excessive Data Exposure
Overview
APIs that return complete database objects rely on the frontend to filter sensitive fields. This is a common vulnerability (OWASP API3) where:
- Password hashes returned in user objects
- Internal IDs, audit timestamps exposed
- Admin-only fields visible to all users
- Credit card details partially exposed
Remediation
- Use Data Transfer Objects (DTOs) that explicitly define what fields to return
- Never return entire database models directly
- Use field-level serialization control (
@JsonIgnore,exclude,select)