From 17651f3de0cf1c748088446146d183fc10d6a716 Mon Sep 17 00:00:00 2001 From: mayuehit Date: Mon, 24 Nov 2025 15:37:36 +0800 Subject: [PATCH 1/2] fix st and llt --- api/cpp/include/yr/api/config.h | 9 ++---- api/cpp/src/cluster_mode_runtime.cpp | 10 ++----- api/cpp/src/config_manager.cpp | 11 ++------ api/cpp/src/config_manager.h | 14 ++-------- .../http/crossclusterinvoke/invoker_test.go | 19 ------------- .../http/custom_container_handler_test.go | 1 - api/go/faassdk/runtime.go | 9 ++---- api/go/faassdk/sts/sts_test.go | 4 --- api/go/libruntime/clibruntime/clibruntime.go | 27 ++++++------------ api/go/libruntime/common/config.go | 12 ++------ api/go/libruntime/common/config_test.go | 5 ---- api/go/libruntime/config/config.go | 9 ++---- api/go/libruntime/cpplibruntime/clibruntime.h | 9 ++---- .../cpplibruntime/cpplibruntime.cpp | 10 ++----- api/go/posixsdk/runtime.go | 9 ++---- src/libruntime/libruntime_config.h | 9 +++--- src/libruntime/utils/security.cpp | 6 ++-- test/api/config_manager_test.cpp | 28 ++----------------- test/clibruntime/clibruntime_test.cpp | 3 -- .../mock/mock_datasystem_client.cpp | 3 +- .../java/com/yuanrong/test/ActorTest.java | 12 ++++---- .../test/java/com/yuanrong/test/TaskTest.java | 7 ++--- test/st/python/test_serialization.py | 3 +- 23 files changed, 60 insertions(+), 169 deletions(-) diff --git a/api/cpp/include/yr/api/config.h b/api/cpp/include/yr/api/config.h index 71c16fa..791760b 100644 --- a/api/cpp/include/yr/api/config.h +++ b/api/cpp/include/yr/api/config.h @@ -118,12 +118,9 @@ struct Config { uint32_t httpIocThreadsNum = DEFAULT_HTTP_IOC_THREADS_NUM; bool enableDsAuth = false; bool enableDsEncrypt = false; - std::string dsPublicKeyContext = ""; - std::string runtimePublicKeyContext = ""; - std::string runtimePrivateKeyContext = ""; - std::string encryptDsPublicKeyContext; - std::string encryptRuntimePublicKeyContext; - std::string encryptRuntimePrivateKeyContext; + std::string dsPublicKeyContextPath = ""; + std::string runtimePublicKeyContextPath = ""; + std::string runtimePrivateKeyContextPath = ""; std::string primaryKeyStoreFile; std::string standbyKeyStoreFile; int maxTaskInstanceNum = -1; diff --git a/api/cpp/src/cluster_mode_runtime.cpp b/api/cpp/src/cluster_mode_runtime.cpp index 1817826..89a9640 100644 --- a/api/cpp/src/cluster_mode_runtime.cpp +++ b/api/cpp/src/cluster_mode_runtime.cpp @@ -470,18 +470,14 @@ void ClusterModeRuntime::Init() libConfig.verifyFilePath = ConfigManager::Singleton().verifyFilePath; int len = sizeof(ConfigManager::Singleton().privateKeyPaaswd); memcpy_s(libConfig.privateKeyPaaswd, len, ConfigManager::Singleton().privateKeyPaaswd, len); - libConfig.encryptPrivateKeyPasswd = ConfigManager::Singleton().encryptPrivateKeyPasswd; } libConfig.primaryKeyStoreFile = ConfigManager::Singleton().primaryKeyStoreFile; libConfig.standbyKeyStoreFile = ConfigManager::Singleton().standbyKeyStoreFile; libConfig.encryptEnable = ConfigManager::Singleton().enableDsEncrypt; if (ConfigManager::Singleton().enableDsEncrypt) { - libConfig.runtimePublicKey = ConfigManager::Singleton().runtimePublicKeyContext; - libConfig.runtimePrivateKey = ConfigManager::Singleton().runtimePrivateKeyContext; - libConfig.dsPublicKey = ConfigManager::Singleton().dsPublicKeyContext; - libConfig.encryptRuntimePublicKeyContext = ConfigManager::Singleton().encryptRuntimePublicKeyContext; - libConfig.encryptRuntimePrivateKeyContext = ConfigManager::Singleton().encryptRuntimePrivateKeyContext; - libConfig.encryptDsPublicKeyContext = ConfigManager::Singleton().encryptDsPublicKeyContext; + libConfig.runtimePublicKeyPath = ConfigManager::Singleton().runtimePublicKeyContextPath; + libConfig.runtimePrivateKeyPath = ConfigManager::Singleton().runtimePrivateKeyContextPath; + libConfig.dsPublicKeyPath = ConfigManager::Singleton().dsPublicKeyContextPath; } libConfig.tlsContext = ConfigManager::Singleton().tlsContext; libConfig.httpIocThreadsNum = ConfigManager::Singleton().httpIocThreadsNum; diff --git a/api/cpp/src/config_manager.cpp b/api/cpp/src/config_manager.cpp index 78beb31..75f920a 100644 --- a/api/cpp/src/config_manager.cpp +++ b/api/cpp/src/config_manager.cpp @@ -148,7 +148,6 @@ ClientInfo ConfigManager::GetClientInfo() void ConfigManager::ClearPasswd() { memset_s(privateKeyPaaswd, MAX_PASSWD_LENGTH, 0, MAX_PASSWD_LENGTH); - encryptPrivateKeyPasswd.clear(); } void ConfigManager::Init(const Config &conf, int argc, char **argv) @@ -169,7 +168,6 @@ void ConfigManager::Init(const Config &conf, int argc, char **argv) this->verifyFilePath = conf.verifyFilePath; int len = sizeof(conf.privateKeyPaaswd); memcpy_s(this->privateKeyPaaswd, len, conf.privateKeyPaaswd, len); - this->encryptPrivateKeyPasswd = conf.encryptPrivateKeyPasswd; } this->primaryKeyStoreFile = conf.primaryKeyStoreFile; this->standbyKeyStoreFile = conf.standbyKeyStoreFile; @@ -198,12 +196,9 @@ void ConfigManager::Init(const Config &conf, int argc, char **argv) } this->enableDsEncrypt = conf.enableDsEncrypt; if (conf.enableDsEncrypt) { - this->dsPublicKeyContext = conf.dsPublicKeyContext; - this->runtimePublicKeyContext = conf.runtimePublicKeyContext; - this->runtimePrivateKeyContext = conf.runtimePrivateKeyContext; - this->encryptDsPublicKeyContext = conf.encryptDsPublicKeyContext; - this->encryptRuntimePublicKeyContext = conf.encryptRuntimePublicKeyContext; - this->encryptRuntimePrivateKeyContext = conf.encryptRuntimePrivateKeyContext; + this->dsPublicKeyContextPath = conf.dsPublicKeyContextPath; + this->runtimePublicKeyContextPath = conf.runtimePublicKeyContextPath; + this->runtimePrivateKeyContextPath = conf.runtimePrivateKeyContextPath; } if (conf.threadPoolSize > 0) { diff --git a/api/cpp/src/config_manager.h b/api/cpp/src/config_manager.h index 8b5cd48..7a28273 100644 --- a/api/cpp/src/config_manager.h +++ b/api/cpp/src/config_manager.h @@ -100,23 +100,15 @@ public: char privateKeyPaaswd[MAX_PASSWD_LENGTH] = {0}; - std::string encryptPrivateKeyPasswd; - bool enableDsAuth = false; bool enableDsEncrypt = false; - std::string dsPublicKeyContext = ""; - - std::string encryptDsPublicKeyContext; - - std::string runtimePublicKeyContext = ""; - - std::string encryptRuntimePublicKeyContext; + std::string dsPublicKeyContextPath = ""; - std::string runtimePrivateKeyContext = ""; + std::string runtimePublicKeyContextPath = ""; - std::string encryptRuntimePrivateKeyContext; + std::string runtimePrivateKeyContextPath = ""; std::string primaryKeyStoreFile; diff --git a/api/go/faassdk/handler/http/crossclusterinvoke/invoker_test.go b/api/go/faassdk/handler/http/crossclusterinvoke/invoker_test.go index c94e8f7..ccc6774 100644 --- a/api/go/faassdk/handler/http/crossclusterinvoke/invoker_test.go +++ b/api/go/faassdk/handler/http/crossclusterinvoke/invoker_test.go @@ -18,25 +18,19 @@ package crossclusterinvoke import ( - "encoding/base64" - "encoding/json" "errors" "fmt" "os" "reflect" - "strings" "sync" "testing" - "time" "github.com/agiledragon/gomonkey/v2" "github.com/smartystreets/goconvey/convey" "github.com/valyala/fasthttp" "yuanrong.org/kernel/runtime/faassdk/common/constants" - "yuanrong.org/kernel/runtime/faassdk/sts" "yuanrong.org/kernel/runtime/faassdk/types" - "yuanrong.org/kernel/runtime/faassdk/utils/signer" "yuanrong.org/kernel/runtime/faassdk/utils/urnutils" "yuanrong.org/kernel/runtime/libruntime/api" log "yuanrong.org/kernel/runtime/libruntime/common/faas/logger" @@ -168,19 +162,6 @@ func TestInvoker_DoInvoke(t *testing.T) { convey.So(resp.StatusCode, convey.ShouldEqual, constants.FaaSError) convey.So(resp.ErrorMessage, convey.ShouldEqual, "do cross cluster invoke failed, no time left") }) - - convey.Convey("init sts failed", t, func() { - defer gomonkey.ApplyFunc(sts.InitStsSDK, func(serverCfg types.StsServerConfig) error { - return errors.New("mock sts init error") - }).Reset() - invoker := getMockInvoker() - resp := &types.GetFutureResponse{} - - invoker.DoInvoke(types.InvokeRequest{}, resp, 100, log.GetLogger()) - - convey.So(resp.StatusCode, convey.ShouldEqual, constants.FaaSError) - convey.So(strings.Contains(resp.ErrorMessage, "mock sts init error"), convey.ShouldBeTrue) - }) } func TestNeedTryLocalCluster(t *testing.T) { diff --git a/api/go/faassdk/handler/http/custom_container_handler_test.go b/api/go/faassdk/handler/http/custom_container_handler_test.go index 9ae46e2..1cc8b34 100644 --- a/api/go/faassdk/handler/http/custom_container_handler_test.go +++ b/api/go/faassdk/handler/http/custom_container_handler_test.go @@ -27,7 +27,6 @@ import ( "yuanrong.org/kernel/runtime/faassdk/common/monitor" "yuanrong.org/kernel/runtime/faassdk/config" "yuanrong.org/kernel/runtime/faassdk/handler/http/crossclusterinvoke" - "yuanrong.org/kernel/runtime/faassdk/sts" "yuanrong.org/kernel/runtime/faassdk/types" "yuanrong.org/kernel/runtime/faassdk/utils/urnutils" "yuanrong.org/kernel/runtime/libruntime/api" diff --git a/api/go/faassdk/runtime.go b/api/go/faassdk/runtime.go index ad933b3..b88db5f 100644 --- a/api/go/faassdk/runtime.go +++ b/api/go/faassdk/runtime.go @@ -71,12 +71,9 @@ func InitRuntime() error { PrimaryKeyStoreFile: conf.PrimaryKeyStoreFile, StandbyKeyStoreFile: conf.StandbyKeyStoreFile, EnableDsEncrypt: conf.EnableDsEncrypt, - RuntimePublicKeyContext: conf.RuntimePublicKeyContext, - RuntimePrivateKeyContext: conf.RuntimePrivateKeyContext, - DsPublicKeyContext: conf.DsPublicKeyContext, - EncryptRuntimePublicKeyContext: conf.EncryptRuntimePublicKeyContext, - EncryptRuntimePrivateKeyContext: conf.EncryptRuntimePrivateKeyContext, - EncryptDsPublicKeyContext: conf.EncryptDsPublicKeyContext, + RuntimePublicKeyContextPath: conf.RuntimePublicKeyContextPath, + RuntimePrivateKeyContextPath: conf.RuntimePrivateKeyContextPath, + DsPublicKeyContextPath: conf.DsPublicKeyContextPath, } if err := libruntime.Init(runtimeConf); err != nil { fmt.Printf("failed to init libruntime, error %s\n", err.Error()) diff --git a/api/go/faassdk/sts/sts_test.go b/api/go/faassdk/sts/sts_test.go index e6ea476..2b421fb 100644 --- a/api/go/faassdk/sts/sts_test.go +++ b/api/go/faassdk/sts/sts_test.go @@ -1,11 +1,7 @@ package sts import ( - "github.com/agiledragon/gomonkey/v2" - "github.com/magiconair/properties" - "github.com/smartystreets/goconvey/convey" "testing" - "yuanrong.org/kernel/runtime/faassdk/types" ) func TestInitStsSDK(t *testing.T) { diff --git a/api/go/libruntime/clibruntime/clibruntime.go b/api/go/libruntime/clibruntime/clibruntime.go index 3839713..c556a8a 100644 --- a/api/go/libruntime/clibruntime/clibruntime.go +++ b/api/go/libruntime/clibruntime/clibruntime.go @@ -661,18 +661,12 @@ func Init(conf config.Config) error { defer C.free(unsafe.Pointer(cPrimaryKeyStoreFile)) cStandbyKeyStoreFile := C.CString(conf.StandbyKeyStoreFile) defer C.free(unsafe.Pointer(cStandbyKeyStoreFile)) - cRuntimePublicKeyContext := C.CString(conf.RuntimePublicKeyContext) - defer C.free(unsafe.Pointer(cRuntimePublicKeyContext)) - cRuntimePrivateKeyContext := C.CString(conf.RuntimePrivateKeyContext) - defer C.free(unsafe.Pointer(cRuntimePrivateKeyContext)) - cDsPublicKeyContext := C.CString(conf.DsPublicKeyContext) - defer C.free(unsafe.Pointer(cDsPublicKeyContext)) - cEncryptRuntimePublicKeyContext := C.CString(conf.EncryptRuntimePublicKeyContext) - defer C.free(unsafe.Pointer(cEncryptRuntimePublicKeyContext)) - cEncryptRuntimePrivateKeyContext := C.CString(conf.EncryptRuntimePrivateKeyContext) - defer C.free(unsafe.Pointer(cEncryptRuntimePrivateKeyContext)) - cEncryptDsPublicKeyContext := C.CString(conf.EncryptDsPublicKeyContext) - defer C.free(unsafe.Pointer(cEncryptDsPublicKeyContext)) + cRuntimePublicKeyContextPath := C.CString(conf.RuntimePublicKeyContextPath) + defer C.free(unsafe.Pointer(cRuntimePublicKeyContextPath)) + cRuntimePrivateKeyContextPath := C.CString(conf.RuntimePrivateKeyContextPath) + defer C.free(unsafe.Pointer(cRuntimePrivateKeyContextPath)) + cDsPublicKeyContextPath := C.CString(conf.DsPublicKeyContextPath) + defer C.free(unsafe.Pointer(cDsPublicKeyContextPath)) cMaxConcurrencyCreateNum := C.int(conf.MaxConcurrencyCreateNum) cFunctionId := C.CString(conf.FunctionId) @@ -703,12 +697,9 @@ func Init(conf config.Config) error { primaryKeyStoreFile: cPrimaryKeyStoreFile, standbyKeyStoreFile: cStandbyKeyStoreFile, enableDsEncrypt: C.char(btoi(conf.EnableDsEncrypt)), - runtimePublicKeyContext: cRuntimePublicKeyContext, - runtimePrivateKeyContext: cRuntimePrivateKeyContext, - dsPublicKeyContext: cDsPublicKeyContext, - encryptRuntimePublicKeyContext: cEncryptRuntimePublicKeyContext, - encryptRuntimePrivateKeyContext: cEncryptRuntimePrivateKeyContext, - encryptDsPublicKeyContext: cEncryptDsPublicKeyContext, + runtimePublicKeyContextPath: cRuntimePublicKeyContextPath, + runtimePrivateKeyContextPath: cRuntimePrivateKeyContextPath, + dsPublicKeyContextPath: cDsPublicKeyContextPath, maxConcurrencyCreateNum: cMaxConcurrencyCreateNum, enableSigaction: C.char(btoi(conf.EnableSigaction)), } diff --git a/api/go/libruntime/common/config.go b/api/go/libruntime/common/config.go index 1a18c54..21d450b 100644 --- a/api/go/libruntime/common/config.go +++ b/api/go/libruntime/common/config.go @@ -60,12 +60,9 @@ type Configuration struct { PrimaryKeyStoreFile string StandbyKeyStoreFile string EnableDsEncrypt bool - RuntimePublicKeyContext string - RuntimePrivateKeyContext string - DsPublicKeyContext string - EncryptRuntimePublicKeyContext string - EncryptRuntimePrivateKeyContext string - EncryptDsPublicKeyContext string + RuntimePublicKeyContextPath string + RuntimePrivateKeyContextPath string + DsPublicKeyContextPath string MaxConcurrencyCreateNum int EnableSigaction bool } @@ -92,9 +89,6 @@ func initConfig() { flag.StringVar(&configSingleton.cfg.PrimaryKeyStoreFile, "primaryKeyStoreFile", "", "") flag.StringVar(&configSingleton.cfg.StandbyKeyStoreFile, "standbyKeyStoreFile", "", "") flag.BoolVar(&configSingleton.cfg.EnableDsEncrypt, "enableDsEncrypt", false, "") - flag.StringVar(&configSingleton.cfg.EncryptRuntimePublicKeyContext, "encryptRuntimePublicKeyContext", "", "") - flag.StringVar(&configSingleton.cfg.EncryptRuntimePrivateKeyContext, "encryptRuntimePrivateKeyContext", "", "") - flag.StringVar(&configSingleton.cfg.EncryptDsPublicKeyContext, "encryptDsPublicKeyContext", "", "") flag.IntVar(&configSingleton.cfg.MaxConcurrencyCreateNum, "maxConcurrencyCreateNum", defaultMaxConcurrencyCreateNum, "") flag.Parse() diff --git a/api/go/libruntime/common/config_test.go b/api/go/libruntime/common/config_test.go index 26b5733..9c31e95 100644 --- a/api/go/libruntime/common/config_test.go +++ b/api/go/libruntime/common/config_test.go @@ -18,12 +18,7 @@ package common import ( - "encoding/json" - "os" "testing" - - "github.com/agiledragon/gomonkey/v2" - "github.com/magiconair/properties" "github.com/smartystreets/goconvey/convey" ) diff --git a/api/go/libruntime/config/config.go b/api/go/libruntime/config/config.go index c67d7e0..a55fc65 100644 --- a/api/go/libruntime/config/config.go +++ b/api/go/libruntime/config/config.go @@ -150,10 +150,7 @@ type Config struct { PrimaryKeyStoreFile string StandbyKeyStoreFile string EnableDsEncrypt bool - RuntimePublicKeyContext string - RuntimePrivateKeyContext string - DsPublicKeyContext string - EncryptRuntimePublicKeyContext string - EncryptRuntimePrivateKeyContext string - EncryptDsPublicKeyContext string + RuntimePublicKeyContextPath string + RuntimePrivateKeyContextPath string + DsPublicKeyContextPath string } diff --git a/api/go/libruntime/cpplibruntime/clibruntime.h b/api/go/libruntime/cpplibruntime/clibruntime.h index 2a6c587..9546c90 100644 --- a/api/go/libruntime/cpplibruntime/clibruntime.h +++ b/api/go/libruntime/cpplibruntime/clibruntime.h @@ -147,12 +147,9 @@ typedef struct tagCLibruntimeConfig { char *primaryKeyStoreFile; char *standbyKeyStoreFile; char enableDsEncrypt; - char *runtimePublicKeyContext; - char *runtimePrivateKeyContext; - char *dsPublicKeyContext; - char *encryptRuntimePublicKeyContext; - char *encryptRuntimePrivateKeyContext; - char *encryptDsPublicKeyContext; + char *runtimePublicKeyContextPath; + char *runtimePrivateKeyContextPath; + char *dsPublicKeyContextPath; int maxConcurrencyCreateNum; char enableSigaction; } CLibruntimeConfig; diff --git a/api/go/libruntime/cpplibruntime/cpplibruntime.cpp b/api/go/libruntime/cpplibruntime/cpplibruntime.cpp index bcfb9c7..e52191b 100644 --- a/api/go/libruntime/cpplibruntime/cpplibruntime.cpp +++ b/api/go/libruntime/cpplibruntime/cpplibruntime.cpp @@ -428,16 +428,12 @@ CErrorInfo CInit(CLibruntimeConfig *config) librtCfg.privateKeyPath = config->privateKeyPath; librtCfg.certificateFilePath = config->certificateFilePath; librtCfg.verifyFilePath = config->verifyFilePath; - librtCfg.encryptPrivateKeyPasswd = config->encryptPrivateKeyPasswd; librtCfg.primaryKeyStoreFile = config->primaryKeyStoreFile; librtCfg.standbyKeyStoreFile = config->standbyKeyStoreFile; librtCfg.encryptEnable = config->enableDsEncrypt != 0; - librtCfg.runtimePublicKey = config->runtimePublicKeyContext; - librtCfg.runtimePrivateKey = config->runtimePrivateKeyContext; - librtCfg.dsPublicKey = config->dsPublicKeyContext; - librtCfg.encryptRuntimePublicKeyContext = config->encryptRuntimePublicKeyContext; - librtCfg.encryptRuntimePrivateKeyContext = config->encryptRuntimePrivateKeyContext; - librtCfg.encryptDsPublicKeyContext = config->encryptDsPublicKeyContext; + librtCfg.runtimePublicKeyPath = config->runtimePublicKeyContextPath; + librtCfg.runtimePrivateKeyPath = config->runtimePrivateKeyContextPath; + librtCfg.dsPublicKeyPath = config->dsPublicKeyContextPath; librtCfg.ak_ = config->systemAuthAccessKey; librtCfg.sk_ = datasystem::SensitiveValue(config->systemAuthSecretKey, config->systemAuthSecretKeySize); auto len = sizeof(config->privateKeyPaaswd); diff --git a/api/go/posixsdk/runtime.go b/api/go/posixsdk/runtime.go index d2575dc..ca07536 100644 --- a/api/go/posixsdk/runtime.go +++ b/api/go/posixsdk/runtime.go @@ -75,12 +75,9 @@ func InitRuntime(conf *common.Configuration, intfs execution.FunctionExecutionIn PrimaryKeyStoreFile: conf.PrimaryKeyStoreFile, StandbyKeyStoreFile: conf.StandbyKeyStoreFile, EnableDsEncrypt: conf.EnableDsEncrypt, - RuntimePublicKeyContext: conf.RuntimePublicKeyContext, - RuntimePrivateKeyContext: conf.RuntimePrivateKeyContext, - DsPublicKeyContext: conf.DsPublicKeyContext, - EncryptRuntimePublicKeyContext: conf.EncryptRuntimePublicKeyContext, - EncryptRuntimePrivateKeyContext: conf.EncryptRuntimePrivateKeyContext, - EncryptDsPublicKeyContext: conf.EncryptDsPublicKeyContext, + RuntimePublicKeyContextPath: conf.RuntimePublicKeyContextPath, + RuntimePrivateKeyContextPath: conf.RuntimePrivateKeyContextPath, + DsPublicKeyContextPath: conf.DsPublicKeyContextPath, MaxConcurrencyCreateNum: conf.MaxConcurrencyCreateNum, EnableSigaction: conf.EnableSigaction, } diff --git a/src/libruntime/libruntime_config.h b/src/libruntime/libruntime_config.h index 78dc6d7..831cc82 100644 --- a/src/libruntime/libruntime_config.h +++ b/src/libruntime/libruntime_config.h @@ -165,7 +165,10 @@ struct LibruntimeConfig { return std::string(funcMeta.ns() + "-" + funcMeta.name()); } - void ClearPaaswd() {} + void ClearPaaswd() + { + memset_s(privateKeyPaaswd, MAX_PASSWD_LENGTH, 0, MAX_PASSWD_LENGTH); + } ErrorInfo Decrypt(); // functionSystemIpAddr is an IP address of function system server that used to discover driver. // functionSystemIpAddr and functionSystemPort is used by driver process @@ -255,10 +258,6 @@ struct LibruntimeConfig { bool dedupLogs = false; std::string primaryKeyStoreFile; std::string standbyKeyStoreFile; - std::string encryptPrivateKeyPasswd; - std::string encryptDsPublicKeyContext; - std::string encryptRuntimePublicKeyContext; - std::string encryptRuntimePrivateKeyContext; libruntime::FunctionMeta funcMeta; bool needOrder = false; bool enableSigaction = true; diff --git a/src/libruntime/utils/security.cpp b/src/libruntime/utils/security.cpp index 6231bd5..06a07ec 100644 --- a/src/libruntime/utils/security.cpp +++ b/src/libruntime/utils/security.cpp @@ -88,9 +88,9 @@ ErrorInfo Security::InitWithDriver(std::shared_ptr librtConfig } if (librtConfig->encryptEnable) { this->dsConf_.encryptEnable = librtConfig->encryptEnable; - this->dsConf_.clientPublicKey = librtConfig->runtimePublicKey; - this->dsConf_.clientPrivateKey = librtConfig->runtimePrivateKey; - this->dsConf_.serverPublicKey = librtConfig->dsPublicKey; + this->dsConf_.clientPublicKey = GetValueFromFile(librtConfig->runtimePublicKeyPath); + this->dsConf_.clientPrivateKey = GetValueFromFile(librtConfig->runtimePrivateKeyPath); + this->dsConf_.serverPublicKey = GetValueFromFile(librtConfig->dsPublicKeyPath); } if (!librtConfig->ak_.empty() && !librtConfig->sk_.Empty()) { this->ak_ = librtConfig->ak_; diff --git a/test/api/config_manager_test.cpp b/test/api/config_manager_test.cpp index a817199..6f70476 100644 --- a/test/api/config_manager_test.cpp +++ b/test/api/config_manager_test.cpp @@ -21,8 +21,8 @@ #include #include "api/cpp/include/yr/api/exception.h" -#include "api/cpp/src/config_manager.h" #include "api/cpp/src/cluster_mode_runtime.h" +#include "api/cpp/src/config_manager.h" #include "src/libruntime/err_type.h" #include "src/libruntime/libruntime_manager.h" #include "src/proto/libruntime.pb.h" @@ -36,8 +36,8 @@ using namespace YR::utility; class ConfigManagerTest : public testing::Test { public: - ConfigManagerTest(){}; - ~ConfigManagerTest(){}; + ConfigManagerTest() {}; + ~ConfigManagerTest() {}; void SetUp() override { Mkdir("/tmp/log"); @@ -265,28 +265,6 @@ TEST_F(ConfigManagerTest, ConfigManagerInitEnableMTLSTest) ASSERT_EQ(conf.certificateFilePath, ConfigManager::Singleton().certificateFilePath); ASSERT_EQ(conf.verifyFilePath, ConfigManager::Singleton().verifyFilePath); ASSERT_EQ(std::string(conf.privateKeyPaaswd), std::string(ConfigManager::Singleton().privateKeyPaaswd)); - ASSERT_EQ(conf.encryptPrivateKeyPasswd, ConfigManager::Singleton().encryptPrivateKeyPasswd); -} - -TEST_F(ConfigManagerTest, ConfigManagerInitEnableDsEncryptTest) -{ - Config conf = GetMockConf(); - conf.enableDsEncrypt = true; - conf.dsPublicKeyContext = "aaa"; - conf.runtimePublicKeyContext = "bbb"; - conf.runtimePrivateKeyContext = "ccc"; - conf.encryptDsPublicKeyContext = "ddd"; - conf.encryptRuntimePublicKeyContext = "eee"; - conf.encryptRuntimePrivateKeyContext = "fff"; - int mockArgc = 1; - char *mockArgv[] = {"--logDir=/tmp/log"}; - ConfigManager::Singleton().Init(conf, mockArgc, mockArgv); - ASSERT_EQ(conf.dsPublicKeyContext, ConfigManager::Singleton().dsPublicKeyContext); - ASSERT_EQ(conf.runtimePublicKeyContext, ConfigManager::Singleton().runtimePublicKeyContext); - ASSERT_EQ(conf.runtimePrivateKeyContext, ConfigManager::Singleton().runtimePrivateKeyContext); - ASSERT_EQ(conf.encryptDsPublicKeyContext, ConfigManager::Singleton().encryptDsPublicKeyContext); - ASSERT_EQ(conf.encryptRuntimePublicKeyContext, ConfigManager::Singleton().encryptRuntimePublicKeyContext); - ASSERT_EQ(conf.encryptRuntimePrivateKeyContext, ConfigManager::Singleton().encryptRuntimePrivateKeyContext); } TEST_F(ConfigManagerTest, GetValidLogCompressTest) diff --git a/test/clibruntime/clibruntime_test.cpp b/test/clibruntime/clibruntime_test.cpp index 8416799..413e2a1 100644 --- a/test/clibruntime/clibruntime_test.cpp +++ b/test/clibruntime/clibruntime_test.cpp @@ -481,9 +481,6 @@ TEST_F(CLibruntimeTest, CInitTest) "RuntimePublicKeyContext", "RuntimePrivateKeyContext", "DsPublicKeyContext", - "EncryptRuntimePublicKeyContext", - "EncryptRuntimePrivateKeyContext", - "EncryptDsPublicKeyContext", }; auto cErr = CInit(&config); ASSERT_TRUE(cErr.code == 0); diff --git a/test/libruntime/mock/mock_datasystem_client.cpp b/test/libruntime/mock/mock_datasystem_client.cpp index 311d929..b9c906d 100644 --- a/test/libruntime/mock/mock_datasystem_client.cpp +++ b/test/libruntime/mock/mock_datasystem_client.cpp @@ -29,8 +29,7 @@ namespace datasystem { class ThreadPool {}; -class StreamClientImpl {}; -StreamClient::StreamClient(ConnectionOpts options) {} +StreamClient::StreamClient(ConnectOptions options) {} Status StreamClient::Init(bool reportWorkerLost) { diff --git a/test/st/java/src/test/java/com/yuanrong/test/ActorTest.java b/test/st/java/src/test/java/com/yuanrong/test/ActorTest.java index e7653bb..61e36bc 100644 --- a/test/st/java/src/test/java/com/yuanrong/test/ActorTest.java +++ b/test/st/java/src/test/java/com/yuanrong/test/ActorTest.java @@ -167,15 +167,15 @@ public class ActorTest { TestUtils.initYR(); try { InvokeOptions createOpts = InvokeOptions.builder() - .addCustomExtensions("endpoint", "CreateInstance1") - .addCustomExtensions("app_name", "CreateInstance2") - .addCustomExtensions("tenant_id", "CreateInstance3") + .addCustomExtension("endpoint", "CreateInstance1") + .addCustomExtension("app_name", "CreateInstance2") + .addCustomExtension("tenant_id", "CreateInstance3") .build(); InstanceHandler ins = YR.instance(Counter::new).options(createOpts).invoke(); InvokeOptions invokeOpts = InvokeOptions.builder() - .addCustomExtensions("endpoint", "InvokeInstance1") - .addCustomExtensions("app_name", "InvokeInstance2") - .addCustomExtensions("tenant_id", "InvokeInstance3") + .addCustomExtension("endpoint", "InvokeInstance1") + .addCustomExtension("app_name", "InvokeInstance2") + .addCustomExtension("tenant_id", "InvokeInstance3") .build(); ObjectRef ref = ins.function(Counter::addOne).options(invokeOpts).invoke(); int res = (int) YR.get(ref, 10); diff --git a/test/st/java/src/test/java/com/yuanrong/test/TaskTest.java b/test/st/java/src/test/java/com/yuanrong/test/TaskTest.java index f3b6aeb..2df8310 100644 --- a/test/st/java/src/test/java/com/yuanrong/test/TaskTest.java +++ b/test/st/java/src/test/java/com/yuanrong/test/TaskTest.java @@ -326,9 +326,9 @@ public class TaskTest { TestUtils.initYR(); try { InvokeOptions opts = InvokeOptions.builder() - .addCustomExtensions("endpoint", "InvokeFunction1") - .addCustomExtensions("app_name", "InvokeFunction2") - .addCustomExtensions("tenant_id", "InvokeFunction3") + .addCustomExtension("endpoint", "InvokeFunction1") + .addCustomExtension("app_name", "InvokeFunction2") + .addCustomExtension("tenant_id", "InvokeFunction3") .build(); ObjectRef ref = YR.function(Counter::returnInt).options(opts).invoke(0); int res = (int) YR.get(ref, 10); @@ -509,7 +509,6 @@ public class TaskTest { TestUtils.initYR(false); try { CreateParam createParam = new CreateParam(); - createParam.setWriteMode(WriteMode.NONE_L2_CACHE); createParam.setConsistencyType(ConsistencyType.PRAM); // Check whether shared disk is enabled. ObjectRef ref = YR.put(10, createParam); diff --git a/test/st/python/test_serialization.py b/test/st/python/test_serialization.py index c762ee7..b5fb6d3 100644 --- a/test/st/python/test_serialization.py +++ b/test/st/python/test_serialization.py @@ -21,7 +21,6 @@ def test_serialization_with_many_types(init_yr): "\u262F", "hello world", "\xff\xfe\x9c\x001\x000\x00", - None, True, False, [], @@ -57,7 +56,7 @@ def test_serialization_with_many_types(init_yr): new_obj_2 = yr.get(yr.put(obj)) assert obj == new_obj_1 assert obj == new_obj_2 - if type(obj).__module__ != "numpy": + if type(obj).__module__ != "numpy" and type(obj) is not bytes: assert type(obj) is type(new_obj_1) assert type(obj) is type(new_obj_2) -- Gitee From 2a253e19652fb9596ad3ae87b56be451a5c7cf20 Mon Sep 17 00:00:00 2001 From: mayuehit Date: Tue, 25 Nov 2025 16:52:26 +0800 Subject: [PATCH 2/2] fix --- tools/download_dependency.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/download_dependency.sh b/tools/download_dependency.sh index edc89ae..72b54a3 100644 --- a/tools/download_dependency.sh +++ b/tools/download_dependency.sh @@ -42,8 +42,8 @@ RUNTIME_OUTPUT_DIR="${RUNTIME_SRC_DIR}/output" MODULES="runtime" bash -x ${BASE_DIR}/download_opensource.sh -M $MODULES -T $THIRD_PARTY_DIR RUNTIME_THIRD_PARTY_CACHE=${RUNTIME_THIRD_PARTY_CACHE:-"https://build-logs.openeuler.openatom.cn:38080/temp-archived/openeuler/openYuanrong/runtime_deps/"} -DATA_SYSTEM_CACHE=${DATA_SYSTEM_CACHE:-"https://build-logs.openeuler.openatom.cn:38080/temp-archived/openeuler/openYuanrong/yr_cache/$(uname -m)/yr-datasystem-v0.5.0.tar.gz"} -FUNCTION_SYSTEM_CACHE=${FUNCTION_SYSTEM_CACHE:-"https://build-logs.openeuler.openatom.cn:38080/temp-archived/openeuler/openYuanrong/yr_cache/$(uname -m)/yr-functionsystem-v0.5.0.tar.gz"} +DATA_SYSTEM_CACHE=${DATA_SYSTEM_CACHE:-"https://build-logs.openeuler.openatom.cn:38080/temp-archived/openeuler/openYuanrong/yr_cache/$(uname -m)/yr-datasystem-v0.6.0.tar.gz"} +FUNCTION_SYSTEM_CACHE=${FUNCTION_SYSTEM_CACHE:-"https://build-logs.openeuler.openatom.cn:38080/temp-archived/openeuler/openYuanrong/yr_cache/$(uname -m)/yr-functionsystem-v0.6.0.tar.gz"} function check_datasystem() { # check whether datasystem exist if [ ! -d "${YR_DATASYSTEM_BIN_DIR}"/output/sdk/cpp/include ]; then -- Gitee