fix(security): demo sends nothing, hidden SMTP password, body limits (FLAW-33..38)
MindSift CI & Docker Release / Build, Test in Container & Push (push) Successful in 1m52s
MindSift CI & Docker Release / Build, Test in Container & Push (push) Successful in 1m52s
- Demo: senders for mail, Discord and webhooks refuse, no alarm ticker; test alarm, SMTP test, server settings, backups, account and session changes of the shared demo accounts answer 403; the session list only shows the own device. The UI shows the notices and disables the controls. - SMTP password is never sent back (smtpPassSet), empty keeps it. - ?token= on webhook ingest accepts only API keys. - Request bodies capped at 2 MB (sync 8 MB, imports 101 MB). - Deleting an account removes its server backups. - Backup downloads, exports and import uploads get 30 minutes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3709282a4f
commit
9d9698186c
21 files changed
+631
-304
No files matched your search
@@ -1,6 +1,7 @@
|
||||
package api
|
||||
|
||||
import (
|
||||
"errors"
|
||||
"log/slog"
|
||||
"net/http"
|
||||
"strings"
|
||||
@@ -75,3 +76,18 @@ func (s *Server) startDemoResetTicker() {
|
||||
s.resetDemo()
|
||||
}
|
||||
}
|
||||
|
||||
// A public demo must not send anything to the outside (FLAW-33): no alarm mails, Discord or webhook
|
||||
// calls, no test messages. The senders refuse, and the routes that only exist to send or to change
|
||||
// server settings answer with 403 right away. All visitors share the demo accounts, so whatever
|
||||
// would lock the others out (passwords, ending sessions, deleting accounts) is refused as well.
|
||||
var errDemoOutgoing = errors.New("In der Demo deaktiviert")
|
||||
|
||||
func (s *Server) notInDemo(h http.HandlerFunc) http.HandlerFunc {
|
||||
if !s.cfg.DemoMode {
|
||||
return h
|
||||
}
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
writeError(w, http.StatusForbidden, "In der Demo deaktiviert")
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user