Repository navigation
ops(certification): add --skip-personal-email-fallback flag to credential repair script - #4882
Merged
Merged
Conversation
…tial repair The repair script in server/src/scripts/repair-credential-recipient-names.ts now accepts a flag that skips credentials whose backfill value would be the user's email AND the email domain is a personal-email provider (gmail, hotmail, yahoo, icloud, etc.). Avoids surfacing personal-email PII on a publicly-shareable credential artifact. Corporate-email users still get repaired — their email is already public on business cards / LinkedIn. Personal-email users wait for the NAME_REQUIRED gate + set_my_name recovery flow (#4799) to populate their name in users.first_name; re-running the backfill then picks them up. Closes the cleanup loop for #4753 and #4760. Tom Hespos's two credentials in #4760 are unaffected — we have his real name in the users table, so the script writes "Tom Hespos" not his email. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
Contributor
There was a problem hiding this comment.
LGTM. Skip branch is correctly scoped to the post-needsRepair path, default behavior is unchanged, and the dry-run prod numbers (20 → 18 + 2 skipped) line up with the new flag's intent.
Things I checked
isPersonalEmailFallbackatserver/src/scripts/repair-credential-recipient-names.ts:94-99.buildRecipientName(server/src/services/certifier-client.ts:32-35) returnsuser.emailverbatim when both trimmed name fields are empty, sodesired === emailis the precise signal for the fallback path. Both sides come from the samerow.emailreference, so casing/whitespace can't desync the equality.- The skip fires inside the
needsRepair === truebranch atrepair-credential-recipient-names.ts:177. All three repair triggers (undefined-literal,null-literal, email-with-real-name) interact correctly: the email-with-real-name path can never reachdesired === emailbecause that requiresfirst_name || last_name, which meansdesiredis a real name. Logic is tight. - Domain extraction at line 98 uses
lastIndexOf('@')(handles RFC-legal quoted locals) and lowercases the domain. Set entries are all lowercase. Right shape. - Default fail-mode-on-omission. Forgetting the flag preserves prior behavior. No CI/cron invokes this — manual
fly ssh consoleonly per the docstring. Fail-closed beats fail-open. - Logging. Skip path appends to
skipped[](line 178-183) which prints count only at line 209. The plan path's email log at line 215 is unchanged from baseline. No new PII surface. - Changeset. Empty frontmatter matches existing ops-only convention (
.changeset/2303-policy-attribution-pattern.md,.changeset/2383-test-vector-index-scope-update.md). - PATCH payload at line 234 is unchanged — diff is strictly narrower data flow.
Follow-ups (non-blocking — file as issues)
PERSONAL_EMAIL_DOMAINSis the obvious 23-domain set but misses the long tail that, for the stated PII goal, is exactly the population least likely to want their email on a public certificate: major US ISPs (comcast.net,att.net,verizon.net,cox.net,sbcglobal.net), German freemail (web.de,t-online.de,gmx.net,freenet.de), French (orange.fr,free.fr,wanadoo.fr,laposte.net), Yahoo regional TLDs beyond.co.uk(.fr/.de/.co.jp),mail.ru,yandex.com,naver.com,qq.com,163.com. Non-blocking because the operator sees the repair plan in dry-run before--applyand can spot ISP fallbacks then — but worth expanding before the next cleanup wave so the dry-run is doing less manual eyeballing.
code-reviewer: sound. security-reviewer: sound with one Low defense-in-depth note (the domain-list gap, captured as the Follow-up above).
LGTM. Follow-ups noted below.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a flag to `server/src/scripts/repair-credential-recipient-names.ts` that skips credentials whose backfill value would be the user's email AND the email domain is a personal-email provider (gmail, hotmail, yahoo, icloud, etc.).
Why
Dry-run against prod surfaced 20 credentials with broken recipient names ("undefined undefined" or "Davide undefined"). 11 of them have real names available in `users.first_name` / `users.last_name` and will write a proper name. The other 9 fall back to the email — fine for corporate addresses (publicly listed on the user's LinkedIn anyway), problematic for personal addresses (`gmail.com`, `hotmail.co.uk`) on a publicly-linkable certificate artifact.
This flag lets us repair the 18-of-20 cases (real names + corporate emails) and leave 2 personal-email-fallback cases until the user provides their name via Addie's `set_my_name` recovery flow (#4799), at which point a re-run picks them up cleanly.
Validation
Cleanup operation
After merge, runbook:
```bash
1. Dry-run with the new flag to verify scope
fly ssh console -a adcp-docs -C 'node /app/dist/scripts/repair-credential-recipient-names.js --skip-personal-email-fallback'
2. Apply
fly ssh console -a adcp-docs -C 'node /app/dist/scripts/repair-credential-recipient-names.js --skip-personal-email-fallback --apply'
```
Closes the cleanup loop for #4753 (geneticallymodifiedfoodforthought) and #4760 (THespos). Tom Hespos's two credentials in #4760 are unaffected by the new flag — we have his real name in the users table, so the script writes "Tom Hespos".
Follow-up