1 parent
8ca7187721
commit
8bd6f1edfb
8 files changed
+286
-21
No files matched your search
@@ -75,7 +75,7 @@ func validateDatabase(database DatabaseConfig) error {
|
||||
database = NormalizeDatabaseConfig(database)
|
||||
switch database.Type {
|
||||
case DatabaseTypeSQLite:
|
||||
if !databaseLocalRefPattern.MatchString(database.LocalRef) ||
|
||||
if !validSQLiteLocalRef(database.LocalRef) ||
|
||||
filepath.IsAbs(database.LocalRef) ||
|
||||
isWindowsAbsolute(database.LocalRef) ||
|
||||
strings.ContainsAny(database.LocalRef, `/\\:`) ||
|
||||
@@ -99,6 +99,20 @@ func validateDatabase(database DatabaseConfig) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func validSQLiteLocalRef(value string) bool {
|
||||
value = filepath.ToSlash(value)
|
||||
if value == "" || filepath.IsAbs(value) || isWindowsAbsolute(value) || strings.HasPrefix(value, "config/") || strings.ContainsAny(value, `\\:`) {
|
||||
return false
|
||||
}
|
||||
parts := strings.Split(value, "/")
|
||||
for _, part := range parts {
|
||||
if part == "" || part == "." || part == ".." || !databaseLocalRefPattern.MatchString(part) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
func validateSMTP(smtp SMTPConfig) error {
|
||||
if !validLoginVerificationPolicy(smtp.LoginPolicy) {
|
||||
return ErrInvalidSMTP
|
||||
|
||||
Reference in new issue
Block a user