Skip to content

feat(report-inbox): report mailbox that credits forwarded reports automatically - #19

Merged
dalpan merged 1 commit into
feature/triage-whatsappfrom
feature/report-mailbox
Oct 30, 2026
Merged

dalpan merged 1 commit into
feature/triage-whatsappfrom
feature/report-mailbox

Conversation

@dalpan

@dalpan dalpan commented Oct 30, 2026

Copy link
Copy Markdown
Owner

Stacked on #18.

What

  • Report mailbox poller: staff forward a suspicious email to a configured mailbox (e.g. 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.
  • Config: report_imap_user / report_imap_password in Settings → Live Campaigns (password masked). Saving fails with 400 if it equals the reply mailbox (replies would count as reports).
  • API: GET /api/report-inbox/mailbox, POST /api/report-inbox/poll (trainer+); POST /api/live/poll now returns {replies, reports}.
  • Classification fix: campaigns often reuse a sender/subject. Matching now prefers the newest campaign the reporter actually received and hasn't reported yet (previously the first match could be an old, killed campaign).
  • Mailbox-path reports are filed under the matched campaign's org (else the reporter's).
  • Laporan Phishing page: "Mailbox pelaporan" card with the address and a "check now" button; manual form kept for reports from other channels.
  • Docs: user guide, API, walkthrough (setup row + troubleshooting "replied but Reported stays 0").

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 (new tests/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 format clean; CI=true craco build OK
  • Manual (GoPhish + GreenMail): forwarded the lure to lapor@acme.test → credited to the running campaign within one poll; report rate 0% → 100%, median time to report filled.

🤖 Generated with Claude Code

…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>
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.

1 participant