Skip to content

Commit

Permalink
do not log text input
Browse files Browse the repository at this point in the history
  • Loading branch information
tenox7 committed Mar 28, 2022
1 parent e861dde commit a1b8473
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
4 changes: 0 additions & 4 deletions TODO.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,10 @@
* Docker support

## Security
* do not log FormValue["text"] as it contains text data from edit
* userless/guest read-only mode, user rw
requires custom login window
* two factor auth
requires custom login window
* docker support
no chroot - mount dir as / ?
env vars for port, etc?
* garbage collect old f2b entries
* f2b ddos prevention, sleep on too many bans?

Expand Down
13 changes: 12 additions & 1 deletion handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ func wfm(w http.ResponseWriter, r *http.Request) {
if user == "" {
return
}
log.Printf("req from=%q user=%q uri=%q form=%v", r.RemoteAddr, user, r.RequestURI, r.Form)
go log.Printf("req from=%q user=%q uri=%q form=%v", r.RemoteAddr, user, r.RequestURI, noText(r.Form))
modern := false
if strings.HasPrefix(r.UserAgent(), "Mozilla/5") {
modern = true
Expand Down Expand Up @@ -114,3 +114,14 @@ func wfm(w http.ResponseWriter, r *http.Request) {
func favicon(w http.ResponseWriter, r *http.Request) {
dispFavIcon(w)
}

func noText(m map[string][]string) map[string][]string {
o := make(map[string][]string)
for k, v := range m {
if k == "text" {
continue
}
o[k] = v
}
return o
}

0 comments on commit a1b8473

Please sign in to comment.