Skip to content

Fix Bundler credentials for usernames containing '@' - #585

Merged
udaykb2 merged 4 commits into
jfrog:mainfrom
laurenverity:fix/ruby-bundle-credentials-escape
Nov 12, 2026
Merged

udaykb2 merged 4 commits into
jfrog:mainfrom
laurenverity:fix/ruby-bundle-credentials-escape

Conversation

@laurenverity

@laurenverity laurenverity commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Problem

jf ruby bundle fails when the configured username contains @, which is the normal case for email-style Artifactory usernames. Bundler can't apply the credential the CLI passes it, because setting it as the source URI's userinfo raises:

URI::InvalidComponentError: bad component(expected userinfo component or user component): jane@example.com

Fix

Adds ruby.BundleCredential, which percent-encodes the username and password separately and uses it for both the injected env var and the config entry created in setup.

Testing

Added new tests that cover both cases.

  • All tests passed. If this feature is not already covered by the tests, I added new tests.
  • All static analysis checks passed.
  • Appropriate label is added to auto generate release notes.
  • I used gofmt for formatting the code before submitting the pull request.
  • PR description is clear and concise, and it includes the proposed solution/fix.

Summary by CodeRabbit

  • Bug Fixes
    • Ruby Bundler credentials now safely encode usernames and passwords containing spaces or reserved characters, including email-style usernames. This helps prevent special characters from being misinterpreted during authentication. Empty usernames are also handled by the credential encoding.

@coderabbitai

coderabbitai Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Walkthrough

Bundler credentials now use a shared helper that percent-encodes usernames and passwords separately. Ruby auth injection and Ruby setup use the helper, and tests cover encoded credentials.

Changes: Bundler Credential Encoding

Layer / File(s) Summary
Credential helper and auth injection
artifactory/commands/ruby/native_ruby.go, artifactory/commands/ruby/native_ruby_test.go
BundleCredential percent-encodes usernames and passwords separately and replaces + with %20 for spaces. Ruby auth injection uses the helper. Tests cover reserved characters, spaces, empty usernames, and email-style usernames.
Ruby setup integration
artifactory/commands/setup/setup.go, artifactory/commands/setup/setup_test.go
Ruby setup uses BundleCredential for per-host Bundler credentials. A test checks the encoded email username and password.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested labels: bug

Merge Risk: Minimal · up to dc89c

No actionable merge-blocking risk is established for this credential-encoding change; it is mergeable with normal checks.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: fixing Bundler credentials for usernames that contain '@'.
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.
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
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; Enforced overrides: Organization, Workspace
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 4007e997-ce3c-4e71-8629-493097565af3
Commits

Reviewing files that changed from the base of the PR and between 30c80a7 and dc89cef.

Files selected for processing: 4

  • artifactory/commands/ruby/native_ruby.go
  • artifactory/commands/ruby/native_ruby_test.go
  • artifactory/commands/setup/setup.go
  • artifactory/commands/setup/setup_test.go

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

@github-actions

github-actions Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@laurenverity

Copy link
Copy Markdown
Contributor Author

I have read the CLA Document and I hereby sign the CLA

Bundler assigns a BUNDLE_<HOST> credential to the source URI's userinfo
and decodes each part with CGI.unescape, so a raw '@' (e.g. an email
username) is rejected with URI::InvalidComponentError. Percent-encode the
username and password both where `jf ruby bundle` injects the env var and
where `jf setup` writes ~/.bundle/config.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@laurenverity
laurenverity force-pushed the fix/ruby-bundle-credentials-escape branch from 9974036 to dc89cef Compare November 3, 2026 23:08
@laurenverity
laurenverity marked this pull request as ready for review November 3, 2026 23:08
@udaykb2 udaykb2 added the safe to test Approve running integration tests on a pull request label Nov 5, 2026
@github-actions github-actions Bot removed the safe to test Approve running integration tests on a pull request label Nov 5, 2026
@udaykb2

udaykb2 commented Nov 6, 2026

Copy link
Copy Markdown
Contributor

Hi @laurenverity , thank you for your contribution.

Instead of creating the PR from a fork, could you create it from a branch of this repository? We cannot run the CLI integration tests from a PR that comes from a fork.

@laurenverity

Copy link
Copy Markdown
Contributor Author

Hi @laurenverity , thank you for your contribution.

Instead of creating the PR from a fork, could you create it from a branch of this repository? We cannot run the CLI integration tests from a PR that comes from a fork.

Hi @udaykb2! Unfortunately I cannot push a branch due to not having appropriate permissions on this repo, it seems. What should I do in light of that?

@udaykb2 udaykb2 added the bug Something isn't working label Nov 11, 2026
@udaykb2

udaykb2 commented Nov 12, 2026 •

Copy link
Copy Markdown
Contributor

Hi @laurenverity , I ran integration tests on this PR. These changes will be available in upcoming CLI release (probably by next week).

@github-actions

Copy link
Copy Markdown
Contributor

👍 Frogbot scanned this pull request and did not find any new security issues.


@udaykb2
udaykb2 merged commit 864a08c into jfrog:main Nov 12, 2026
12 checks passed

This branch was successfully deployed

1 active deployment
frogbot — d715d124 Deployed Nov 12, 2026 by udaykb2 via scan-pull-request #2042
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.

3 participants