Skip to content

Commit ea082b3

Browse files
carhartlewisclaude
andcommitted
fix(background-checks): remove employee PII from sessionStorage
Stop storing employeeName and employeeEmail in sessionStorage during the Stripe billing redirect flow. Only requesterNotes (non-PII) is persisted. After redirect, employeeName re-derives from the employee prop and the email field resets to its default. Resolves code-scanning alert #133 (clear text storage of sensitive information). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 6d56a2d commit ea082b3

2 files changed

Lines changed: 4 additions & 5 deletions

File tree

apps/app/src/app/(app)/[orgId]/people/[employeeId]/components/EmployeeBackgroundCheck.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -191,8 +191,8 @@ export function EmployeeBackgroundCheck({
191191
}
192192

193193
form.reset({
194-
employeeName: pendingRequest.employeeName,
195-
employeeEmail: pendingRequest.employeeEmail,
194+
employeeName: form.getValues('employeeName') || employee.user.name || '',
195+
employeeEmail: form.getValues('employeeEmail') || '',
196196
requesterNotes: pendingRequest.requesterNotes ?? '',
197197
});
198198
setBillingSetupComplete(true);

apps/app/src/app/(app)/[orgId]/people/[employeeId]/components/backgroundCheckForm.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ export const backgroundCheckSchema = z.object({
88

99
export type BackgroundCheckFormValues = z.infer<typeof backgroundCheckSchema>;
1010

11-
const pendingBackgroundCheckSchema = backgroundCheckSchema.extend({
11+
const pendingBackgroundCheckSchema = z.object({
1212
memberId: z.string(),
1313
organizationId: z.string(),
14+
requesterNotes: z.string().optional(),
1415
});
1516

1617
export type PendingBackgroundCheckRequest = z.infer<typeof pendingBackgroundCheckSchema>;
@@ -65,8 +66,6 @@ export function writePendingBackgroundCheckRequest({
6566
const pendingRequest: PendingBackgroundCheckRequest = {
6667
organizationId,
6768
memberId,
68-
employeeName: values.employeeName,
69-
employeeEmail: values.employeeEmail,
7069
requesterNotes: values.requesterNotes,
7170
};
7271
window.sessionStorage.setItem(

0 commit comments

Comments
 (0)