Skip to content

HTTP vs SSH and download URLs #341

Closed

Description

@catphish

When a request is made via HTTP to download a file, a request is made to GET /REPO/objects/OID and a hypermedia link is returned, eg: {"download": { "href": "https://some-download.com" } }. This is awesome.

However, when a request is made by SSH, despite the request containing the same information: git-lfs-authenticate REPO download OID, the response seems to be totally different, a link to the root of the repository, on which an additional, seemingly unnecessary request is made for the hypermedia information.

I would very much like to be able to return the {"download": { "href": "https://some-download.com" } } information directly from SSH. Is this possible? If not, it seems like an additional authentication mechanism will be needed for the intermediate HTTP request since we don't have the user's HTTP password.

Thanks! I hope I'm just missing something simple,

Activity

  1. technoweenie commented on May 27, 2015

    @technoweenie
    Contributor

    It really depends on your SSH server setup, and whether it can access that data. I think adding the capability would be great though.

  2. catphish commented on May 27, 2015

    @catphish
    ContributorAuthor

    My SSH server does have access to the upload / download URLs. In my case these are authenticated by one-time-password generated by the SSH or HTTP server, so it would be great if the SSH server could direct them in the same way the HTTP server does.

    Unfortunately what my SSH server doesn't have is the end user's password to assist them in authenticating the HTTP version of the repository. Obviously having to ask the user for their password once they've authenticated by SSH key is less than ideal.

    I don't know if I have the necessary skill in Go to implement this feature myself but I'll take a look.

  3. catphish commented on May 28, 2015

    @catphish
    ContributorAuthor

    I briefly tried to implement this, but due to the API of newApiRequest, this will require more changes to the flow of the program than I'm comfortable making.

    I'd very much appreciate it if there's anything you could do here. My proposed API (including backward compatibility with Github's) would look like this:

    type sshAuthResponse struct {
        Message   string            `json:"-"`
        Href      string            `json:"href"`
        Header    map[string]string `json:"header"`
        Download  linkRelation      `json:"download"`
        Upload    linkRelation      `json:"upload"`
        ExpiresAt string            `json:"expires_at"`
    }
    

    This would allow SSH to respond either with a base HTTP URL (as per the current API), or with a direct Upload or Download link (IMO more efficient).

  4. technoweenie commented on May 28, 2015

    @technoweenie
    Contributor

    Unfortunately what my SSH server doesn't have is the end user's password to assist them in authenticating the HTTP version of the repository. Obviously having to ask the user for their password once they've authenticated by SSH key is less than ideal.

    That seems to defeat the purpose.

    That schema looks good. Though, it's missing an optional Verify link relation.

    Also, this may not even be needed, since we're moving towards a bulk api: #285

  5. catphish commented on May 28, 2015

    @catphish
    ContributorAuthor

    Doing this in bulk makes a lot more sense to me. I'm happy to skip straight to the bulk API if it's coming soon.

    I think there's some confusion in my mind about how each part of the process should be authenticated, and how closely tied the Git Server and LFS API should be.

    In the case of HTTP, the LFS API is essentially part of the Git server, authenticated using the same credentials as Git, and immediately returning media URLs. Whereas when using SSH, the LFS API becomes detached from the Git Server, requiring separate authentication. This is something I was looking to avoid.

    I hope this makes some sense.

  6. technoweenie commented on May 28, 2015

    @technoweenie
    Contributor

    There are two big goals with Git LFS:

    1. Reuse existing Git authentication over SSH or HTTP.
    2. Support multiple storage backends. This is why the link relations specify both a URL and a list of header keys and values.

    Whatever is generating the link (the Git LFS HTTP server, or the SSH command as you suggest) should be able to generate a URL and header to download or upload the object from the storage backend. It's not necessary, but otherwise users will be prompted for a user and pass for the storage backend's domain.

  7. catphish commented on May 28, 2015

    @catphish
    ContributorAuthor

    That's great, this is exactly what I was hoping for.

    I'd really appreciate it if the protocol could be extended so that all metadata could be transferred by SSH rather than having the extra HTTP step between SSH and the final Upload/Download URL.

    As you say, it might be better to do this alongside the bulk API, as this seems much more efficient.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions