From 2fbbdcdd1817d26b87967ea51eafd7e61d00c794 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=9Ean=20G=C3=BCne=C5=9F?= <180301198+sgunes-wirepas@users.noreply.github.com> Date: Thu, 7 Aug 2025 13:35:15 +0300 Subject: [PATCH 1/7] Pevent potential integer truncation If a too large message is sent, weight value exceeding 255 can be truncated to something less than 16. WPC_send_data_with_options returns an error if total size is too large anyway, so this is not a problem currently. Also initialize the variable to suppress maybe-uninitialized warning. --- sink_service/source/data.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sink_service/source/data.c b/sink_service/source/data.c index c2a71ada..e94233ee 100644 --- a/sink_service/source/data.c +++ b/sink_service/source/data.c @@ -61,7 +61,7 @@ static int send_message(sd_bus_message * m, void * userdata, sd_bus_error * erro size_t n; int r; uint8_t qos; - uint8_t weight; + size_t weight = 0; /* Read the parameters */ r = sd_bus_message_read(m, From 721772bf148faf9bc4af4705549b2e5fa9d1e41c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=9Ean=20G=C3=BCne=C5=9F?= <180301198+sgunes-wirepas@users.noreply.github.com> Date: Thu, 7 Aug 2025 14:38:54 +0300 Subject: [PATCH 2/7] Update c-mesh-api dependency and switch to using cmake for sink-service --- .github/workflows/docker_sink_service.yml | 3 - .gitmodules | 3 - docker/sink_service/Dockerfile | 11 ++- sink_service/CMakeLists.txt | 33 +++++++ sink_service/README.md | 24 ++--- sink_service/c-mesh-api | 1 - sink_service/makefile | 102 ---------------------- 7 files changed, 51 insertions(+), 126 deletions(-) create mode 100644 sink_service/CMakeLists.txt delete mode 160000 sink_service/c-mesh-api delete mode 100644 sink_service/makefile diff --git a/.github/workflows/docker_sink_service.yml b/.github/workflows/docker_sink_service.yml index dff8130e..fbc03fad 100644 --- a/.github/workflows/docker_sink_service.yml +++ b/.github/workflows/docker_sink_service.yml @@ -28,9 +28,6 @@ jobs: - name: checkout code uses: actions/checkout@v4 - - name: get c-mesh-api with submodule - run: git submodule update --init - - name: Set up QEMU run: sudo apt-get update && sudo apt-get install qemu-user-static -y diff --git a/.gitmodules b/.gitmodules index 9f3d083e..e69de29b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +0,0 @@ -[submodule "sink_service/c-mesh-api"] - path = sink_service/c-mesh-api - url = https://github.com/wirepas/c-mesh-api diff --git a/docker/sink_service/Dockerfile b/docker/sink_service/Dockerfile index 79aafe02..4b3004aa 100644 --- a/docker/sink_service/Dockerfile +++ b/docker/sink_service/Dockerfile @@ -6,7 +6,7 @@ ARG GATEWAY_BUILD_SHA1=unset RUN adduser --disabled-password wirepas -RUN apk add --no-cache gcc make cmake musl-dev dpkg elogind-dev linux-headers +RUN apk add --no-cache gcc git make cmake musl-dev dpkg elogind-dev linux-headers USER wirepas @@ -16,12 +16,11 @@ WORKDIR /home/wirepas COPY --chown=wirepas ./sink_service /home/wirepas/sink_service -WORKDIR /home/wirepas/sink_service - -RUN make +RUN CMAKE_BUILD_TYPE=Release cmake -S /home/wirepas/sink_service -B /home/wirepas/build +RUN cmake --build /home/wirepas/build FROM scratch AS export -COPY --from=builder /home/wirepas/sink_service/build/sinkService . +COPY --from=builder /home/wirepas/build/sinkService . FROM $BASE_IMAGE @@ -34,7 +33,7 @@ RUN addgroup wirepas dialout RUN apk add --no-cache libelogind coreutils # Copy the built service and its dependencies from builder -COPY --from=builder /home/wirepas/sink_service/build/sinkService /home/wirepas/ +COPY --from=builder /home/wirepas/build/sinkService /home/wirepas/ USER wirepas diff --git a/sink_service/CMakeLists.txt b/sink_service/CMakeLists.txt new file mode 100644 index 00000000..f214ef87 --- /dev/null +++ b/sink_service/CMakeLists.txt @@ -0,0 +1,33 @@ +cmake_minimum_required(VERSION 3.18) + +project(sinkService LANGUAGES C) + +set(CMAKE_C_STANDARD 99) +if(NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE RelWithDebInfo) +endif() +set(CMAKE_C_FLAGS_RELEASE "-O2") + +add_compile_options(-Wall -Werror -Wextra -Wno-unused-parameter) + +include(FetchContent) +FetchContent_Declare( + c-mesh-api + GIT_REPOSITORY https://github.com/wirepas/c-mesh-api/ + GIT_TAG c566fdbd693eb3fb6027286679f53db9f9958e0a + SOURCE_SUBDIR lib +) +FetchContent_MakeAvailable(c-mesh-api) + +find_package(PkgConfig REQUIRED) +pkg_check_modules(systemd REQUIRED IMPORTED_TARGET libsystemd) + +add_executable(${CMAKE_PROJECT_NAME} + source/main.c + source/config.c + source/data.c + source/otap.c +) + +target_link_libraries(${CMAKE_PROJECT_NAME} wpc PkgConfig::systemd) + diff --git a/sink_service/README.md b/sink_service/README.md index 074d97d1..018c0fbd 100644 --- a/sink_service/README.md +++ b/sink_service/README.md @@ -2,26 +2,28 @@ The sink service is in charge of doing the interface between a physical device attached to a gateway through a uart port and the Dbus internal API. -## Getting the sources +## Requirements + +On Debian 12, the following packages are needed to build: +``` +cmake +git +libsystemd-dev +pkg-config +``` The sink service depends on [c-mesh-api](https://github.com/wirepas/c-mesh-api) repository. It contains the low level library that implements the DualMCU API to communicate through an UART to a Wirepas node. -[Git submodule](https://git-scm.com/book/en/v2/Git-Tools-Submodules) is used to upkeep the project -dependency with the c-mesh-api library. +c-mesh-api is fetched automatically from git by CMake when the project is configured. -Once this repository is cloned, please synchronize it to get the c-mesh-api -code at the right place. - -```shell -git submodule update --init -``` ## Building the sink service -From current folder, execute this command to build the sinkService +From current folder, execute following commands to build the sinkService ```shell -make +cmake -S . -B build +cmake --build build ``` Built sinkService will be generated under build/ folder. diff --git a/sink_service/c-mesh-api b/sink_service/c-mesh-api deleted file mode 160000 index 766e6933..00000000 --- a/sink_service/c-mesh-api +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 766e693338587397c2c71bcd39b8b0dbaed206a0 diff --git a/sink_service/makefile b/sink_service/makefile deleted file mode 100644 index 0a469bf6..00000000 --- a/sink_service/makefile +++ /dev/null @@ -1,102 +0,0 @@ -# Makefile for Wirepas Dbus Sink module - -# Toolchain -CC := gcc -AS := as -LD := ld -AR := ar - -# Paths, including trailing path separator -SOURCEPREFIX := source/ -BUILDPREFIX := build/ - -# This example needs the mesh lib -MESH_LIB_FOLDER := c-mesh-api/lib/ -MESH_LIB := $(MESH_LIB_FOLDER)build/mesh_api_lib.a - -# General compiler flags -CFLAGS := -std=gnu99 -Wall -Werror `pkg-config --cflags libsystemd` - -# Targets definition -MAIN_APP := sinkService - -TARGET_APP := $(BUILDPREFIX)$(MAIN_APP) - -# Add Api header (including logger files) -CFLAGS += -I$(MESH_LIB_FOLDER)api -# Add pthtread lib as needed by Mesh Lib -LDFLAGS += -pthread -# Add Reentrant flag as using pthread -CFLAGS += -D_REENTRANT - -# Add systemd lib as needed for sd-bus -LDFLAGS += `pkg-config --libs libsystemd` - -# Add current directory for headers -CFLAGS += -I$(SOURCEPREFIX) - -# Specific sources for this application -SOURCES := $(SOURCEPREFIX)main.c -SOURCES += $(SOURCEPREFIX)config.c -SOURCES += $(SOURCEPREFIX)data.c -SOURCES += $(SOURCEPREFIX)otap.c - -OBJECTS := $(patsubst $(SOURCEPREFIX)%, \ - $(BUILDPREFIX)%, \ - $(SOURCES:.c=.o)) - -# Functions - -# Also create the target directory if it does not exist -define COMPILE - echo " CC $(2)" - mkdir -p $(dir $(1)) - $(CC) $(CFLAGS) -c -o $(1) $(2) -endef - -define LINK - echo " Linking $(1)" - $(CC) $(CFLAGS) -o $(1) $(2) $(MESH_LIB) $(LDFLAGS) -endef - -define CLEAN - echo " Cleaning up" - $(RM) -r $(BUILDPREFIX) - make -C $(MESH_LIB_FOLDER) clean -endef - -# Target rules - -# Use dependency files automatically generated by GCC. -# First collect all C source files -AUTODEPS := $(patsubst $(SOURCEPREFIX)%.c, $(BUILDPREFIX)%.d, $(SOURCES)) - -ifeq ($(V),1) -# "V=1" on command line, print commands. -else -# Default, do not print commands. -.SILENT: -endif - -.PHONY: all -all: app - -app: $(TARGET_APP) $(MESH_LIB) - -.PHONY: clean -clean: - $(call CLEAN) - -$(MESH_LIB_FOLDER): - $(error c-mesh-api library is required and is managed as a git submodule.\ - Please run "git submodule update --init") - -.PHONY: $(MESH_LIB) -$(MESH_LIB): $(MESH_LIB_FOLDER) - make -C $(MESH_LIB_FOLDER) - -$(BUILDPREFIX)%.o: $(SOURCEPREFIX)%.c $(MESH_LIB_FOLDER) - $(call COMPILE,$@,$<) - -$(BUILDPREFIX)$(MAIN_APP): $(OBJECTS) $(MESH_LIB) - $(call LINK,$@,$^) From 5304d1c0479c4b33e7fda6c2e5178e42e8e4cf10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=9Ean=20G=C3=BCne=C5=9F?= <180301198+sgunes-wirepas@users.noreply.github.com> Date: Mon, 18 Aug 2025 12:55:46 +0300 Subject: [PATCH 3/7] DBus methods for sink key management in sink service --- sink_service/source/config.c | 125 +++++++++++++++++++++++++++++++++++ 1 file changed, 125 insertions(+) diff --git a/sink_service/source/config.c b/sink_service/source/config.c index b9bdab60..ad143980 100644 --- a/sink_service/source/config.c +++ b/sink_service/source/config.c @@ -776,6 +776,129 @@ static int get_config_data_content(sd_bus_message *m, void *userdata, sd_bus_err return sd_bus_send(sd_bus_message_get_bus(reply), reply, NULL); } +/** + * \brief Read security keys from the message + * + * Message is expected to have two byte arrays for cipher and authentication + * keys, and a key sequence. + * + * \param[in,out] message + * Message to read the keys from + * \param[out] error + * Pointer to the sd_bus error of the request message + * \param[out] security_keys + * Address to write the security keys + * \return On success, a non-negative value. On failure, a negative errno-style + * code consistent with other sd_bus methods. + */ +static int read_security_keys_from_message(sd_bus_message *const message, + sd_bus_error *const error, + wpc_key_pair_t *const security_keys) +{ + const void *key_bytes; + size_t key_size; + + int r = sd_bus_message_read_array(message, 'y', &key_bytes, &key_size); + if (r < 0) + { + sd_bus_error_set_errno(error, r); + LOGE("Could not read the cipher key: %s\n", strerror(-r)); + return r; + } + if (key_size != sizeof(security_keys->key_pair.encryption)) + { + const app_res_e wpc_res = APP_RES_INVALID_VALUE; + SET_WPC_ERROR(error, __FUNCTION__, wpc_res); + LOGE("Invalid cipher key size (%zu) (ret=%d)\n", key_size, wpc_res); + return -EINVAL; + } + + memcpy((void*)security_keys->key_pair.encryption, key_bytes, sizeof(security_keys->key_pair.encryption)); + + r = sd_bus_message_read_array(message, 'y', &key_bytes, &key_size); + if (r < 0) + { + sd_bus_error_set_errno(error, r); + LOGE("Could not read the authentication key: %s\n", strerror(-r)); + return r; + } + if (key_size != sizeof(security_keys->key_pair.authentication)) + { + const app_res_e wpc_res = APP_RES_INVALID_VALUE; + SET_WPC_ERROR(error, __FUNCTION__, wpc_res); + LOGE("Invalid authentication key size (%zu) (ret=%d)\n", key_size, wpc_res); + return -EINVAL; + } + + memcpy((void*)security_keys->key_pair.authentication, key_bytes, sizeof(security_keys->key_pair.authentication)); + + r = sd_bus_message_read(message, "y", &security_keys->sequence_number); + if (r < 0) + { + sd_bus_error_set_errno(error, r); + LOGE("Could not read key sequence: %s\n", strerror(-r)); + return r; + } + + return 0; +} + +/** + * \brief Set network security keys for sink + * \param ... (from sd_bus function signature) + */ +static int set_network_security_keys(sd_bus_message *m, void *userdata, sd_bus_error *error) +{ + wpc_key_pair_t network_keys; + const int r = read_security_keys_from_message(m, error, &network_keys); + if (r < 0) + { + sd_bus_error_set_errno(error, r); + LOGE("Cannot read network security keys: %s\n", strerror(-r)); + return r; + } + + LOGD("Set network keys with sequence:%d\n", network_keys.sequence_number); + + const app_res_e wpc_res = WPC_set_network_key_pair(&network_keys); + if (APP_RES_OK != wpc_res) + { + SET_WPC_ERROR(error, "WPC_set_network_key_pair", wpc_res); + LOGE("Cannot set network key pair (ret=%d)\n", wpc_res); + return -EINVAL; + } + + return sd_bus_reply_method_return(m, ""); +} + +/** + * \brief Set management security keys for sink + * \param ... (from sd_bus function signature) + */ +static int set_management_security_keys(sd_bus_message *m, void *userdata, sd_bus_error *error) +{ + wpc_key_pair_t management_keys; + const int r = read_security_keys_from_message(m, error, &management_keys); + if (r < 0) + { + sd_bus_error_set_errno(error, r); + LOGE("Cannot read management security keys: %s\n", strerror(-r)); + return r; + } + + LOGD("Set management keys with sequence:%d\n", management_keys.sequence_number); + + const app_res_e wpc_res = WPC_set_management_key_pair(&management_keys); + if (APP_RES_OK != wpc_res) + { + SET_WPC_ERROR(error, "WPC_set_management_key_pair", wpc_res); + LOGE("Cannot set management key pair (ret=%d)\n", wpc_res); + return -EINVAL; + } + + return sd_bus_reply_method_return(m, ""); +} + /********************************************************************** * VTABLE for config module * **********************************************************************/ @@ -824,6 +947,8 @@ static const sd_bus_vtable config_vtable[] = { SD_BUS_METHOD("SetConfigDataItem", "qay", "", set_config_data_item, SD_BUS_VTABLE_UNPRIVILEGED), SD_BUS_METHOD("GetConfigDataItem", "q", "ay", get_config_data_item, SD_BUS_VTABLE_UNPRIVILEGED), SD_BUS_METHOD("GetConfigDataContent", "", "a(qay)", get_config_data_content, SD_BUS_VTABLE_UNPRIVILEGED), + SD_BUS_METHOD("SetNetworkSecurityKeys", "ayayy", "", set_network_security_keys, SD_BUS_VTABLE_UNPRIVILEGED), + SD_BUS_METHOD("SetManagementSecurityKeys", "ayayy", "", set_management_security_keys, SD_BUS_VTABLE_UNPRIVILEGED), /* Event generated when stack starts */ SD_BUS_SIGNAL("StackStarted", "", 0), From 3b24a190c66d273e88023c7e801fa1eeb16bbb26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=9Ean=20G=C3=BCne=C5=9F?= <180301198+sgunes-wirepas@users.noreply.github.com> Date: Mon, 18 Aug 2025 16:29:03 +0300 Subject: [PATCH 4/7] Update wirepas_mesh_messaging dependency --- python_transport/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python_transport/requirements.txt b/python_transport/requirements.txt index c7941208..60d9d059 100644 --- a/python_transport/requirements.txt +++ b/python_transport/requirements.txt @@ -1,5 +1,5 @@ # wirepas -wirepas_mesh_messaging==1.3.0rc1 +wirepas_mesh_messaging==1.3.0rc3 # dbus bindings pydbus==0.6.0 From f711a7b0f0dd08925b19041111ace2284ff061da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=9Ean=20G=C3=BCne=C5=9F?= <180301198+sgunes-wirepas@users.noreply.github.com> Date: Mon, 18 Aug 2025 16:31:20 +0300 Subject: [PATCH 5/7] Support for sink key management in transport service --- .../wirepas_gateway/dbus/sink_manager.py | 50 +++++++++++++++++++ .../wirepas_gateway/transport_service.py | 3 +- 2 files changed, 52 insertions(+), 1 deletion(-) diff --git a/python_transport/wirepas_gateway/dbus/sink_manager.py b/python_transport/wirepas_gateway/dbus/sink_manager.py index 28738b31..2d75df14 100644 --- a/python_transport/wirepas_gateway/dbus/sink_manager.py +++ b/python_transport/wirepas_gateway/dbus/sink_manager.py @@ -247,6 +247,48 @@ def _set_param(self, dic, key, attribute): return wmm.GatewayResultCode.GW_RES_OK + def _set_network_keys(self, config): + if "network_keys" in config: + try: + cipher = config["network_keys"]["cipher"] + auth = config["network_keys"]["authentication"] + seq = config["network_keys"]["sequence"] + logging.info(f"Setting network security keys with sequence {seq}") + self.proxy.SetNetworkSecurityKeys(cipher, auth, seq) + except GLib.Error as e: + error_code = ReturnCode.error_from_dbus_exception(str(e)) + logging.error("Error when setting network keys: %s", error_code.name) + return error_code + except OverflowError: + logging.error("Invalid sequence when setting network keys") + return wmm.GatewayResultCode.GW_RES_INVALID_PARAM + except Exception: + logging.exception("Unknown error when setting network keys") + return wmm.GatewayResultCode.GW_RES_INTERNAL_ERROR + + return wmm.GatewayResultCode.GW_RES_OK + + def _set_management_keys(self, config): + if "management_keys" in config: + try: + cipher = config["management_keys"]["cipher"] + auth = config["management_keys"]["authentication"] + seq = config["management_keys"]["sequence"] + logging.info(f"Setting management security keys with sequence {seq}") + self.proxy.SetManagementSecurityKeys(cipher, auth, seq) + except GLib.Error as e: + error_code = ReturnCode.error_from_dbus_exception(str(e)) + logging.error("Error when setting management keys: %s", error_code.name) + return error_code + except OverflowError: + logging.error("Invalid sequence when setting management keys") + return wmm.GatewayResultCode.GW_RES_INVALID_PARAM + except Exception: + logging.exception("Unknown error when setting management keys") + return wmm.GatewayResultCode.GW_RES_INTERNAL_ERROR + + return wmm.GatewayResultCode.GW_RES_OK + def write_config(self, config): # Force the node address if used try: @@ -309,6 +351,14 @@ def write_config(self, config): res = wmm.GatewayResultCode.GW_RES_INVALID_PARAM logging.error("Invalid range value") + res_network_keys = self._set_network_keys(config) + if res_network_keys != wmm.GatewayResultCode.GW_RES_OK: + res = res_network_keys + + res_management_keys = self._set_management_keys(config) + if res_management_keys != wmm.GatewayResultCode.GW_RES_OK: + res = res_management_keys + # Set stack in state defined by new config or set it as it was # previously try: diff --git a/python_transport/wirepas_gateway/transport_service.py b/python_transport/wirepas_gateway/transport_service.py index dd7df255..5d65fbd2 100644 --- a/python_transport/wirepas_gateway/transport_service.py +++ b/python_transport/wirepas_gateway/transport_service.py @@ -379,7 +379,8 @@ def __init__(self, settings, **kwargs): self.gw_version = settings.gateway_version self.gw_features = [ - wmm.GatewayFeature.GW_FEATURE_CONFIGURATION_DATA_V1 + wmm.GatewayFeature.GW_FEATURE_CONFIGURATION_DATA_V1, + wmm.GatewayFeature.GW_FEATURE_SINK_KEY_MANAGEMENT_V1 ] self.whitened_ep_filter = settings.whitened_endpoints_filter From 18084e0648e3c88f9e3dc52887ff90e38694728f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=9Ean=20G=C3=BCne=C5=9F?= <180301198+sgunes-wirepas@users.noreply.github.com> Date: Tue, 19 Aug 2025 13:46:10 +0300 Subject: [PATCH 6/7] Prevent printing security keys to logs Debug log for SetConfigRequest is updated to exclude disallowed config parameters by printing them as "". When the wrapper class MaskedRequest is passed as a string parameter for a formatted log (like in current example), the __str__ method only executes if the log will be printed. Additionally: - Error logs under _set_param are modified to completely ommit parameter values. - Fix logging for app config by only printing related parameters. --- .../wirepas_gateway/dbus/sink_manager.py | 9 +++---- .../wirepas_gateway/transport_service.py | 26 ++++++++++++++++++- 2 files changed, 29 insertions(+), 6 deletions(-) diff --git a/python_transport/wirepas_gateway/dbus/sink_manager.py b/python_transport/wirepas_gateway/dbus/sink_manager.py index 2d75df14..605449a3 100644 --- a/python_transport/wirepas_gateway/dbus/sink_manager.py +++ b/python_transport/wirepas_gateway/dbus/sink_manager.py @@ -229,8 +229,7 @@ def _set_param(self, dic, key, attribute): # Exception raised when setting attribute error = ReturnCode.error_from_dbus_exception(str(e)) logging.error( - "Cannot set %s for param %s on sink %s: %s (%s)", - value, + "Cannot set param %s on sink %s: %s (%s)", key, self.sink_id, error.name, @@ -241,7 +240,7 @@ def _set_param(self, dic, key, attribute): except OverflowError: # It may happens as protobuf has bigger container value logging.error( - "Invalid range value for param %s with value %s", key, value + "Invalid range value for param %s", key ) return wmm.GatewayResultCode.GW_RES_INVALID_PARAM @@ -338,11 +337,11 @@ def write_config(self, config): diag = config["app_config_diag"] data = config["app_config_data"] - logging.info("Set app config with %s", config) + logging.info(f"Set app config with seq: {seq}, diag: {diag}, data: {data}") self.proxy.SetAppConfig(seq, diag, data) except KeyError: # App config not defined in new config - logging.debug("Missing key app_config key in config: %s", config) + logging.debug("Missing app config related key in config; will not set app config") except GLib.Error as e: res = ReturnCode.error_from_dbus_exception(str(e)) logging.error("Cannot set App Config: %s", res.name) diff --git a/python_transport/wirepas_gateway/transport_service.py b/python_transport/wirepas_gateway/transport_service.py index 5d65fbd2..e902df22 100644 --- a/python_transport/wirepas_gateway/transport_service.py +++ b/python_transport/wirepas_gateway/transport_service.py @@ -9,6 +9,7 @@ from time import time, sleep from uuid import getnode from threading import Thread, Event +from copy import deepcopy from wirepas_gateway.dbus.dbus_client import BusClient from wirepas_gateway.protocol.topic_helper import TopicGenerator, TopicParser @@ -365,6 +366,29 @@ class TransportService(BusClient): # Period in s to check for black hole issue MONITORING_BUFFERING_PERIOD_S = 1 + class MaskedRequest: + """ + Wrapper class to hide certain configuration fields of SetConfigRequest. + Can be used to exclude potentially sensitive fields from logs. + """ + def __init__(self, request: wmm.SetConfigRequest): + self.orig_request = request + + def __str__(self): + hidden_fields = [ + "cipher_key", + "authentication_key", + "network_keys", + "management_keys", + ] + + req_to_print = deepcopy(self.orig_request) + for key in req_to_print.new_config: + if key in hidden_fields: + req_to_print.new_config[key] = '' + + return str(req_to_print) + def __init__(self, settings, **kwargs): logging.info("Version is: %s", transport_version) @@ -732,7 +756,7 @@ def _on_set_config_cmd_received(self, client, userdata, message): logging.error(str(e)) return - logging.debug("Set sink config: %s", request) + logging.debug("Set sink config: %s", self.MaskedRequest(request)) sink = self.sink_manager.get_sink(request.sink_id) if sink is not None: res = sink.write_config(request.new_config) From ff50011061441ce997323a1b4efed5abe05141fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=9Ean=20G=C3=BCne=C5=9F?= <180301198+sgunes-wirepas@users.noreply.github.com> Date: Wed, 20 Aug 2025 12:17:35 +0300 Subject: [PATCH 7/7] Update transport service version for 1.5.0rc2 pre-release --- python_transport/wirepas_gateway/__about__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python_transport/wirepas_gateway/__about__.py b/python_transport/wirepas_gateway/__about__.py index 0821be83..6c56ea8d 100644 --- a/python_transport/wirepas_gateway/__about__.py +++ b/python_transport/wirepas_gateway/__about__.py @@ -19,5 +19,5 @@ __pkg_name__ = "wirepas_gateway" __title__ = "Wirepas Gateway Transport Service" __url__ = "https://github.com/wirepas/gateway" -__version__ = "1.5.0rc1" +__version__ = "1.5.0rc2" __keywords__ = "wirepas connectivity iot mesh"