AI & Agent Dev Bug Sandbox logo
AI & Agent Dev Bug Sandbox
Back to Radar

PIIMiddleware URL Detector Falsely Flags Dotted Identifiers, Versions, And Ratios As URLs

The bare URL pattern in detect_url incorrectly matches patterns like 'Node.js/Express', '1.5/2.0', and 'python3.12/site-packages', leading to redaction or blocking of non-URL content.

highConfidence 90%LangChainRetrieversVector StoresChainsAffected V1.4.0

Origin Analysis

The bare URL regex and its acceptance heuristic are too permissive; any label.label/anything combination with a dot in the host passes the check, without validating the TLD or context.
Run the provided reproduction script using PIIMiddleware with 'url' strategy; observe false detections for the listed samples.

Fixing Code Block

Edge Case Audit

This hotfix may miss legitimate bare URLs with numeric labels (rare) or two-letter TLDs without www. (e.g., example.io/path). Test thoroughly. Rollback by reverting the change to the previous permissive check. The function is stateless, so no concurrency issues, but ensure compatibility with langchain_core versions.

Ecosystem Topology

Agent Frameworks

LangChain, LlamaIndex, and Pydantic

  1. highProperty graph relation keys collide when entity IDs or labels contain underscores
  2. highCodeActAgent drops assistant tool-call metadata during handoff, leaving an orphan tool response
  3. high[Bug]: HierarchicalNodeParser async methods return the documents unsplit
  4. highLLM.predict_and_call fails with ValidationError for non-function-calling models when react_chat_formatter is omitted
  5. highAnthropic streaming server-tool input_json_delta overwrites completed client tool_use arguments due to stale cur_tool_call state