Skip to content

fix(cli): archive diagnostics redact the store URL - #9119

Merged
kixelated merged 2 commits into
mainfrom
quest/m1/precut-fixes/archive-url-logs
Nov 18, 2026
Merged

kixelated merged 2 commits into
mainfrom
quest/m1/precut-fixes/archive-url-logs

Conversation

@kixelated

@kixelated kixelated commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

Finishes quest/m1/precut-fixes/archive-url-logs.md and deletes it.

Summary

export archive and import archive printed the raw store URL, userinfo and query included, in their INFO lines (recording, replaying) and in their error contexts (no readable recording at, replaying ... failed, unsupported archive store). object_store's own errors (Unable to recognise URL "...", URL did not match any known pattern, Unable parse source url) also quote the exact URL string they were handed, so a redacted context alone still leaked through the chain.

  • Every store URL in logs and error contexts goes through moq_tokio::RedactedUrl.
  • open_store replaces the raw URL with its redacted form throughout object_store's error chain.
  • open_store refuses a store URL with a password, query, or fragment before anything else sees it. No object_store builder reads them, so they were silently ignored before; now the error says to pass credentials through the environment. A bare username stays allowed, since Azure reads it as the container (abfs://container@account.dfs.core.windows.net).
  • doc/bin/cli.md says so.

Decisions

  • Refusing a password, query, or fragment is new behavior (fail loud instead of silently ignoring). The alternative was redaction only. I chose refusal because they never reached the store, so a user who put a key there was already misconfigured.

Public API

None. CLI behavior change: export archive / import archive reject a store URL carrying a password, query, or fragment.

Validation

  • New unit test a_refused_store_hides_its_credentials: each of s3://user:SECRET@bucket/prefix, file:///rec?token=SECRET, file:///rec#SECRET, ftp://SECRET@example.com/rec, https://SECRET@example.com/rec, and (with azure) az://SECRET@account.example.com/rec fails to open with neither {:#} nor {:?} containing SECRET, and naming the redacted URL. Mutation check: dropping the scrub fails it with Unable to recognise URL "ftp://SECRET@example.com/rec".
  • Real binary against a local moq-relay, with dummy AWS_* credentials:
    • export archive s3://SECRET@bucket/prefix logs recording prefix=ev store=s3://bucket/prefix.
    • import archive s3://SECRET@bucket/prefix/ev/@x fails with no readable recording at s3://bucket/prefix/ev/@x (403 from S3).
    • export/import with ?token=SECRET or user:SECRET@ exit with the refusal, which names only the redacted URL. With ftp://SECRET@example.com/rec, the cause reads Unable to recognise URL "ftp://example.com/rec".
    • grep SECRET over every captured log: no matches.
  • cargo test -p moq-cli --bin moq archive:: (11 pass), just check passes.

Caused by

Follow-ups

None.

Models

Size: S
Implementer: Claude Code, claude-opus-5-5, medium effort

(Written by Claude Opus 5.5 with medium)

Review

Rewritten by quest review after each round.

  • Head: 8ca1a08

  • Base: origin/main at a7e327b

  • Risk: medium, the base has no RISK.md to name what is always high or customer-facing, so every change is medium

  • Classified: medium by default

  • Reviewer: Codex, gpt-6.1-sol, medium effort

  • Session: 01a1f0b7-bcd6-7862-96cf-c60ad29dfa53, round 1

  • Score: 9/10, Source review found no blocking issues or behavioral regressions, but builds and tests were not run as instructed.

  • Rounds: 1; first round 0; findings 0: fixed 0, refuted 0, open 0

  • Findings: none

kixelated and others added 2 commits November 18, 2026 14:04
Recording and replay logged the raw store URL at INFO, and opening a store
quoted it in errors, along with object_store's own messages, which echo the
URL they were given. Log every store URL through moq_tokio::RedactedUrl,
scrub the raw URL out of object_store's error chain, and refuse a password,
query, or fragment in the URL, which no store reads.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated kixelated changed the title Redact store credentials in archive diagnostics fix(cli): archive diagnostics redact the store URL Nov 18, 2026
@kixelated
kixelated marked this pull request as ready for review November 18, 2026 22:13

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ No new issues found.

Approach: sound. Refusing the password, query, and fragment up front is the right place for the policy, since no object_store builder reads them. The string scrub of object_store's error chain covers the one remaining leak, a bare username that the parser or builder echoes back.

Reviewed changes

This review covers the full PR: archive store URL redaction in rs/moq-cli/src/archive.rs and its documentation.

  • Redacted logs and contexts: the recording and replaying INFO lines and the no readable recording at / replaying ... failed contexts now format through RedactedUrl.
  • Up-front refusal in open_store: a store URL with a password, query, or fragment fails before object_store sees it. A bare username is still allowed, so Azure's abfs://container@account form keeps working.
  • Scrubbed object_store errors: errors from ObjectStoreScheme::parse and from the S3, GCS, and Azure build() calls are flattened and have the raw URL replaced with its redacted form. They are then wrapped as unsupported archive store {redacted}.
  • Test: a_refused_store_hides_its_credentials checks both {:#} and {:?} for every refusal path, including object_store's own Unable to recognise URL message.
  • Docs: doc/bin/cli.md documents the refusal and the redaction.

Pullfrog  | View workflow run | Using claude-opus-5-5 | 𝕏

@kixelated
kixelated added this pull request to the merge queue Nov 18, 2026
@coderabbitai

coderabbitai Bot commented Nov 18, 2026

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Archive store opening now rejects URLs that contain a password, query, or fragment. Export and import logs and errors use redacted URLs. Error handling sanitizes URLs in object-store parsing and cloud builder failures. Tests check that selected failure messages do not expose credentials. The CLI documentation describes these URL rules.

Merge Risk: Minimal · up to 8ca1a

Archive export and import now refuse URLs with a password, query, or fragment and print redacted store URLs in logs and errors. No remaining merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: archive diagnostics (export/import archive logs and errors) now redact the store URL. It matches the changeset in rs/moq-cli/src/archive.rs and the PR objectives, and …
Description check Passed The description is directly related to the changeset. It explains that export and import archive printed raw store URLs in INFO lines and error contexts, and it describes the RedactedUrl use, the new …
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the main change: archive diagnostics (export/import archive logs and errors) now redact the store URL. It matches the changeset in rs/moq-cli/src/archive.rs and the PR objectives, and it follows the conventional commit style. The title does not mention the new refusal of URLs with a password, query, or fragment, but that is a secondary detail.

Full details: Description check

Explanation

The description is directly related to the changeset. It explains that export and import archive printed raw store URLs in INFO lines and error contexts, and it describes the RedactedUrl use, the new refusal of URLs with a password, query, or fragment, the doc/bin/cli.md update, the deleted quest document, and the validation steps. It is detailed and specific.

Finishing Touches

Simplify code

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

Recent review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 3cf254b9-1ca7-4a37-bcb6-cbb4e5ba9c16
Commits

Reviewing files that changed from the base of the PR and between f1df3c3 and 8ca1a08.

Files selected for processing: 3

  • doc/bin/cli.md
  • quest/m1/precut-fixes/archive-url-logs.md
  • rs/moq-cli/src/archive.rs
Files with no reviewable changes: 1

  • quest/m1/precut-fixes/archive-url-logs.md

Included review availability: This review used your included allowance. Your plan provides up to 4 included reviews per hour; 2 remain after this review.

Merged via the queue into main with commit 4c8af4c Nov 18, 2026
10 checks passed
@kixelated
kixelated deleted the quest/m1/precut-fixes/archive-url-logs branch November 18, 2026 22:20
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.

1 participant