ソースを参照

fix: disable invalid author and formal release

Yeuoly 5 ヶ月 前
コミット
b6fdcabbf0
共有2 個のファイルを変更した14 個の追加1 個の削除を含む
  1. 1 1
      cmd/commandline/plugin/templates/.env.example
  2. 13 0
      internal/core/plugin_manager/debugging_runtime/environment.go

+ 1 - 1
cmd/commandline/plugin/templates/.env.example

@@ -1,4 +1,4 @@
 INSTALL_METHOD=remote
-REMOTE_INSTALL_HOST=debug-plugin.dify.dev
+REMOTE_INSTALL_HOST=debug.dify.ai
 REMOTE_INSTALL_PORT=5003
 REMOTE_INSTALL_KEY=********-****-****-****-************

+ 13 - 0
internal/core/plugin_manager/debugging_runtime/environment.go

@@ -2,12 +2,25 @@ package debugging_runtime
 
 import (
 	"fmt"
+	"regexp"
 
 	"github.com/langgenius/dify-plugin-daemon/pkg/entities/plugin_entities"
 )
 
+var (
+	authorRegex     = regexp.MustCompile(`^[a-z0-9_-]{1,64}$`)
+	pluginNameRegex = regexp.MustCompile(`^[a-z0-9_-]{1,64}$`)
+)
+
 func (r *RemotePluginRuntime) Identity() (plugin_entities.PluginUniqueIdentifier, error) {
 	// copy a new declaration
+	// check original author is alphanumeric
+	if !authorRegex.MatchString(r.Config.Author) {
+		return "", fmt.Errorf("author must be alphanumeric and less than 64 characters: ^[a-z0-9_-]{1,64}$")
+	}
+	if !pluginNameRegex.MatchString(r.Config.Name) {
+		return "", fmt.Errorf("plugin name must be alphanumeric and less than 64 characters: ^[a-z0-9_-]{1,64}$")
+	}
 	config := r.Config
 	config.Author = r.tenantId
 	checksum, _ := r.Checksum()