← Back to Pull requests

fix(chat): redact encoded local path separators #5978

Open
unknown opened this pull request with 537 lines diff across 6 files
View on GitHub
unknown unknown commented on Oct 08, 2026 17:42 UTC
Author

Goal And Delivered Outcome

  • Goal: Keep protected local paths out of Chat answer streams while preserving safe project-relative filenames.

  • Expected behavior: Maintainer direction #5136, direction 3 requires public-safe path presentation; displaying a filename does not grant filesystem access.

  • Gap: The full-path matcher recognized encoded protected roots, but the streaming filter retained only a limited set of root spellings. A long root could be emitted in answer chunks before the completed answer was redacted.

  • Observable before → after: The same character-by-character probe leaked uppercase, lowercase-separator, and mixed %63 encodings on exact main 0e5acf. Main advanced to fac40bb; its intervening commits did not change loopx/chat.py or the focused path tests. On this PR head, the stream and final answer redact all three forms as [local-path].

  • Scope: Match the full path classifier literal and UTF-8 percent-encoded character forms when buffering incomplete roots. Path access, authorization, status/proposal handling, and filesystem behavior remain unchanged. The existing #5136 direction is the task anchor; a separate issue is not required.
  • Author Declaration

  • Written by: model_agent — OpenAI GPT-6 Luna Medium.

  • Some coding work was AI-assisted. I personally reviewed the changes, verified the relevant behavior and tests, and take responsibility for the submission.
  • Acceptance Criteria

    | Criterion | Result | Coverage |
    | --- | --- | --- |
    | Encoded separators, root bytes, and normalized aliases cannot bypass protected-root matching | Implemented | redact_local_paths; tests/test_chat_path_redaction.py |
    | Long encoded protected roots remain buffered through arbitrary stream splits | Implemented | Direct stream and synthetic ACP answer.delta tests |
    | Private descendants are hidden while safe project files keep relative names | Implemented | Path-redaction and response-parsing tests |

    Changes

  • Build the streaming prefix matcher from per-character literal and UTF-8 percent-encoded alternatives, comparing percent hex without case sensitivity.

  • Retain incomplete encoded separators while chunks arrive, so the existing length fallback cannot expose a protected root prefix.

  • Add lowercase-separator and mixed encoded-root-byte regressions at both the stream filter and ACP answer boundary.

  • Preserve normalized protected-root alias matching, safe relative path display, and existing filesystem and authorization boundaries.
  • Validation

  • Tested head: 7be3bbbc0a91078b50fdbf4609e45a22a13c4d4b, based on current main fac40bbc43ff17d0c0d573af69204cb73b36e842.

  • Red/green evidence: On exact main 0e5acf, the character-stream probe leaked the three encoded forms. The newer main commits did not modify the affected Chat source or focused test paths. On this head, stream and ACP outputs are redacted.

  • Focused validation on the rebased head: tests/test_chat_path_redaction.py, tests/test_chat_response_parsing.py, tests/test_chat_dsh_adapter.py, and tests/test_chat_session_active_turn.py — 126 passed.

  • Static validation on this head: Ruff on the changed Python files, Python compilation, and git diff --check origin/main...HEAD passed.

  • DCO: all seven commits include a Signed-off-by trailer.

  • Hosted checks on this head: Summary passed; DCO, Dependency Review, and Release Artifacts are queued; merge-gate is expected. The previous changes-requested review refers to an earlier head; the new head is awaiting review.

  • Coverage boundary: Path inputs and ACP transport are synthetic; no live Lark send or native Windows filesystem run was performed.
  • UI / RFC Impact

  • UI impact: none; text redaction behavior only.

  • Shared-authority schemas and semantic dimensions: unchanged; no RFC fixture impact.
  • Type of Change

  • Bug fix

  • Test update
  • LoopX Area

  • Host or runtime integration
  • Boundary Checklist

  • No private state, credentials, raw traces, or local machine paths disclosed; examples use synthetic paths.

  • Change is scoped to the #5136 path-presentation direction.

  • Every commit includes a DCO Signed-off-by trailer.
  • Diff: 537 lines (+402 / -135) across 6 files Reviewer: BigDataDZ Review duration: 7133m
    All Vouch review confidence checks passed
    Residual risk 0.26 = Change Risk (0.48) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.48 · 537 lines diff across 6 files
    0.48
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.376
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #5978"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 47.9% (MEDIUM) · Higher = larger blast radius
    47.9%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 25.6% · Safe to merge
    25.6%