Skip to content

feat(auth): capture requester contact details and email approval notifications (#142) - #144

Open
danielnaab wants to merge 10 commits into
mainfrom
story-142/access-request-contact-details
Open

danielnaab wants to merge 10 commits into
mainfrom
story-142/access-request-contact-details

Conversation

@danielnaab

@danielnaab danielnaab commented Dec 4, 2026 •

Copy link
Copy Markdown
Member

Closes #142. Builds on #143 (merged), the central approval check.

Context

When an outside user requested access, we kept only their GitHub login, name and avatar. Approving them notified no one. Admins had no way to reach requesters, and requesters never learned they'd been let in.

Design: notes/story-142-access-request-contact-details/design.md

Changes

Capturing contact details

  • At every sign-in, the app saves all of the user's GitHub emails, with their primary, verified and visibility flags.
  • It also saves an allowlisted set of public profile fields: name, company, location, website, bio, public email, X handle, account ID, account created date and profile URL. Account-internal data such as plan and 2FA status is deliberately not stored.
  • Pending requesters get their details refreshed when they sign in again, so requests made before this change fill in too.

Request flow

  • The request page has one optional, casual free-text note (up to 1000 characters).
  • A pending user who signs in sees a status page showing:
    • when they asked
    • the address we'll email them at, or a tip to add a verified GitHub email
    • their note, which they can edit
  • Users who already have a request no longer see the blank form.
  • Slack: access.requested now includes the contact email, company and note. Editing the note posts access.request-updated, but only if the note actually changed. User text is escaped for Slack.

Admin and email

  • /admin/users shows each pending and approved user's contact email as a mailto: link, all their emails with Primary/Verified tags, their profile details and their note.
  • Links are only built for safe http(s) URLs, plain email addresses and valid handles.
  • Approving a pending or revoked user emails their primary verified address through SES, using a fixed template that links to the deployment.
    • The outcome is recorded and shown on the page as "Approval email sent " or "not sent: ".
    • A failed send never blocks approval, and re-approving an already-approved user sends nothing.
  • New src/services/email/ service. @aws-sdk/client-sesv2 is used only in ses-sender.ts. Without EMAIL_FROM set, the app logs the email instead of sending it.

Infrastructure and docs

  • Pulumi, for the stack with a domain configured: an SES domain identity, its 3 DKIM CNAME records in Route53, and ses:SendEmail permission scoped to that identity.
  • deploy.nix writes EMAIL_FROM into the .env for main only.
  • The threat model now has an SES boundary, covers the new personal data, and records residual risks: no retention policy, no SPF/DMARC record, access requests can be spammed.
  • Operator steps (DKIM check, SES sandbox exit) are in catalog/architecture/deployment.md.

Testing

  • bun run check passes (1533 tests, 0 failures)
  • Independent review and an end-to-end run of the local app with seeded data. Covered: request form, admin details, escaping of <script> and javascript: input, approval with email not configured, and an axe check (no new issues).
  • Pulumi type-checks and deploy.nix parses
  • Not yet verified: real SES sending (blocked on AWS access), Pulumi preview/apply, real GitHub sign-in

After merge

  1. bun run cli infra up (flexion_marketing stack) creates the SES identity, DKIM records and IAM permission.
  2. bun run cli nixos apply, because deploy.nix changed.
  3. Request SES production access (sandbox exit) for the account.

Base automatically changed from fix/auth-require-approved to main December 5, 2026 05:44
…mplate

Isolates @aws-sdk/client-sesv2 to services/email/ses-sender.ts. Falls back
to a logging sender when EMAIL_FROM is unset. Pulumi adds an SES domain
identity with DKIM records and a send-only role policy; main's .env gets
EMAIL_FROM.

Refs #142

Pot-Run: 7979
Saves every GitHub email (with primary/verified/visibility flags) and the
public profile fields at sign-in for all users. Adds an optional note to
the request-access form and includes contact details in the Slack alert,
with user text escaped for Slack.

Refs #142

Pot-Run: 7979
Approving a pending or revoked user sends the access-approved email to
their primary verified address and records the outcome, which the admin
page shows. Pending and approved rows show contact email, all emails with
flags, profile details and the request note. Extracts getExternalOrigin
and getDeploymentName into shared/. Threat model covers the new personal
data and the SES boundary.

Refs #142

Pot-Run: 7979
Requests made before contact capture would otherwise never get emails
stored, so their approval email could not be sent.

Refs #142

Pot-Run: 7979
Links are only built for plain email addresses and valid X handles.

Refs #142

Pot-Run: 7979
Signed-in pending users are sent to a status page showing when they
asked, where we'll email them, and their note, which they can edit.
Only an actual change is stored and posts an access.request-updated
Slack alert; repeat submissions no longer post alerts. Users who already
have an entry no longer see the blank request form.

Refs #142

Pot-Run: 7979
Builds on the central approval check: the status page reads the
requester session, and the session is kept after a request so they can
come back. Revoked users are signed out by the session reader.

Refs #142

Pot-Run: 7979

This branch was successfully deployed

1 active deployment
story-142-access-request-contact-details — 7ff381a3 Deployed Dec 5, 2026 by danielnaab
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Capture requester contact details and email approval notifications

1 participant