Skip to content

fix(diagnostics): consolidate host, credential, and quota label redaction - #5538

Closed
luvs01 wants to merge 9 commits into
devfrom
stack/diagnostics-redaction
Closed

luvs01 wants to merge 9 commits into
devfrom
stack/diagnostics-redaction

Conversation

@luvs01

@luvs01 luvs01 commented Sep 22, 2026

Copy link
Copy Markdown
Collaborator

Summary

Consolidate #5475, #5427, #5414, and #5463 into one diagnostic-output privacy change, preserving all eight original contribution and review-follow-up commits.

  • Redact host destinations in socket/connect failure diagnostics while preserving ordinary explanatory prose and sentence punctuation.
  • Identify invalid credential groups by group/member position, keeping operator-supplied identifiers out of configuration warnings.
  • Mask credentials in displayed proxy URLs while keeping non-secret routing information readable.
  • Publish only canonical Anthropic model quota labels; drop unrecognized upstream display names and remove terminal controls before classification.

Update the corresponding runtime contracts. This changes diagnostic rendering and validation messages; it does not broaden authentication or alter routing decisions. No GUI change.

Verification

  • Base: dev a5e8047b5e2b6248b1e85a08dfcc5b1c414c6236. Final head: 62c677c05d880a5c231bb4efd35b7f8bb637d16f.
  • bun scripts/test.ts --changed=a5e8047b5e2b6248b1e85a08dfcc5b1c414c6236 with explicit identity-domain, Lab sanitizer, degraded-config, CLI config, and quota-label test files: 85 passed, 0 failed, 376 assertions. The existing GUI dependencies were checked before invoking the wrapper; no dependency installation occurred.
  • Direct focused run additionally passed the layout/tooling tests. Its repository ratchet test exceeded the default 5-second test budget; a separate bun scripts/file-size-ratchet.ts completed successfully with no offenders. No source timeout, file-size limit, or baseline was changed.
  • bun run typecheck, bun run structure:check, bun run privacy:scan, and git diff --check passed. The final documentation-only follow-up passed structure and whitespace checks again.
  • Reviewed the four source PRs' review threads; no unresolved threads remained at preparation time. Merge-only source commits contained no additional combined diff and were not duplicated.
  • Full suite, exact-head cross-platform CI, and independent security review remain pending. This PR stays draft.

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults.

luvs01 and others added 9 commits September 22, 2026 20:24
…nect-to failures

Combines three fork PRs into one change on current dev: bare destinations after resolver/socket markers are redacted only where grammar proves the position (sole argument or after 'lookup'), connect-to failures redact the bare target when a failure term follows, and rewrites splice at the tail offset so a marker word that repeats the destination cannot take the [host] itself.

bun test tests/lab/lab-evidence-sanitization.test.ts: 31 pass

(cherry picked from commit 69990d9)
Classify the token without its trailing period and leave the period outside the mask: ECONNREFUSED redis. -> ECONNREFUSED [host]. Previously the punctuation defeated host classification and leaked the destination.

(cherry picked from commit a74038c)
…iers in credentialGroups diagnostics

(cherry picked from commit 0354bd9)
Mask only credential-bearing proxy URLs (userinfo stripped via redactUrlForLog, host/port kept); direct and credential-less values print unchanged. Clarify that config export stays raw for restore.

(cherry picked from commit acdbb1c)
Per review on #5463: stripping terminal control characters still left attacker-chosen residue on the quota line. parseClaudeLimit now returns null unless the name reduces to a recognized model (Fable, Opus, Sonnet); the test asserts the residue is not emitted and adds a recognized-name positive case.

(cherry picked from commit a9a6bac)
@coderabbitai

coderabbitai Bot commented Sep 22, 2026

Copy link
Copy Markdown
Contributor

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@lidge-jun

Copy link
Copy Markdown
Owner

리뷰 · 우선순위 46 / 80

이 PR은 진단·설정 출력에 남을 수 있는 민감 정보를 네 갈래로 한꺼번에 줄입니다. Lab 증거 문장에서는 소켓·해석 오류 뒤의 호스트만 [host]로 가리고, 설명 문장(ETIMEDOUT while waiting…)은 그대로 둡니다. credentialGroups 경고는 그룹·멤버 위치 번호만 말하고, 운영자가 넣은 id·자격 증명 문자열은 내지 않습니다. ocx config show/get/set은 프록시 URL에 아이디·비밀번호가 있을 때만 그 부분만 가리고, direct나 인증 없는 주소는 읽기 좋게 둡니다. Anthropic 할당량 줄에는 Fable·Opus·Sonnet 이름만 남기고, 이상한 display_name은 창 자체를 버립니다. 베이스는 dev입니다. #5475·#5427·#5414·#5463을 한 PR로 모았고, 그 원본들은 이미 닫혀 있습니다. 드래프트이고 본문 보안 체크는 아직 비어 있으며, 전체 CI·보안 리뷰는 본문 기준 대기 중입니다.

src/providers/quota/vendor-probes-oauth.ts:parseClaudeLimit - 모델 이름은 includes("fable"|"opus"|"sonnet")로 고릅니다. 통제 문자를 지운 뒤에도 이름 한가운데에 이 조각이 있으면 정식 라벨로 바꿔 창을 붙입니다. 반대로 Haiku처럼 목록에 없는 이름은 퍼센트까지 같이 사라집니다.

src/cli/config-command.ts:redact(proxy) - 인증 있는 프록시는 redactUrlForLog를 씁니다. 이 함수는 userinfo뿐 아니라 query·hash도 지웁니다. 호스트·포트는 남지만, 쿼리에 라우팅 힌트만 있던 값은 show/get에서 짧아집니다. config export는 복원용으로 원문을 그대로 씁니다.

src/routing/identity-domains.ts:credentialGroupIssues - 경고가 group index·member index만 말합니다. 비밀은 안 새지만, 그룹이 많으면 운영자가 설정을 세며 찾아야 합니다.

src/lab/artifacts/sanitize.ts - connect to … failed 같은 실패 문장은 이제 맨 호스트를 가립니다. 예전 문서의 “가리지 않음”과 반대입니다. 테스트·structure 문서는 맞춰 두었습니다.

메인테이너의 판단이 필요한 지점
할당량에서 미인식 라벨을 통째로 버릴지, 퍼센트만 이름 없이 남길지입니다. 프록시 export가 자격 증명을 파일에 그대로 쓰는 현재 복원 계약을 유지할지도 확인이 필요합니다. 그룹 경고를 번호만으로 둘지, 안전한 짧은 지문(해시 앞자리 등)을 붙일지도 운영 편의와 맞바꿔 보면 좋습니다. 드래프트·체크리스트·전체 스위트·독립 보안 리뷰는 본문이 아직 미완으로 적혀 있습니다.

너의 추천
의도한 네 갈래 경계는 테스트가 잘 고정하고 있으니, 머지 전에 Haiku 등 미등재 모델 창을 버려도 되는지와 export 원문 유지 여부만 한 줄로 확정하세요. includes 매칭이 너무 넓다고 보면 단어 경계나 허용 목록으로 좁히면 됩니다. 열려 있는 중복 PR은 없습니다. 베이스 dev는 맞습니다. CI와 보안 체크가 끝난 뒤 드래프트를 풀면 됩니다.

이 댓글은 grok-bot이 작성했습니다

@github-actions

Copy link
Copy Markdown
Contributor

✅ Deterministic PR hygiene checks passed.

lidge-jun added a commit that referenced this pull request Sep 22, 2026
…c and config output (#5573)

* fix(lab): combine host-redaction hardening for socket markers and connect-to failures

Combines three fork PRs into one change on current dev: bare destinations after resolver/socket markers are redacted only where grammar proves the position (sole argument or after 'lookup'), connect-to failures redact the bare target when a failure term follows, and rewrites splice at the tail offset so a marker word that repeats the destination cannot take the [host] itself.

bun test tests/lab/lab-evidence-sanitization.test.ts: 31 pass

(cherry picked from commit 69990d9)

Source: #5538 commit b90139f

Co-authored-by: luvs01 <27862058+luvs01@users.noreply.github.com>

* fix(lab): redact socket destinations carrying a sentence-final period

Classify the token without its trailing period and leave the period outside the mask: ECONNREFUSED redis. -> ECONNREFUSED [host]. Previously the punctuation defeated host classification and leaked the destination.

(cherry picked from commit a74038c)

Source: #5538 commit d8042a5

Co-authored-by: luvs01 <27862058+luvs01@users.noreply.github.com>

* fix(config): avoid logging operator-supplied credential/group identifiers in credentialGroups diagnostics

(cherry picked from commit 0354bd9)

Source: #5538 commit fc57a55

Co-authored-by: luvs01 <27862058+luvs01@users.noreply.github.com>

* fix(config): align comments with indexed messages and cover every issue shape

(cherry picked from commit f8a67b3)

Source: #5538 commit 038c0fa

Co-authored-by: luvs01 <27862058+luvs01@users.noreply.github.com>

* fix(cli): redact proxy credentials in config output

(cherry picked from commit 73946f3)

Source: #5538 commit b31732a

Co-authored-by: luvs01 <27862058+luvs01@users.noreply.github.com>

* fix(cli): keep non-secret proxy values readable in config output

Mask only credential-bearing proxy URLs (userinfo stripped via redactUrlForLog, host/port kept); direct and credential-less values print unchanged. Clarify that config export stays raw for restore.

(cherry picked from commit acdbb1c)

Source: #5538 commit dc4d273

Co-authored-by: luvs01 <27862058+luvs01@users.noreply.github.com>

* fix(quota): sanitize Anthropic quota labels

(cherry picked from commit ee716bf)

Source: #5538 commit 4a04458

Co-authored-by: luvs01 <27862058+luvs01@users.noreply.github.com>

* fix(quota): drop unrecognized Anthropic display_name from quota labels

Per review on #5463: stripping terminal control characters still left attacker-chosen residue on the quota line. parseClaudeLimit now returns null unless the name reduces to a recognized model (Fable, Opus, Sonnet); the test asserts the residue is not emitted and adds a recognized-name positive case.

(cherry picked from commit a9a6bac)

Source: #5538 commit aaffe75

Co-authored-by: luvs01 <27862058+luvs01@users.noreply.github.com>

* docs(providers): state canonical quota label boundary

Source: #5538 commit 62c677c

Co-authored-by: luvs01 <27862058+luvs01@users.noreply.github.com>

* fix(diagnostics): preserve redaction across path aliases and resolver prose

Use normalized config keys for get and mutation output. Preserve direct
resolver destinations when explanatory text follows, while retaining socket
prose exclusions. Add focused regressions and align output contracts.

Co-authored-by: luvs01 <27862058+luvs01@users.noreply.github.com>

* docs(structure): keep runtime doc within its line budget

---------

Co-authored-by: luvs01 <27862058+luvs01@users.noreply.github.com>
Co-authored-by: Epinephrine <luvs01@hanmail.net>
@lidge-jun

Copy link
Copy Markdown
Owner

Landed in #5573 (squash d30d120), thank you @luvs01. Every commit from this PR was carried onto current dev with your authorship preserved, and the squash credits you as co-author.

The carry also adds two small repairs found in review: ocx config get/set now redact by the normalized path, so aliases such as a trailing space or dot keep the proxy credentials masked, and a bare destination directly after ENOTFOUND, EAI_AGAIN, or host= stays redacted when explanatory text follows it. Nothing from this PR remains outstanding, so I'm closing it as superseded.

@lidge-jun lidge-jun closed this Sep 22, 2026
@lidge-jun
lidge-jun deleted the stack/diagnostics-redaction branch September 26, 2026 01:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants