From a9c7f4c575979885d9218cbc147b92f323e98a35 Mon Sep 17 00:00:00 2001 From: ghostersk Date: Sun, 15 Mar 2026 19:33:51 +0000 Subject: [PATCH] personal outlook working - still needs tuning --- README.md | 243 +++++---------------- cmd/server/main.go | 2 + config/config.go | 20 +- go.mod | 9 +- go.sum | 18 +- internal/auth/oauth.go | 210 +++++++++++++++--- internal/db/db.go | 37 ++++ internal/email/imap.go | 50 ++++- internal/graph/graph.go | 397 ++++++++++++++++++++++++++++++++++ internal/handlers/api.go | 103 ++++++--- internal/handlers/auth.go | 199 ++++++++++++++++- internal/handlers/handlers.go | 2 +- internal/models/models.go | 7 +- internal/syncer/syncer.go | 189 +++++++++++++++- web/static/css/gowebmail.css | 63 ++++++ web/static/img/outlook.png | Bin 0 -> 4450 bytes web/static/js/app.js | 119 +++++++++- web/templates/app.html | 24 +- web/templates/base.html | 4 +- 19 files changed, 1395 insertions(+), 301 deletions(-) create mode 100644 internal/graph/graph.go create mode 100644 web/static/img/outlook.png diff --git a/README.md b/README.md index cde057d..e14979c 100644 --- a/README.md +++ b/README.md @@ -1,215 +1,110 @@ # GoWebMail -A self-hosted, multi-user, encrypted web email client written entirely in Go. Supports Gmail and Outlook via OAuth2, plus any standard IMAP/SMTP provider (Fastmail, ProtonMail Bridge, iCloud, etc.). +A self-hosted, encrypted web email client written entirely in Go. Supports Gmail and Outlook via OAuth2, plus any standard IMAP/SMTP provider. -> **Notes:** -> - Work still in progress (Gmail and Outlook OAuth2 not yet fully tested in production) -> - AI-assisted development — suggestions and contributions very welcome! +# Notes: +- work still in progress ( gmail and hotmail email not tested yet, just prepared the app for it) +- AI is involved in making this work, as I do not have the skill and time to do it on my own +- looking for any advice and suggestions to improve it! ## Features -### Email - **Unified inbox** — view emails from all connected accounts in one stream -- **Gmail & Outlook OAuth2** — modern token-based auth (no raw passwords stored for these providers) -- **IMAP/SMTP** — connect any standard provider with username/password credentials -- **Auto-detect mail settings** — MX lookup + common port patterns to pre-fill IMAP/SMTP config -- **Send / Reply / Forward / Draft** — full compose workflow with floating draggable compose window -- **Attachments** — view inline images, download individual files or all at once -- **Forward as attachment** — attach original `.eml` as `message/rfc822` -- **Folder navigation** — per-account folder/label browsing with right-click context menu -- **Full-text search** — across all accounts and folders locally (no server-side search required) -- **Message filtering** — unread only, starred, has attachment, from/to filters -- **Bulk operations** — multi-select with Ctrl+click / Shift+range; bulk mark read/delete -- **Drag-and-drop** — move messages to folders; attach files in compose -- **Starred messages** — virtual folder across all accounts -- **EML download** — download raw message as `.eml` -- **Raw headers view** — fetches full RFC 822 headers from IMAP on demand - -### Security -- **AES-256-GCM encryption** — all email content, credentials and OAuth tokens encrypted at rest in SQLite (field-level, not whole-DB encryption) +- **Gmail & Outlook OAuth2** — modern, token-based auth (no storing raw passwords for these providers) +- **IMAP/SMTP** — connect any provider (ProtonMail Bridge, Fastmail, iCloud, etc.) +- **AES-256-GCM encryption** — all email content encrypted at rest in SQLite - **bcrypt password hashing** — GoWebMail account passwords hashed with cost=12 -- **TOTP MFA** — custom implementation, no external library; ±60s window for clock skew tolerance -- **Brute-force IP blocking** — auto-blocks IPs after configurable failed login attempts (default: 5 attempts in 30 min → 12h ban); permanent blocks supported -- **Geo-blocking** — deny or allow-only access by country via ip-api.com (no API key needed); 24h in-memory cache -- **Per-user IP access rules** — each user configures their own IP allow-list or brute-force bypass list independently of global rules -- **Security alert emails** — notifies the targeted user when their account is brute-forced; supports STARTTLS, implicit TLS, and plain relay -- **DNS rebinding protection** — `HostCheckMiddleware` rejects requests with unexpected `Host` headers -- **Security headers** — CSP, X-Frame-Options, Referrer-Policy, Permissions-Policy, X-XSS-Protection on all responses -- **Sandboxed HTML email rendering** — emails rendered in CSP-sandboxed `