Repository navigation
feat(report-inbox): report mailbox that credits forwarded reports automatically - #19
Merged
Merged
Conversation
…omatically Staff forward a suspicious email to a configured report mailbox (e.g. lapor@acme.test). The poller reads it alongside the reply mailbox, pulls the original sender and subject out of inline, attached or HTML-only forwards, and feeds the report inbox, so reporting a simulation now raises the campaign's report rate without a trainer recording it by hand. - live config: report_imap_user / report_imap_password (masked); rejected when equal to the reply mailbox, since replies would count as reports. - GET /report-inbox/mailbox and POST /report-inbox/poll for staff; POST /live/poll now polls both mailboxes. - Classification prefers the newest matching campaign the reporter actually received and has not reported yet, so campaigns that reuse a sender or subject credit the right one. - Mailbox-path reports are filed under the campaign's (or reporter's) org. - Report inbox page shows the address and a "check now" button. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Stacked on #18.
What
lapor@acme.test). Every 30 s Pretexta reads it (same IMAP server as replies, separate watermark), extracts the original sender/subject from inline, attached (message/rfc822) or HTML-only forwards, and passes it to the report inbox. Simulations credit the reporter → report rate and time-to-report update automatically.report_imap_user/report_imap_passwordin Settings → Live Campaigns (password masked). Saving fails with 400 if it equals the reply mailbox (replies would count as reports).GET /api/report-inbox/mailbox,POST /api/report-inbox/poll(trainer+);POST /api/live/pollnow returns{replies, reports}.Why
Report rate is the headline metric, but reports only counted when a trainer typed them in. Replying to the lure is engagement, not reporting; the real-world reporting behaviour is forwarding to an abuse address, and that now works end to end.
Testing
pytest: 228 passed (newtests/test_report_mailbox.py: inline/attachment/HTML parsing, org attribution, watermark + skip of the mailbox's own messages, endpoint auth, config validation, reused-sender campaign selection)ruff check/ruff formatclean;CI=true craco buildOKlapor@acme.test→ credited to the running campaign within one poll; report rate 0% → 100%, median time to report filled.🤖 Generated with Claude Code