Skip to content

fix: replace every spelling of the host name in a diagnostics bundle - #35569

Merged
KiroCrewCaptain merged 3 commits into
mainfrom
fix/32005-host-name-spellings
Nov 20, 2026
Merged

KiroCrewCaptain merged 3 commits into
mainfrom
fix/32005-host-name-spellings

Conversation

@dodgeblaster

@dodgeblaster dodgeblaster commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Problem / Motivation

Goal: A diagnostics bundle replaces this machine's host name with <host> in its escaped, percent-encoded, joined, Windows-path and IDNA spellings, not only where the name is written literally.

kirocrew doctor --bundle replaces the host name in every text member, but only where it appears as written. On a machine named box, a log line boot<form feed>box reaches the zip as bootbox, because the credential scrub strips the form feed first. %2Fbox, C:\Users\box\, jane\u002dlaptop, jane%2Dlaptop and the punycode form of a Unicode name also survive.

Why it matters

The bundle is meant to be attached to a public GitHub issue. A work machine's name often carries its user's name or an asset tag, so each surviving spelling publishes it.

Not a goal

  • A name followed by -, _ or a digit (jane-laptop-1234.log). The match stops there on purpose, because jane-laptop2 can be another machine.
  • The domain after a short name (<host>.corp.example). Looking up the fully qualified name can block on DNS.
  • Names from earlier boots, generic names such as localhost being replaced in ordinary text, and the macOS computer name (Jane's MacBook Pro), which comes from a different source.

What changed (motivation → approach → change)

The old matcher compared literal spellings and kept a growing list of prefixes (\n, \x1b, [32m) to recognise where a short name starts. Each review round of #31159 found another one.

Spelling How it is now matched
\u002d, \x2d, %2D, %2F, %62 a decoded view of the text, where each encoded character reads as the one it encodes and keeps its original span, so the match replaces exactly those original characters
\n, \t and other serialized escapes read as one non-name character in that view, so a one-letter name never takes the t of \t
C:\Users\box\, \\box\share a short name of two characters or more also starts after a literal \ inside a Windows path (its first letter makes no escape, a separator follows it, or the text before it on the same quoted run shows a path: a drive, \\, a collapsed ~\, or a \ before another letter), so \nAs in serialized text stays a newline escape
boot<FF>box, boot<ZWSP>box the join is read from the member before the scrub, and the replacement still runs after it, so a host name can never hide a credential from its rule
bücher-pc / xn--bcher-pc-65a / XN--BCHER-PC-65A the other IDNA spelling of each name is added, whatever the case of the xn-- label
b%C3%BCcher-pc, b\xc3\xbccher-pc, jane-\ud83d\ude00-pc a run of encoded units is decoded as one sequence (%XX and \xXX as UTF-8, \uXXXX as UTF-16), so one encoded character is one character

The host pass moves from diagnostics.py into src/kiro_crew/diagnostics_host_name.py, which keeps diagnostics.py under the 1,600-line split point. src/kiro_crew/docs/troubleshooting.md now names the spellings that are replaced and the ones that can remain.

Backwards compatibility

Compatible: the bundle replaces more spellings of the host name; every spelling replaced before is still replaced.

Removes nothing: the private _replace_host_name helper moves to diagnostics_host_name.replace_host_names; its only caller, diagnostics._scrub_bundle, moves with it.

Tests

test/test_diagnostics_host_name.py drives diagnostics._scrub_bundle for each spelling: form feed, vertical tab and ZWSP joins (an encoded name and a name joined on both sides included), a 24-bit color code before the name, %2F, %62, Windows, UNC and JSON-escaped paths for a short name; \u002d, \u002D, \x2d, %2D, upper case and %6A for a long name; both IDNA directions, an upper-case xn-- name, a Unicode name as UTF-8 %XX and \xXX bytes, and a name outside the Basic Plane as a JSON \uXXXX surrogate pair. A stray byte or a lone surrogate still decodes, and a Unicode case variant (İ, ı, ſ) beside a joined short name does not abort the scrub. Many distinct joins in one member are each replaced, and a join keeps only the last 16 characters of the word in front, which keeps the pass linear in the member: 20,000 joined records take 0.07 s. It also pins what must survive (boxes, inbox, my-box, vm_box, 1box, toolbox, a serialized \t with a one-letter name), that a credential next to a joined name is still redacted, and the issue's reproduction through collect_bundle. The existing host-name tests in test/test_diagnostics.py pass unchanged.

Proof: PROVEN test/test_diagnostics_host_name.py::test_a_short_host_name_is_replaced_in_every_spelling[form-feed], test/test_diagnostics_host_name.py::test_a_short_host_name_is_replaced_in_every_spelling[vertical-tab], test/test_diagnostics_host_name.py::test_a_short_host_name_is_replaced_in_every_spelling[zwsp], test/test_diagnostics_host_name.py::test_a_short_host_name_is_replaced_in_every_spelling[joined-encoded], test/test_diagnostics_host_name.py::test_a_short_host_name_is_replaced_in_every_spelling[joined-twice] (head 7a41ad0)

The new tests are pure string checks on monkeypatched host names, with no clock, port or ordering dependence.

Manual verification

N/A — unit coverage sufficient: the bundle path is exercised end to end through collect_bundle in the tests.

Related Issues

Fixes #32005

Sibling sweep

Swept: git grep -n -e "gethostname()" -- src/kiro_crew
Sibling: src/kiro_crew/apps/builtins/issue_radar/backend/agent_tools.py:86 -- not affected -- it scrubs model-written crew prose, not serialized logs, so escaped spellings do not arise there

Pattern harvest

Not generalizable: matching on a decoded view with original spans is specific to scrubbing an identifier out of serialized log text.

Checklist

  • At most two commits (one is the norm), with a Conventional Commits title (feat|fix|docs|style|refactor|perf|test|chore|ci|build|revert: ...)
  • Existing tests pass and new tests added for new functionality
  • Self-review completed; code follows project style guidelines
  • Documentation updated (if applicable)
  • No secrets, credentials, or internal references in the diff

@github-actions github-actions Bot added the readiness: checking Automated validation is still running label Nov 11, 2026
@dodgeblaster

dodgeblaster commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor Author

Rebased onto main to pick up the Windows main fix #35625 (a8207cb -> d99560b); CI re-running. The diff is unchanged: the same four files.

@dodgeblaster
dodgeblaster force-pushed the fix/32005-host-name-spellings branch from a8207cb to d99560b Compare November 12, 2026 02:21
@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

UX Review (Opus 5.5) — ⏭️ skipped

Revision 5015b8e2f4234f93749e8b99e3596c117df9cdca touches no user-facing surface (no changes under website/ or committed screenshots), so the UX review was skipped. Does not block merge.

@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Design Review (Opus 5.5) — ✅ PASS

Design-level review of 5015b8e2f4234f93749e8b99e3596c117df9cdca — updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

Design-Verdict: PASS

No design-level concerns: the new decoded view keeps each character's original span, which fixes the cause of the leaks, and nothing is taken away.

Notes

  • The Windows-path rules (_PATH_HINT, _ESCAPE_LETTERS, _follows_escaped_escape) are still guesses based on the text around a match. Treat the next leaked spelling as a reason to tighten the "look through the zip" warning in troubleshooting.md, not to add another rule.

[DESIGN-REVIEWED] 5015b8e

Description read

[DESCRIPTION-READ] 038987536ef592bd30146ddf5fcfc1a80d4b67b6944aac4f176eeadae65e3fae

That sha256 names everything this verdict read: the PR description, plus the 1 evidence file(s) the workflow collected from it and handed this review. It covers that evidence because the media strip replaces every attachment URL with the same placeholder, so an edit swapping one attachment for another would leave the description's captured text identical while what this review judged changed. Recompute it with .github/scripts/pr-description-capture.sh over the same inputs; if it differs, the description or that evidence changed after this verdict was formed and any finding drawn from either is unproven.

@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

First Principles Review (Opus 5.5) — ✅ PASS

Premise-level review of 5015b8e2f4234f93749e8b99e3596c117df9cdca — why this exists and whether the shipped surface is the smallest honest version. Updated in place on each push. A BLOCK verdict blocks PR readiness; PASS does not.

First-Principles-Verdict: PASS

The shipped pieces stay inside the frozen Goal, and each spelling has a test this PR adds that fails on base. The Windows-path handling reads like a pile of guesses about spellings.

Notes

  • Item 4 — oversized: a short name after a \ is decided by three overlapping guesses (_follows_escaped_escape, _is_escape_letter_after_backslash, and _in_windows_path with its 4-branch _PATH_HINT). The description says the old matcher failed this way: "kept a growing list of prefixes… Each review round… found another one." Subtraction: keep only _in_windows_path's first two rules (the first letter makes no escape, or a separator follows the name). Delete the 260-character _PATH_HINT lookback and the doubly-serialized special case, and leave the rest as the ## Not a goal-style gap that troubleshooting.md already admits ("a less common spelling… can remain").

What this change ships

Inventory (8 items) — 7 justified

Intent: stop a diagnostics bundle you attach to a public issue from leaking your machine's host name. This is a FIX (#32005).

  1. A short name joined onto a word by a stripped hidden character (boot<FF>box) is now replaced — justified
  2. Percent-, \x- and \u-encoded spellings of the name are now replaced — justified
  3. Multi-byte UTF-8 and UTF-16 escapes decode as single characters, so an encoded Unicode name is matched — justified
  4. A short name in a Windows or UNC path, including a doubly-serialized one, is now replaced — oversized: three stacked guesses about path shape
  5. The other IDNA spelling of the name (punycode or Unicode) is now replaced — justified
  6. A serialized escape (\t, \nAs) is no longer taken for a one-letter or escape-letter name — justified
  7. The host pass moves into diagnostics_host_name.py — justified
  8. troubleshooting.md now lists which spellings are replaced and which can remain — justified

[FIRST-PRINCIPLES-REVIEWED] 5015b8e

Description read

[DESCRIPTION-READ] 7786c250679c5a860ab38b6c3ec6b5f3c98d3a55a45cf31218eac3c60063d4f7

That sha256 names the PR description this verdict read. Recompute it with .github/scripts/pr-description-capture.sh; if it differs, the description changed after this verdict was formed and any finding drawn from the description is unproven.

@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Opus 5.5 Review — ✅ no blocking findings

Reviewed 5015b8e2f4234f93749e8b99e3596c117df9cdca — this comment is updated in place on each push.

Review details

No findings.

[OPUS-REVIEWED] 5015b8e

Verdict parsed from the review's SHA-scoped output markers for commit 5015b8e2f4234f93749e8b99e3596c117df9cdca.

False positive or not applicable? A repository writer can comment:
/ai-review override fable 5015b8e2f4234f93749e8b99e3596c117df9cdca false-positive: <reason, 20 to 500 characters>

@github-actions

github-actions Bot commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

GPT 6.1 Review — ✅ no blocking findings

GPT 6.1 completed its review of 5015b8e2f4234f93749e8b99e3596c117df9cdca and found no blocking issues.

This comment is updated in place on each push.

Review details

No findings.
[GPT-REVIEWED] 5015b8e

False positive or not applicable? A repository writer can comment:
/ai-review override gpt 5015b8e2f4234f93749e8b99e3596c117df9cdca false-positive: <reason, 20 to 500 characters>

@dodgeblaster
dodgeblaster force-pushed the fix/32005-host-name-spellings branch from d99560b to 02ad0df Compare November 12, 2026 02:34
@dodgeblaster

dodgeblaster commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor Author
  • span=66cca0b42464 UTF-8 percent-encoded Unicode hostnames survive replacement

fixed in 02ad0df: a run of %XX or \xXX bytes is read as UTF-8 (_byte_run), so %C3%BC is one ü view character spanning all six original characters; a byte that starts no valid sequence reads as its Latin-1 character.
Tests: test_the_other_idna_spelling_is_replaced[utf8-percent-encoded], [utf8-percent-lower-case-hex], [utf8-byte-escapes], and test_a_byte_that_starts_no_utf8_sequence_still_decodes.

@dodgeblaster

dodgeblaster commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor Author
  • span=66cca0b42464 Uppercase punycode hostnames omit their Unicode spelling

fixed in 02ad0df: _idna_spellings decodes the lower-cased name, since the codec decodes only a lower-case xn-- label; the original spelling stays in the name list for literal matching.
Test: test_the_other_idna_spelling_is_replaced[upper-case-punycode-name].

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: checking Automated validation is still running labels Nov 12, 2026
@dodgeblaster
dodgeblaster force-pushed the fix/32005-host-name-spellings branch from 02ad0df to 950f0b1 Compare November 12, 2026 02:46
@dodgeblaster

dodgeblaster commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor Author
  • span=66cca0b42464 Valid truecolor sequences prevent short-host redaction

fixed in 950f0b1: the 24-character lookback is gone; _ends_control_sequence walks back from the name over the parameter bytes to the [ with no length limit.
Tests: test_a_short_host_name_is_replaced_in_every_spelling[truecolor-raw] and [truecolor-serialized] (the 38;2/48;2 sequence from the finding).

@dodgeblaster

dodgeblaster commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor Author
  • span=66cca0b42464 Join metadata loses encoded names and stripped end boundaries

fixed in 950f0b1: find_joined_host_words reads the decoded view of the raw text, so boot<FF>%62ox records the join, and a recorded join matches in the final text without an end boundary, so boot<FF>box<FF>box loses both names. The replacement still runs after credential redaction.
Tests: test_a_short_host_name_is_replaced_in_every_spelling[joined-encoded] and [joined-twice].

@dodgeblaster

dodgeblaster commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor Author
  • span=66cca0b42464 Internal hidden characters defeat joined short-host redaction

Rebutted as disproportionate, in line with this head's adjudication (DOWNGRADE, disproportionate-remedy): the leak needs a short name, a stripped character joining it to the word in front, AND a second stripped character inside the name itself. The name comes from gethostname(), so an invisible character inside it is planted text, and what leaks is the host name, not a credential.
Closing it needs a third offset map (original -> strip -> view) in the matcher, which is more spelling-chase than this fix's goal calls for. Every spelling named in the frozen Goal is replaced on this head.

@dodgeblaster

Copy link
Copy Markdown
Contributor Author

The red Coverage Gate on 950f0b1 is not from this diff: it flags src/kiro_crew/gateway_restart.py (58.5%) and src/kiro_crew/update_boot_apply.py (74.8%), neither of which this PR touches. Main's own CI is red on the same files, and #35725 adds the tests that bring both to the 80% floor. This PR waits for #35725 and rebases once it merges.

@dodgeblaster

dodgeblaster commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor Author

Rebased onto main to pick up #35725, the coverage tests for gateway_restart.py and update_boot_apply.py (950f0b1 -> 456596f); CI re-running. The diff is unchanged: the same four files.

@dodgeblaster
dodgeblaster force-pushed the fix/32005-host-name-spellings branch from 950f0b1 to 456596f Compare November 12, 2026 05:40
@github-actions github-actions Bot added readiness: checking Automated validation is still running and removed readiness: action required A blocking check or review needs attention labels Nov 12, 2026
@dodgeblaster
dodgeblaster force-pushed the fix/32005-host-name-spellings branch from 456596f to 53373a4 Compare November 12, 2026 05:55
@dodgeblaster

Copy link
Copy Markdown
Contributor Author
  • span=66cca0b42464 JSON surrogate pairs leave Unicode host names unredacted
    resolution: narrowed -- one run decoder for every encoding replaces the per-encoding branches

fixed in 53373a4: a run of \uXXXX units is decoded as UTF-16, so a high/low surrogate pair is one character spanning both escapes; a lone surrogate stays a stand-in.
This is the third fix on this span, so the approach changed instead of adding a branch: _decode_token decodes every encoded run through its codec (%XX and \xXX as UTF-8, \uXXXX as UTF-16), one view character per encoded character.
Tests: test_a_name_outside_the_basic_plane_is_replaced_from_a_surrogate_pair and test_a_lone_surrogate_escape_is_left_alone.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running and removed readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention labels Nov 12, 2026
@dodgeblaster
dodgeblaster force-pushed the fix/32005-host-name-spellings branch from 53373a4 to 710beac Compare November 12, 2026 07:16
@dodgeblaster

Copy link
Copy Markdown
Contributor Author
  • span=66cca0b42464 Joined-host matching makes bundle collection quadratic

fixed in 710beac: _joined_occurrences finds the short name's occurrences in one pass and checks each against the recorded prefixes by length, and a join keeps only the last 16 characters of the word in front (_JOIN_CONTEXT), so the lookup per occurrence is bounded and the pass is linear in the member.
Measured on the finding's input (entry<n>\fbox\n): 10,000 records went from 13.73 s to 0.03 s, and 20,000 take 0.07 s. Tests: test_every_one_of_many_distinct_joins_is_replaced, test_a_join_keeps_a_bounded_prefix_and_still_matches_after_a_long_word.

@dodgeblaster
dodgeblaster requested a review from a team as a code owner November 12, 2026 18:53
@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention readiness: passed Eligible automated validation passed for the current revision and removed readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention labels Nov 12, 2026
@KiroCrewCaptain

KiroCrewCaptain commented Nov 17, 2026 •

Copy link
Copy Markdown
Collaborator

Code change approver recommendation: A person should decide

Why: the decider thinks the change is probably fine but estimates a 15% chance that this change introduces a defect, above the 12% limit for approving on its own.

The host-name pass moves into a new module that matches against both the raw text and a decoded copy that maps each character back to its original position. Hidden-character joins are recorded before the credential scrub, and the replacement still runs after it, so redaction order is kept. I traced the offset mapping, the segment and escape rules, and the join detection against strip_hidden_unicode. Every spelling main replaced is still replaced, except an encoded letter right before a short name (Abox), which decodes to the word Abox, so not replacing it is arguably more correct. Each new spelling has a test that fails without the change, the existing host-name tests are unchanged, diagnostics.py gets shorter, and CI is green. No regression, leak or fail-open path found.

Tier: 2, held for a person: changes requested.

An automated recommendation, not a review: a maintainer still decides. It approves on its own only when the estimated chance of a defect is at most 12% and the change has at most 400 changed lines. Decider v3c (217fe607) · commit 5015b8e2f4 · 819 changed lines. If this recommendation is wrong, reply here: replies are how the approver is evaluated.

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this fix. The decoded view with original spans is a clean way to stop chasing spellings one by one. The review found one regression to fix before merge.

  1. src/kiro_crew/diagnostics_host_name.py:53: a short host name (under 6 characters, for example jane) right after a doubly-escaped \\n or \\t is no longer replaced. This is the usual shape of a tool result nested in JSON inside an ACP or protocol log, for example "text":"{\"stdout\": \"Linux\\njane\\n\"}" or "msg": "line\\tjane". _ENCODED reads \\ first as one escaped backslash, so the view sees \ followed by njane. _starts_segment then finds no segment start, and the Windows-path pass needs the name right after the backslash. So jane stays in a bundle meant for a public issue. On main, _replace_host_name replaces it through its \\(?:x..|u....|[A-Za-z]) alternative. We ran both versions on these inputs: main returns <host>, this head returns the input unchanged. Smallest fix: for short names, also count it as a segment start when the original text has an escaped backslash plus an escape letter, x.. or u.... right before the name (\\n, \\t, \\x1b, \\u001b). That restores main's reading, and over-redacting a rare path folder such as C:\\nbox is the safe direction for a privacy scrub. Please add a test with a doubly-escaped newline and tab before the name. If you prefer to keep the current reading on purpose, could you name this case in troubleshooting.md among the spellings that can remain?

Optional:

  • src/kiro_crew/docs/troubleshooting.md:32: the new list of names that can remain reads as complete, but some spellings still survive (for example double percent-encoding %2562ox or an HTML entity &#98;ox). A short catch-all clause such as "or a less common spelling of it" keeps the warning accurate.
  • src/kiro_crew/diagnostics_host_name.py:280: no test pins the raw-text pass for long names. With that line deleted, open D:\jane-laptop\logs now passes through unchanged and all tests stay green. A long-name Windows-path case would pin it.
  • src/kiro_crew/diagnostics_host_name.py:131: _is_stripped copies the hidden-character rule of strip_hidden_unicode. Calling strip_hidden_unicode on the matched run keeps one owner for that rule.

@github-actions github-actions Bot added readiness: action required A blocking check or review needs attention and removed readiness: passed Eligible automated validation passed for the current revision labels Nov 18, 2026
@dodgeblaster
dodgeblaster force-pushed the fix/32005-host-name-spellings branch from 7a41ad0 to 485036f Compare November 20, 2026 00:54
@dodgeblaster

Copy link
Copy Markdown
Contributor Author

Rebased onto main (7a41ad0 -> 9b2b67d) and fixed the review's regression in 485036f: a short host name right after a doubly serialized escape (\\n, \\t, \\x1b, \\u001b) is a segment start again, in the decoded view too, so \\n%6Aane is replaced. Over-replacing a path folder that starts like one is the safe direction. Tests: test_a_short_name_after_a_doubly_serialized_escape_is_replaced (nested stdout, tab, hex, unicode, percent-encoded, \u name) and test_a_long_name_in_a_raw_windows_path_is_replaced. troubleshooting.md now says a less common spelling can remain. Not done: reusing strip_hidden_unicode in _is_stripped, because that function decides by the neighbours of a character and a matched run has none.

@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: action required A blocking check or review needs attention and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Nov 20, 2026
The bundle replaced this machine's host name only where it appeared
literally. A short name joined onto a word by a hidden character the
credential scrub strips (boot<FF>box), a name behind a percent-encoded
byte (%2Fbox), a name with an escaped character (jane\u002dlaptop,
jane%2Dlaptop), a short name in a Windows path (C:\Users\box) and the
other IDNA spelling of the name all stayed readable in a bundle meant
for a public issue.

The host pass moves to diagnostics_host_name.py and matches on a
decoded view of the text in which \uXXXX, \xXX and %XX read as the
character they encode and every view character keeps its original
span. Joins are read from the member before the scrub, and the
replacement still runs after it, so a host name can never hide a
credential from its rule.

Names followed by -, _ or a digit, the domain after a short name, and
names from earlier boots are unchanged.

Fixes #32005
A tool result nested in a JSON log line writes a newline as two
backslashes and an n, which the decoded view reads as a backslash and
a name character, so a short host name right after it was kept. Count
a doubly serialized escape before the name as a segment start, as the
old literal matcher did, and pin the raw-text pass for long names.
The decoded view reads a nested JSON \\n as a backslash and a letter,
so a short host name that starts with an escape letter (or a one-letter
one) took the letter of the escape. Apply the same path test the raw
backslash pass uses, and stop a serialized backslash from counting as
the UNC marker of a path.
@dodgeblaster
dodgeblaster force-pushed the fix/32005-host-name-spellings branch from 7a0a8c8 to 5015b8e Compare November 20, 2026 02:39
@github-actions github-actions Bot added readiness: checking Automated validation is still running readiness: passed Eligible automated validation passed for the current revision and removed readiness: action required A blocking check or review needs attention readiness: checking Automated validation is still running labels Nov 20, 2026
@dodgeblaster

Copy link
Copy Markdown
Contributor Author

Correction to my earlier comment: it listed \\^[ among the doubly serialized escapes, but only \\n-style letters, \\xXX and \\uXXXX are handled; a caret-notation ESC is not. Final state on 5015b8e: the Opus finding on 485036f (a short name that starts with an escape letter, or a one-letter name, behind a nested \\n or \\t) is fixed in 7a0a8c8. A nested escape letter stays whole outside a Windows path, and a serialized backslash no longer counts as a UNC marker. Tests: test_a_doubly_serialized_escape_letter_is_not_taken_for_a_short_name and test_a_doubly_serialized_path_still_replaces_a_name_that_starts_like_an_escape. All checks are green; the Captain's CHANGES_REQUESTED review is on 7a41ad0 and needs a re-review.

@KiroCrewCaptain
KiroCrewCaptain enabled auto-merge (squash) November 20, 2026 04:09

@KiroCrewCaptain KiroCrewCaptain left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Re-review on 5015b8e. The earlier change request is resolved. The review read the full diff, ran the new tests and the host, scrub and bundle tests in test_diagnostics.py (all pass), checked that 47 of the new tests fail on the merge-base source, and ran a differential fuzz against main's _replace_host_name. The fuzz found no realistic spelling that main replaced and this head keeps.

Earlier items:

  1. Short name after a doubly serialized \\n or \\t: fixed. test_a_short_name_after_a_doubly_serialized_escape_is_replaced pins it, along with the doubly serialized escape-letter and path tests.
  • Optional, troubleshooting.md catch-all: fixed ("or a less common spelling of the name").
  • Optional, long-name Windows path test: fixed (test_a_long_name_in_a_raw_windows_path_is_replaced).
  • Optional, reuse strip_hidden_unicode: rebutted. That rule depends on a character's neighbours, and a matched run has none. The rebuttal holds.

Security: this rewrites masking logic, and it only widens what becomes <host>. Joined names are found on the raw text but replaced after the credential scrub, so a host name cannot hide a credential. test_a_joined_host_name_keeps_a_credential_redacted pins that order.

Done well: the decoded view keeps each character's original span, so one matcher covers escaped, percent-encoded and UTF-8/UTF-16 spellings. Before, the regex needed another branch for each spelling.

Optional:

  • diagnostics_host_name.py:392: deleting the \ before a non-escape letter hint reds no test, and the name then leaks in open .\logs\nas. A case such as ("open .\\logs\\nas", "open .\\logs\\<host>") would pin it.
  • diagnostics_host_name.py:137: on a member near the 4 MiB cap the pass runs 10 to 18 times slower than main. Skipping the _View build when a member has no encoded token or hidden character would avoid most of that.
  • The PR has three commits and the body ticks "At most two". The Proof line also still names head 7a41ad0. A squash merge settles the commit count.

@KiroCrewCaptain
KiroCrewCaptain merged commit be048db into main Nov 20, 2026
100 checks passed
@KiroCrewCaptain
KiroCrewCaptain deleted the fix/32005-host-name-spellings branch November 20, 2026 04:09
@github-actions github-actions Bot removed the readiness: passed Eligible automated validation passed for the current revision label Nov 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Diagnostics bundle: some spellings of the host name are not replaced

2 participants