Story #43 Sensitive Data Exposure · Response Projection · Field-Level Authorization

The Customer API That Returned Internal Risk Notes

"Partners could read the customer record. They could also read the fraud flags"

A financial services company reused an internal serializer for a new partner-facing customer endpoint. The endpoint authenticated and authorized partners correctly—but returned the entire internal model, including support notes, fraud-review flags, and operational metadata partners weren't permitted to see.

What happened

A financial services company consolidated several customer endpoints around a shared response model. The model was originally designed for internal case workers and included support notes, fraud-review flags, and operational metadata. A new partner-facing endpoint reused the same serializer to reduce duplicated code.

The endpoint correctly authenticated partner users and checked that they could view the customer record. However, it returned the entire serialized model. Partners could see internal risk notes and operational flags that were not part of their permitted data view. No credentials or passwords were exposed, but the information was still confidential and could influence customer treatment.

The issue was discovered during a partner access review. The response schema documented only the expected public fields, but the implementation returned additional properties. Existing tests asserted that required fields were present; they did not assert that unauthorized fields were absent.

Root cause

A shared internal serializer exposed fields beyond the partner API’s authorization boundary. Tests checked for field presence but not unexpected sensitive field exposure.

The fix

The company created audience-specific response DTOs and explicit field projections. Contract tests now compare the complete response against an allowlisted schema for each role and inspect nested objects, exports, and error responses.

Testing gaps and preventive tests

Negative schema assertions, role-specific response contracts, nested-object inspection, and synthetic sensitive-marker checks. Response contracts must define what is allowed to leave the service, not merely what fields clients are expected to use.

Business impact

Confidential internal customer information was disclosed to external partners, requiring access review and remediation.

Lesson learned

Response contracts must define what is allowed to leave the service, not merely what fields clients are expected to use.

The Customer API That Returned Internal Risk Notes