Open-source Revit MCP server: let Claude and other AI assistants read and edit BIM models, with human approval on every change.
Python aecai-agentsautodeskautomationbimclaudeifcmcpmcp-servermodel-context-protocolnavisworksrevitrevit-addinrevit-apirhino
fix(security): redact UNC and drive-less backslash paths in logs and errors
sammohammad57831bdda1f2219
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 2a11e72..c9fd973 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -2,6 +2,7 @@## Unreleased+- Security: log and error redaction now also covers UNC network paths (`\\server\share\model.rvt`, the usual way central models are shared) and backslash paths without a drive letter. Before, a server or share name could appear in audit logs and error messages. This also fixes `test_redaction_in_server` on Linux.## 1.4.0 - 2026-10-09- Release: every stable release now also attaches a double-click Windows installer, `AECModelBridge-Setup-<version>.exe` (listed in `SHA256SUMS.txt`). It picks the installed Revit years, needs no admin rights, can set up Claude Desktop and VS Code (with a backup first) and uninstalls cleanly. The release workflow builds it with Inno Setup, smoke-tests a silent install, upgrade, failure and uninstall, and has a new `dry_run` input that builds everything without publishing. The old `AECModelBridge.iss` copied the package onto itself, always installed every year and ran the client setup without asking; it was reworked. `configure-mcp-clients.ps1` now backs up each config, writes UTF-8 and leaves a commented VS Code `settings.json` alone.diff --git a/packages/mcp-server-revit/src/revit_mcp_server/security/audit.py b/packages/mcp-server-revit/src/revit_mcp_server/security/audit.pyindex 95975aa..b304f03 100644--- a/packages/mcp-server-revit/src/revit_mcp_server/security/audit.py+++ b/packages/mcp-server-revit/src/revit_mcp_server/security/audit.py@@ -27,6 +27,10 @@ _SECRET_VALUE_RE = re.compile()_WINDOWS_PATH_RE = re.compile(r"(?<!\w)(?:[A-Za-z]:[\\/](?:[^\s\"'<>|]+[\\/])*[^\s\"'<>|]+)")_POSIX_PATH_RE = re.compile(r"(?:(?<=^)|(?<=[\s\"'(<\[]))(/(?:[^/\s]+/)*[^/\s]+)")+# UNC shares (\\server\share\model.rvt, the usual way central models are shared) and rooted+# backslash paths without a drive letter (\projects\model.rvt). Needs at least two segments and+# must not follow a word character, so "a\b" in ordinary text is left alone.+_UNC_OR_ROOTED_PATH_RE = re.compile(r"(?<![\w\\:])\\{1,2}(?:[^\s\"'<>|\\/]+\\)+[^\s\"'<>|\\/]+")def _is_sensitive_key(key: str) -> bool:@@ -37,6 +41,7 @@ def _is_sensitive_key(key: str) -> bool:def _redact_text(value: str) -> str:sanitized = _SECRET_VALUE_RE.sub(lambda match: f"{match.group(1)}=<redacted>", value)sanitized = _WINDOWS_PATH_RE.sub("<redacted-path>", sanitized)+ sanitized = _UNC_OR_ROOTED_PATH_RE.sub("<redacted-path>", sanitized)sanitized = _POSIX_PATH_RE.sub("<redacted-path>", sanitized)return sanitizeddiff --git a/packages/mcp-server-revit/tests/test_redaction_paths.py b/packages/mcp-server-revit/tests/test_redaction_paths.pynew file mode 100644index 0000000..254e1e5--- /dev/null+++ b/packages/mcp-server-revit/tests/test_redaction_paths.py@@ -0,0 +1,25 @@+"""Path redaction must cover every path style that shows up in AEC projects."""+import pytest++from revit_mcp_server.security.audit import redact_data+++ "text, leaked",+ [+ (r"opening C:\Projects\Tower\central.rvt now", "central.rvt"),+ (r"opening \\fileserver\BIM\Tower\central.rvt now", "fileserver"),+ (r"\\10.0.0.5\share\model.ifc", "model.ifc"),+ (r"mapped to \tmp\pytest-0\test.rvt", "test.rvt"),+ ("saved to /home/user/projects/model.rvt", "model.rvt"),+ ],+)+def test_paths_are_redacted(text, leaked):+ redacted = redact_data({"message": text})["message"]+ assert leaked not in redacted+ assert "<redacted-path>" in redacted++[email protected]("text", ["a\\b", "regex \\d+ and \\w", "plain sentence with no paths", "ratio 3/4"])+def test_ordinary_text_is_left_alone(text):+ assert redact_data({"message": text})["message"] == text