Skip to content

fix: mask ssn in frontend#4298

Merged
lassopicasso merged 1 commit into
mainfrom
mask-ssn-in-frontend
Jun 19, 2026
Merged

fix: mask ssn in frontend#4298
lassopicasso merged 1 commit into
mainfrom
mask-ssn-in-frontend

Conversation

@lassopicasso

@lassopicasso lassopicasso commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Description

Display the ssn as masked with digit stars instead of the last 5 numbers.

image

Related Issue(s)

  • closes #{issue number}

Verification/QA

  • Manual functionality testing
    • I have tested these changes manually
    • Creator of the original issue (or service owner) has been contacted for manual testing (or will be contacted when released in alpha)
    • No testing done/necessary
  • Automated tests
    • Unit test(s) have been added/updated
    • Cypress E2E test(s) have been added/updated
    • No automatic tests are needed here (no functional changes/additions)
    • I want someone to help me make some tests
  • UU/WCAG (follow these guidelines until we have our own)
    • I have tested with a screen reader/keyboard navigation/automated wcag validator
    • No testing done/necessary (no DOM/visual changes)
    • I want someone to help me perform accessibility testing
  • User documentation @ altinn-studio-docs
    • Has been added/updated
    • No functionality has been changed/added, so no documentation is needed
    • I will do that later/have created an issue
  • Support in Altinn Studio
    • Issue(s) created for support in Studio
    • This change/feature does not require any changes to Altinn Studio
  • Sprint board
    • The original issue (or this PR itself) has been added to the Team Apps project and to the current sprint board
    • I don't have permissions to do that, please help me out
  • Labels
    • I have added a kind/* and backport* label to this PR for proper release notes grouping
    • I don't have permissions to add labels, please help me out

Summary by CodeRabbit

Release Notes

  • Bug Fixes
    • Personal SSN masking has been implemented across the application. In all views displaying personal identification information—including party selection, confirmation pages, and instance summaries—SSN values now appear in masked format (showing the first 6 digits followed by asterisks, e.g., 010175*****) rather than the complete number.

@lassopicasso lassopicasso added kind/other Pull requests containing chores/repo structure/other changes backport This PR should be cherry-picked onto older release branches labels Jun 19, 2026
@coderabbitai

coderabbitai Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

A new maskSsn utility is introduced that truncates an SSN to its first 6 characters and appends five asterisks. This utility is then imported and applied in AltinnParty, InstanceInformationComponent, and returnConfirmSummaryObject wherever a personal SSN is rendered or included in a sender string. Affected tests are updated to assert against the masked format.

Changes

SSN Masking Feature

Layer / File(s) Summary
maskSsn utility
src/utils/maskSsn.ts
New exported function accepts string | null | undefined, returns an empty string for falsy inputs, and otherwise returns the first 6 characters followed by *****.
SSN masking in display components and helpers
src/components/altinnParty.tsx, src/layout/InstanceInformation/InstanceInformationComponent.tsx, src/features/process/confirm/helpers/returnConfirmSummaryObject.ts
Each file imports maskSsn and replaces the raw ssn reference with maskSsn(ssn) when constructing the displayed personal identifier or sender string; org-number paths remain unchanged.
Test assertions updated for masked SSN output
src/components/altinnParty.test.tsx, src/features/instantiate/containers/PartySelection.test.tsx, src/features/pdf/PDFWrapper.test.tsx, src/features/process/confirm/containers/ConfirmPage.test.tsx, src/features/process/confirm/helpers/returnConfirmSummaryObject.test.ts
Expected SSN strings in all affected test assertions are updated from the full 11-digit value to the <6-digit-prefix>***** masked format.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Suggested reviewers

  • adamhaeger
  • phlipsterit
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning PR description is incomplete. Missing related issue number, unchecked critical verification checkboxes for automated and accessibility testing, and no kind/backport labels confirmed despite mentioning them. Add related issue number, confirm automated test updates match the code changes, document accessibility testing completion, and verify labels have been added to the PR.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix: mask ssn in frontend' clearly and directly summarizes the main change: masking SSN display in the frontend UI with asterisks.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch mask-ssn-in-frontend

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sonarqubecloud

Copy link
Copy Markdown

@lassopicasso lassopicasso merged commit 4c26e55 into main Jun 19, 2026
18 checks passed
@lassopicasso lassopicasso deleted the mask-ssn-in-frontend branch June 19, 2026 07:58
@github-actions

Copy link
Copy Markdown
Contributor

Automatic backport successful!

A backport PR has been automatically created for the release/v4.31 release branch.

The release branch release/v4.31 already existed and was updated.

The cherry-pick was clean with no conflicts. Please review the backport PR when it appears.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport This PR should be cherry-picked onto older release branches kind/other Pull requests containing chores/repo structure/other changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants