What would you automate for sensitive-data exposure after authentication state changes, and what would you leave manual?
Answer
Before automating, map every privilege transition that should change which fields a response is allowed to contain, logins, impersonation, step-down, role changes, since a field masked at one privilege level must stay masked through every transition, not just the steady state. Focus on sensitive-data exposure after authentication state changes. Use 'no field that should be masked for the lower privilege level appears in the response, before or after the transition' as the oracle. Cover impersonation and step-down specifically, since a higher-privilege session's cached response can otherwise leak into a lower-privilege view during the switch. Automate a check that captures the full API response immediately before and after a privilege transition and diffs it against the masking rules. Leave manual the periodic review of newly added profile or response fields, since automated coverage only catches fields it has been told to check.
Strong answer includes
- explicit risk and test oracle for sensitive-data exposure
- tests masking rules across privilege transitions, not just steady state
- covers impersonation and privilege step-down specifically
- measurable evidence and residual-risk statement
Practical example
The team automated a check that captures the full API response for a user profile before and after a step-down in privilege (like an admin impersonating a regular user), asserting no field that should be masked for the lower privilege level appears in either response. They left manual the periodic review of new fields added to the profile schema, since automated coverage only catches fields it's told to check.