Skip to content

Add account security check endpoint#12464

Merged
mekarpeles merged 1 commit intomasterfrom
check-email-affected-accounts
Apr 28, 2026
Merged

Add account security check endpoint#12464
mekarpeles merged 1 commit intomasterfrom
check-email-affected-accounts

Conversation

@mekarpeles
Copy link
Copy Markdown
Member

Summary

  • Adds GET /account/security/1777402351 — logged-in users are checked automatically against the affected accounts set; logged-out visitors see an email input form
  • Adds POST /account/security/1777402351 — accepts an email, validates it with valid_email(), and returns a boolean result (affected / not affected)
  • Email lookup uses a fully parameterized query against the account table; SQL injection is not possible
  • All user-visible strings are wrapped with _() for i18n; variable interpolation uses OL's websafe() keyword-arg pattern

Test plan

  • Visit /account/security/1777402351 while logged out — email form renders
  • Submit an invalid/malformed email — validation error shown, no DB query made
  • Submit an email not present in the account table — "not in the affected set"
  • Submit an email present with thing_id <= 51085470 — "in the affected set"
  • Submit an email present with thing_id > 51085470 — "not in the affected set"
  • Visit while logged in — page auto-checks the session user's email and shows result without a form

Copilot AI review requested due to automatic review settings April 28, 2026 20:47
@mekarpeles mekarpeles force-pushed the check-email-affected-accounts branch 7 times, most recently from 1f18c2d to c5dd095 Compare April 28, 2026 22:30
Adds a GET-only endpoint that checks whether the logged-in user's
account appears in the account table with thing_id <= 51085470.

- URL slug is ISO 8601 with hour granularity (2026-04-28T18Z UTC)
- Logged-out visitors receive a login link that redirects back after auth
- No email form — login required, preventing oracle enumeration attacks
- Incident date (2026-04-28T18Z) displayed in the page header
- Result shown with green (not affected) or red (affected) background
- "not" emphasized with <em> in the safe result
- All user-visible strings wrapped with _() for i18n
- Threshold and DB check encapsulated as class var and classmethod on
  account_security_check
@mekarpeles mekarpeles force-pushed the check-email-affected-accounts branch from c5dd095 to 40f0b77 Compare April 28, 2026 22:31
Copy link
Copy Markdown
Collaborator

@cdrini cdrini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm ; tested on testing all cases and they worked correctly.

@mekarpeles mekarpeles merged commit 4175ec5 into master Apr 28, 2026
7 checks passed
@mekarpeles mekarpeles deleted the check-email-affected-accounts branch April 28, 2026 23:13
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.

2 participants