aminghadersohi commented on code in PR #43202:
URL: https://github.com/apache/superset/pull/43202#discussion_r3825048382


##########
superset/mcp_service/utils/sanitization.py:
##########
@@ -35,82 +35,16 @@
 
 import nh3
 
-LLM_CONTEXT_OPEN_DELIMITER = "<UNTRUSTED-CONTENT>"
-LLM_CONTEXT_CLOSE_DELIMITER = "</UNTRUSTED-CONTENT>"
-LLM_CONTEXT_ESCAPED_OPEN_DELIMITER = "[ESCAPED-UNTRUSTED-CONTENT-OPEN]"
-LLM_CONTEXT_ESCAPED_CLOSE_DELIMITER = "[ESCAPED-UNTRUSTED-CONTENT-CLOSE]"
-LLM_CONTEXT_EXCLUDED_FIELD_NAMES = frozenset(
-    {
-        "cache_key",
-        "database",
-        "database_name",
-        "schema",
-        "schema_name",
-        "slug",
-        "url",
-        "urls",
-        "uuid",
-    }
-)
-
-
-def _normalize_field_name(field_name: str) -> str:
-    """Normalize a field name for exclusion matching."""
-    return field_name.strip().lower().replace("-", "_")
-
-
-def _escape_llm_context_delimiters(value: str) -> str:
-    """Escape delimiter tokens without wrapping the value."""
-    return value.replace(
-        LLM_CONTEXT_OPEN_DELIMITER,
-        LLM_CONTEXT_ESCAPED_OPEN_DELIMITER,
-    ).replace(
-        LLM_CONTEXT_CLOSE_DELIMITER,
-        LLM_CONTEXT_ESCAPED_CLOSE_DELIMITER,
-    )
-
-
-def _escape_llm_context_dict_key(key: Any) -> Any:
-    """Escape delimiter tokens in string dict keys."""
-    if isinstance(key, str):
-        return _escape_llm_context_delimiters(key)
-    return key
-
 
 def escape_llm_context_delimiters(value: Any) -> Any:
-    """Escape delimiter tokens in operational values that should not be 
wrapped."""
-    if isinstance(value, str):
-        return _escape_llm_context_delimiters(value)
-    if isinstance(value, dict):
-        return {
-            _escape_llm_context_dict_key(key): escape_llm_context_delimiters(
-                nested_value
-            )
-            for key, nested_value in value.items()
-        }
-    if isinstance(value, list):
-        return [escape_llm_context_delimiters(item) for item in value]
-    if isinstance(value, tuple):
-        return tuple(escape_llm_context_delimiters(item) for item in value)
-    return value
-
-
-def _wrap_llm_context_string(value: str) -> str:
-    """Wrap an untrusted string with explicit LLM-context delimiters."""
-    wrapped_prefix = f"{LLM_CONTEXT_OPEN_DELIMITER}\n"
-    wrapped_suffix = f"\n{LLM_CONTEXT_CLOSE_DELIMITER}"
-    if value.startswith(wrapped_prefix) and value.endswith(wrapped_suffix):
-        inner_value = value[len(wrapped_prefix) : -len(wrapped_suffix)]
-        return (
-            f"{wrapped_prefix}"
-            f"{_escape_llm_context_delimiters(inner_value)}"
-            f"{wrapped_suffix}"
-        )
+    """Return an MCP result value without changing application data.
 
-    escaped_value = _escape_llm_context_delimiters(value)
-    return (
-        
f"{LLM_CONTEXT_OPEN_DELIMITER}\n{escaped_value}\n{LLM_CONTEXT_CLOSE_DELIMITER}"
-    )
+    This compatibility helper is retained while callers migrate away from the
+    former in-band delimiter convention. Trust classification belongs in
+    protocol metadata or in a client-owned presentation layer; changing a
+    domain value makes read-modify-write flows persist presentation markup.
+    """
+    return value

Review Comment:
   Addressed in a02db005a. I removed the two public identity helpers and 
exports, all remaining tool/schema-side no-op wrappers, and every in-repo call 
site. The tests now assert clean values directly, while the production 
marker-invariant test remains in place.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to