docs,cmd: warn about broad scope for self-signup users (GHSA-6759-996p-gpj6)
When Signup is enabled with the default scope and createUserDir off, every self-registered user inherits the served root and can read/modify/delete all files. Add a startup WARNING for this configuration and document the risk and the --createUserDir mitigation. No behavior or default change.
This commit is contained in:
2 files changed
+25
No files matched your search
+13
@@ -13,6 +13,7 @@ import (
|
||||
"os"
|
||||
"os/signal"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
@@ -381,6 +382,18 @@ func getServerSettings(v *viper.Viper, st *storage.Storage) (*settings.Server, e
|
||||
log.Println("WARNING: you fully understand and trust the contents of every user scope.")
|
||||
}
|
||||
|
||||
if set, err := st.Settings.Get(); err == nil && set.Signup {
|
||||
scope := strings.TrimSpace(set.Defaults.Scope)
|
||||
scopeIsRoot := scope == "" || scope == "." || scope == "/"
|
||||
|
||||
if !set.CreateUserDir && scopeIsRoot {
|
||||
log.Println("WARNING: Signup is enabled without createUserDir and the default scope is")
|
||||
log.Println("WARNING: the server root, so every self-registered user can read, modify and")
|
||||
log.Println("WARNING: delete all files File Browser serves, including other users' files.")
|
||||
log.Println("WARNING: Enable createUserDir, or set a default scope other than the root.")
|
||||
}
|
||||
}
|
||||
|
||||
return server, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user