Skip to content

fix(signing): redact scp-style remote credentials with a capitalized user - #3330

Merged
rudrankriyam merged 4 commits into
rorkai:mainfrom
kevin9327:fix/redact-capitalized-scp-remote
Nov 3, 2026
Merged

rudrankriyam merged 4 commits into
rorkai:mainfrom
kevin9327:fix/redact-capitalized-scp-remote

Conversation

@kevin9327

Copy link
Copy Markdown
Contributor

Summary

RedactRepoURL (used for signing repo remotes in errors, diagnostics and structured output) decided whether the URL sanitizer had replaced userinfo by checking sanitized != trimmed. That check also fires when net/url only re-renders the text. An scp-style remote with credentials and a capitalized user, for example

Deploy:[email protected]:team/certs.git

parses as an opaque URL with scheme deploy. The sanitizer sees no User, and String() only lowercases the scheme, so the result differs from the input and is returned as is:

RedactRepoURL("Deploy:[email protected]:team/certs.git") = "deploy:[email protected]:team/certs.git"

The token stays in the output. The lowercase form (user:secret@...) is already covered by a test and works only because the text happens to round-trip unchanged.

Fix

Use the URL sanitizer only when net/url found an authority (Host != "", no Opaque), which is the case where it can see and replace userinfo. Everything else (scp-style remotes, unparseable userinfo, local paths) goes to the existing redactRemoteUserinfo fallback. Outputs for all existing test cases are unchanged.

Tests

  • New case in TestRedactRepoURLRemovesCredentials: Deploy:[email protected]:team/certs.git must become [REDACTED]@github.com:team/certs.git. It fails on main with the output above and passes with the fix.
  • ASC_BYPASS_KEYCHAIN=1 go test ./internal/signing ./internal/cli/signing passes; go vet ./internal/signing and gofmt are clean.

AI assistance: I used an AI assistant to help find this and write the change; I checked the behavior and ran the tests above.

…user

RedactRepoURL treated any change made by the URL sanitizer as proof that
userinfo had been replaced. An scp-style remote such as
Deploy:[email protected]:team/certs.git parses as an opaque URL with
scheme "deploy"; rendering it only lowercases that scheme, so the token
was returned unredacted. Only trust the sanitizer when net/url found an
authority, and fall back to the scp-aware redaction otherwise.

Assisted-by: AI (Grok Bot)
@mintlify

mintlify Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Preview approval required

This pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit 8e4ba71.

Approve preview

@rudrankriyam rudrankriyam added this to the 6.4.0 milestone Nov 3, 2026
@rudrankriyam
rudrankriyam merged commit a00603d into rorkai:main Nov 3, 2026
28 checks passed
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.

2 participants