diff --git a/.secrets.baseline b/.secrets.baseline index 60f0e726ba..9f95bb027a 100644 --- a/.secrets.baseline +++ b/.secrets.baseline @@ -3,7 +3,7 @@ "files": "^.secrets.baseline|package-lock.json|Cargo.lock|scripts/sign_image.sh|scripts/zap|sonar-project.properties|uv.lock|go.sum|mcpgateway/sri_hashes.json|^.secrets.baseline$", "lines": null }, - "generated_at": "2026-04-15T16:31:17Z", + "generated_at": "2026-04-16T00:46:36Z", "plugins_used": [ { "name": "AWSKeyDetector" @@ -344,7 +344,7 @@ "hashed_secret": "844c398e469ef3fb919da3778944365ab2175fb7", "is_secret": false, "is_verified": false, - "line_number": 469, + "line_number": 468, "type": "Secret Keyword", "verified_result": null }, @@ -352,7 +352,7 @@ "hashed_secret": "319037749ce37e577db0b3628c7f90e333544391", "is_secret": false, "is_verified": false, - "line_number": 893, + "line_number": 892, "type": "Secret Keyword", "verified_result": null }, @@ -360,7 +360,7 @@ "hashed_secret": "6ae2832e494d1098e8901fe156083e39399a24f1", "is_secret": false, "is_verified": false, - "line_number": 895, + "line_number": 894, "type": "Secret Keyword", "verified_result": null }, @@ -368,7 +368,7 @@ "hashed_secret": "43fc45734b96bcb1b6cef373e949eb3524ae199b", "is_secret": false, "is_verified": false, - "line_number": 1586, + "line_number": 1585, "type": "Secret Keyword", "verified_result": null }, @@ -376,7 +376,7 @@ "hashed_secret": "9d989e8d27dc9e0ec3389fc855f142c3d40f0c50", "is_secret": false, "is_verified": false, - "line_number": 1797, + "line_number": 1796, "type": "Secret Keyword", "verified_result": null }, @@ -384,7 +384,7 @@ "hashed_secret": "d3ac7a4ef1a838b4134f2f6e7f3c0d249d74b674", "is_secret": false, "is_verified": false, - "line_number": 6226, + "line_number": 6225, "type": "Secret Keyword", "verified_result": null }, @@ -392,7 +392,7 @@ "hashed_secret": "5932862bcd24dd27d0dc0407ec94fe9d6ea24aeb", "is_secret": false, "is_verified": false, - "line_number": 6723, + "line_number": 6722, "type": "Secret Keyword", "verified_result": null }, @@ -400,7 +400,7 @@ "hashed_secret": "c77c805e32f173e4321ee9187de9c29cb3804513", "is_secret": false, "is_verified": false, - "line_number": 6735, + "line_number": 6734, "type": "Secret Keyword", "verified_result": null }, @@ -408,7 +408,7 @@ "hashed_secret": "8fe3df8a68ddd0d4ab2214186cbb8e38ccd0e06a", "is_secret": false, "is_verified": false, - "line_number": 6807, + "line_number": 6806, "type": "Secret Keyword", "verified_result": null }, @@ -416,7 +416,7 @@ "hashed_secret": "93ac8946882128457cd9e283b30ca851945e6690", "is_secret": false, "is_verified": false, - "line_number": 7877, + "line_number": 7876, "type": "Secret Keyword", "verified_result": null } diff --git a/Makefile b/Makefile index 7520c3f210..93b0723938 100644 --- a/Makefile +++ b/Makefile @@ -39,8 +39,7 @@ MCP_2025_RPC_PATH ?= /mcp/ MCP_2025_BEARER_TOKEN ?= # Virtual-environment variables -VENVS_DIR ?= $(HOME)/.venv -VENV_DIR ?= $(VENVS_DIR)/$(PROJECT_NAME) +VENV_DIR ?= $(CURDIR)/.venv # ----------------------------------------------------------------------------- # Project-wide clean-up targets @@ -253,7 +252,7 @@ DETECT_SECRETS_SPEC ?= git+https://github.com/ibm/detect-secrets.git@076672a .PHONY: venv venv: uv @rm -Rf "$(VENV_DIR)" - @test -d "$(VENVS_DIR)" || mkdir -p "$(VENVS_DIR)" + @mkdir -p "$(VENV_DIR)" @$(UV_BIN) venv "$(VENV_DIR)" @echo -e "āœ… Virtual env created.\nšŸ’” Enter it with:\n . $(VENV_DIR)/bin/activate\n" diff --git a/docs/Makefile b/docs/Makefile index 4612b4194d..95ae34505b 100644 --- a/docs/Makefile +++ b/docs/Makefile @@ -4,8 +4,7 @@ HANDBOOK_NAME := mcpgateway-docs # Do not change anything below this line -VENVS_DIR := $(HOME)/.venv -VENV_DIR := $(VENVS_DIR)/$(HANDBOOK_NAME) +VENV_DIR := $(CURDIR)/.venv # Setup to support M1 Macs - Linux will be empty; x86 Macs essentially NO-OP BREW_SHELLENV := $(shell brew shellenv 2>/dev/null) @@ -18,7 +17,7 @@ help: # help: venv - create a clean virtual environment for development .PHONY: venv venv: - @test -d "$(VENVS_DIR)" || mkdir -p "$(VENVS_DIR)" + @mkdir -p "$(VENV_DIR)" @rm -Rf "$(VENV_DIR)" @eval '$(BREW_SHELLENV)' && python3 -m venv "$(VENV_DIR)" @/bin/bash -c "source $(VENV_DIR)/bin/activate && pip install --upgrade pip setuptools wheel && pip install markdown-blockdiag && pip install -r requirements.txt" diff --git a/mcpgateway/services/tool_service.py b/mcpgateway/services/tool_service.py index 687a3b102b..6e099b7ffb 100644 --- a/mcpgateway/services/tool_service.py +++ b/mcpgateway/services/tool_service.py @@ -414,13 +414,13 @@ class can override either to raise), and without this staged if isinstance(text, str): return text except Exception: # pylint: disable=broad-except - pass + pass # nosec B110 try: text = repr(obj) if isinstance(text, str): return text except Exception: # pylint: disable=broad-except - pass + pass # nosec B110 # ``fallback_type`` came from ``_safe_type_name`` so it's # guaranteed to be a ``str`` already. return f"<{fallback_type} object (unrepresentable)>" diff --git a/plugin_templates/external/{{cookiecutter.plugin_slug}}/Makefile b/plugin_templates/external/{{cookiecutter.plugin_slug}}/Makefile index 132048e514..f392437bb1 100644 --- a/plugin_templates/external/{{cookiecutter.plugin_slug}}/Makefile +++ b/plugin_templates/external/{{cookiecutter.plugin_slug}}/Makefile @@ -10,8 +10,7 @@ PROJECT_NAME = {{ cookiecutter.plugin_slug }} TARGET ?= {{ cookiecutter.plugin_slug }} # Virtual-environment variables -VENVS_DIR ?= $(HOME)/.venv -VENV_DIR ?= $(VENVS_DIR)/$(PROJECT_NAME) +VENV_DIR ?= $(CURDIR)/.venv # ============================================================================= # Linters @@ -296,8 +295,7 @@ show-runtime: .PHONY: venv venv: @rm -Rf "$(VENV_DIR)" - @test -d "$(VENVS_DIR)" || mkdir -p "$(VENVS_DIR)" - @python3 -m venv "$(VENV_DIR)" + @mkdir -p "$(VENV_DIR)" @/bin/bash -c "source $(VENV_DIR)/bin/activate && python3 -m pip install --upgrade pip setuptools pdm uv" @echo -e "Virtual env created.\n Enter it with:\n . $(VENV_DIR)/bin/activate\n" diff --git a/plugins/external/cedar/Makefile b/plugins/external/cedar/Makefile index a6855e6e33..de98f77fdc 100644 --- a/plugins/external/cedar/Makefile +++ b/plugins/external/cedar/Makefile @@ -10,8 +10,7 @@ PROJECT_NAME = cedarpolicyplugin TARGET ?= cedarpolicyplugin # Virtual-environment variables -VENVS_DIR ?= $(HOME)/.venv -VENV_DIR ?= $(VENVS_DIR)/$(PROJECT_NAME) +VENV_DIR ?= $(CURDIR)/.venv # ============================================================================= # Linters @@ -298,7 +297,7 @@ show-runtime: .PHONY: venv venv: @rm -Rf "$(VENV_DIR)" - @test -d "$(VENVS_DIR)" || mkdir -p "$(VENVS_DIR)" + @mkdir -p "$(VENV_DIR)" @python3 -m venv "$(VENV_DIR)" @/bin/bash -c "source $(VENV_DIR)/bin/activate && python3 -m pip install --upgrade pip setuptools pdm uv" @echo -e "āœ… Virtual env created.\nšŸ’” Enter it with:\n . $(VENV_DIR)/bin/activate\n" diff --git a/plugins/external/llmguard/Makefile b/plugins/external/llmguard/Makefile index 8ccde45a0d..d7cb9b08dc 100644 --- a/plugins/external/llmguard/Makefile +++ b/plugins/external/llmguard/Makefile @@ -10,8 +10,7 @@ PROJECT_NAME = llmguardplugin TARGET ?= llmguardplugin # Virtual-environment variables -VENVS_DIR ?= $(HOME)/.venv -VENV_DIR ?= $(VENVS_DIR)/$(PROJECT_NAME) +VENV_DIR ?= $(CURDIR)/.venv # ============================================================================= # Linters @@ -311,7 +310,7 @@ show-runtime: .PHONY: venv venv: @rm -Rf "$(VENV_DIR)" - @test -d "$(VENVS_DIR)" || mkdir -p "$(VENVS_DIR)" + @mkdir -p "$(VENV_DIR)" @python3 -m venv "$(VENV_DIR)" @/bin/bash -c "source $(VENV_DIR)/bin/activate && python3 -m pip install --upgrade pip setuptools pdm uv" @echo -e "āœ… Virtual env created.\nšŸ’” Enter it with:\n . $(VENV_DIR)/bin/activate\n" diff --git a/plugins/external/opa/Makefile b/plugins/external/opa/Makefile index a64571b74c..f4ad44a61f 100644 --- a/plugins/external/opa/Makefile +++ b/plugins/external/opa/Makefile @@ -12,8 +12,7 @@ OPASERVER_VERSION ?= 1.10.1 POLICY_PATH = "./opaserver/rego/policy.rego" # Virtual-environment variables -VENVS_DIR ?= $(HOME)/.venv -VENV_DIR ?= $(VENVS_DIR)/$(PROJECT_NAME) +VENV_DIR ?= $(CURDIR)/.venv # ============================================================================= # Linters @@ -301,7 +300,7 @@ show-runtime: .PHONY: venv venv: @rm -Rf "$(VENV_DIR)" - @test -d "$(VENVS_DIR)" || mkdir -p "$(VENVS_DIR)" + @mkdir -p "$(VENV_DIR)" @python3 -m venv "$(VENV_DIR)" @/bin/bash -c "source $(VENV_DIR)/bin/activate && python3 -m pip install --upgrade pip setuptools pdm uv" @echo -e "āœ… Virtual env created.\nšŸ’” Enter it with:\n . $(VENV_DIR)/bin/activate\n" diff --git a/smoketest.py b/smoketest.py index 603013ef37..7e7b9f6213 100755 --- a/smoketest.py +++ b/smoketest.py @@ -52,8 +52,7 @@ PORT_TIME_SERVER = 8002 # mcpgateway.translate DOCKER_CONTAINER = "mcpgateway" PROJECT_NAME = "mcpgateway" -VENVS_DIR = os.getenv("VENVS_DIR", os.path.join(os.path.expanduser("~"), ".venv")) -PROJECT_VENV_DIR = os.getenv("VENV_DIR", os.path.join(VENVS_DIR, PROJECT_NAME)) +PROJECT_VENV_DIR = os.getenv("VENV_DIR", os.path.join(os.path.dirname(os.path.abspath(__file__)), ".venv")) PROJECT_VENV_PYTHON = os.path.join(PROJECT_VENV_DIR, "bin", "python") MAKE_VENV_CMD = ["make", "venv", "install", "install-dev"]