forked from coracle/zooid
Be more strict with schema validation
This commit is contained in:
@@ -7,6 +7,7 @@ import (
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"fiatjaf.com/nostr"
|
||||
@@ -285,6 +286,9 @@ func (api *APIHandler) validatePatchedConfig(config *Config) error {
|
||||
if config.Schema == "" {
|
||||
return fmt.Errorf("schema is required")
|
||||
}
|
||||
if !regexp.MustCompile(`^[a-zA-Z_][a-zA-Z0-9_]*$`).MatchString(config.Schema) {
|
||||
return fmt.Errorf("schema must contain only letters, numbers, and underscores")
|
||||
}
|
||||
if config.Secret == "" {
|
||||
return fmt.Errorf("secret is required")
|
||||
}
|
||||
|
||||
+1
-1
@@ -122,7 +122,7 @@ func MakeInstance(filename string) (*Instance, error) {
|
||||
// Initialize the database
|
||||
|
||||
if err := instance.Events.Init(); err != nil {
|
||||
log.Fatal("Failed to initialize event store: ", err)
|
||||
log.Fatal("Failed to initialize event store for ", filename, ": ", err)
|
||||
}
|
||||
|
||||
// Enable extra functionality
|
||||
|
||||
Reference in New Issue
Block a user