fix(curl-import): preserve colons in basic-auth password#8206
fix(curl-import): preserve colons in basic-auth password#8206drooph0904 wants to merge 1 commit into
Conversation
When importing a cURL command with `-u user:password`, the password was
truncated at the first colon. `setAuth()` split the value on every colon
and kept only the first two parts:
const [username, password] = value.split(':')
curl splits the `-u` value on the FIRST colon only — the password may
itself contain colons (e.g. tokens, base64). This matches that behavior
by locating the first colon and slicing around it, so the full password
is preserved.
Added data-driven regression tests covering an embedded colon, the
`--user` long-form alias, and leading/trailing colons.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
WalkthroughThe PR fixes cURL import to preserve colons in basic-auth passwords by splitting on only the first colon instead of all colons. ChangesBasic-auth credential parsing
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Description
Fixes #8205.
When importing a cURL command with
-u user:password, Bruno truncated the password at the first colon becausesetAuth()split on every colon and destructured only the first two parts:curl splits the
-uvalue on the first colon only — the password may itself contain colons (e.g. tokens, base64). This change matches that behavior by finding the first colon and slicing around it:The
separatorIndex === -1branch preserves existing behavior for-u usernamewith no colon (password becomes'').Added data-driven regression tests covering an embedded colon, the
--userlong-form alias, and leading/trailing colons. Allparse-curltests pass (55/55).Contribution Checklist:
🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Tests