libgit2 / libgit2/rugged

credentials callback not returning credentials causes a segmentation fault

Open
#625 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
2.3k
Forks
293
PR merge metrics
No merged PRs in 30d

Description

require 'rugged'

def credentials
  lambda do |_, _, _|
    return nil
  end
end

Rugged::Repository.clone_at 'https://github.com/example/my-project.git', 'my-project' , { credentials: credentials }

Calling clone_at with a credentials callback that returns nil against a repository that requires authentication causes a segmentation fault. When on_headers_complete tries to dereference t->cred->credtype (http.c:379) and t->cred is empty the segfault is triggered.

Contributor guide

No contributing guide indexed for this repository

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 Ruby reproduction using Rugged::Repository.clone_at and a credentials callback returning nil. Inspect on_headers_complete at http.c:379, focusing on the empty t->cred case, and verify that cloning against an authentication-required repository no longer segfaults.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, git, ruby
Domain
authentication, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.