ruby / ruby/rubygems

Dependency confusion can still happen when using scoped gem servers that don't implement a dependency API

Open
#4,694 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bundler status: confirmed
Dominant language
Ruby
Stars
4k
Forks
1.9k
Avg merge
1d 2h
Merged PRs (30d)
81

Description

Describe the problem as clearly as you can

Following up on my successful test backport (#4687), I've tried to run the test[*] with Bundler 2.2.20 and Bundler 2.2.21 (but maybe in not in a very smart way). The test fails, although it was supposed to be fixed.

This was prompted with a failing shell reproducer, from one of my collegues, which AFAICT is doing exactly the same thing, as in the Bundler test, but it is failing with Bundler 2.2.18+.

[*] Test name: bundle install with gems on multiple sources with source affinity when a top-level gem has an indirect dependency and the dependency is in both the top-level and a pinned source installs the dependency from the top-level source without warning

Post steps to reproduce the problem

I've taken Ruby 2.7.3 sources, and replaced the Bundler in them with Bundler 2.20.21. Then I've run the backported test:

https://gist.github.com/08e9423766b83a8fb0e5e1a64fa4ca74

Additional

Is there something I'm doing wrong, or is the test really failing?

I've run the test test from rubygems git repository as well, and it did succeed (with Ruby 2.7), although I had to do a workaround to make it work.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the named Bundler test, “bundle install with gems on multiple sources with source affinity,” and reproduce it using Bundler 2.2.20 and 2.2.21 as described. Compare its behavior with the linked shell reproducer and RubyGems test; the work is done when the scoped-source dependency case is consistently handled without dependency confusion.

Written by the indexing model from the issue text.

Assessment

Tech stack
ruby
Domain
security
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.