mirror of
https://github.com/hanzoai/iam.git
synced 2026-11-19 18:37:16 +00:00
Align provisioning with the existing link refusal: an IdP address that is not verified must not create a usable identity. githubPrimaryEmail no longer returns the unproven profile email as a provisionable address. userinfo already emits email_verified from User.EmailVerified; add an idempotent dry-run backfill script (not wired to CI) with documented proof criteria so RPs that require the claim can land safely. Does not change live app-built-in signup or GitHub federation config. Co-authored-by: zeekay <[email protected]>
EmailVerified backfill (do not run from CI)
Safe, idempotent operator script to set EmailVerified=true on accounts that
already proved mailbox control. Postiz (and other RPs) read email_verified from
userinfo, which mirrors the stored User.EmailVerified bit.
Criteria (mark verified)
Mark an account verified only when at least one of the following is true:
- OTP / code prove — audit or signup history shows a successful email code
challenge for the current primary email (
Actionrelated to address/code prove; see address + code signup paths). - Verified federation link — the account was linked or provisioned with an
IdP that asserted a verified email for the current primary address
(federation link write already sets
EmailVerified=truegoing forward). - Manual operator attestation — named admin documents the mailbox owner out-of-band (break-glass); record reason in the audit log.
Do not mark verified when
- The only email source was an unverified IdP profile email.
- The primary email has changed since the last proof (re-prove required).
- The account is deleted / hashed / soft-deleted.
How to run (manual)
# Dry-run (default): print owner/name counts only — no writes.
go run ./scripts/email_verified_backfill -dry-run
# Apply after reviewing the dry-run list.
go run ./scripts/email_verified_backfill -dry-run=false
Requires the same DB DSN env the IAM process uses. The script is idempotent:
rows already EmailVerified=true are skipped.
Ordering with Postiz
- Deploy this IAM change (refuse unverified federated provision).
- Run the backfill for proven team accounts.
- Confirm userinfo returns
email_verified: truefor admins who need Postiz email-link aftersubdrift. - Then merge/deploy Postiz “require email_verified for email-link”.