Overview
A security fix should include a regression test whenever the behavior can be represented reliably. The test records the exploit condition and the expected safe outcome.
Test authorization boundaries
Verify that users cannot read or modify another user's records by changing identifiers. Test role changes, revoked sessions and direct requests to protected endpoints.
Test input and output handling
Include malformed input, unexpected encodings and context-sensitive output. For uploads, verify both content validation and access controls.
Keep tests safe
Use synthetic accounts and data. Do not execute destructive payloads against production systems or include real credentials in fixtures.
Make the security property explicit
A test should explain what must be denied or protected, not merely assert that a generic error page appeared. Check status, side effects and whether sensitive data was exposed.