Use base64 encoded user name as their base dir
This is safe in all circumstance and leaves it up to the auth backend to use whatever name they like for authentication.
This commit is contained in:
parent
04be038c05
commit
07c19a6f6c
@ -45,8 +45,8 @@ func (b *filesystemBackend) pathForContext(ctx context.Context) (string, error)
|
||||
if !ok {
|
||||
panic("Invalid data in auth context!")
|
||||
}
|
||||
//TODO sanitize user name or at least check if valid dir name?
|
||||
path := filepath.Join(b.path, authCtx.UserName)
|
||||
userDir := base64.RawStdEncoding.EncodeToString([]byte(authCtx.UserName))
|
||||
path := filepath.Join(b.path, userDir)
|
||||
|
||||
_, err := os.Stat(path)
|
||||
if os.IsNotExist(err) {
|
||||
|
Loading…
Reference in New Issue
Block a user