[JENKINS-19429] SshSessionFactory.setInstance unnecessary

Aperta
#1,377 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
42/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
java
Ambito
api

Direzione di ricerca

Inizia da JGitAPIImpl e traccia il suo utilizzo di SshSessionFactory.setInstance, Transport.open, PushCommand e TransportCommand.setTransportConfigCallback. Verifica il comportamento con test_push o con i test di trasporto pertinenti; il lavoro è completato quando l’autenticazione SSH è configurata per ogni SshTransport senza modificare la factory JGit a livello di VM.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

component:git-client-plugin imported-jira-issue priority:critical resolution:unresolved

JGitAPIImpl. starts off by calling SshSessionFactory.setInstance(new TrileadSessionFactory()). This sets the VM-wide factory, which could be quite dangerous: it means that any other usage of JGit will not be using the standard logic in JschConfigSessionFactory to use ~/.ssh and so on.

Instead it should only set a TrileadSessionFactory directly using SshTransport.setSshSessionFactory when it calls Transport.open (and the result is an SshTransport). In some cases that is called directly; for PushCommand and similar uses that call Transport.open for you, it need only call TransportCommand.setTransportConfigCallback to configure an SshTransport with our authentication.

I can submit a pull request if you like—probably only JGitAPIImpl needs to be touched—though I am unsure how to test it. (I presume test_push does not push to a public server.)


Originally reported by jglick, imported from: SshSessionFactory.setInstance unnecessary
  • status: Open
  • priority: Critical
  • component(s): git-client-plugin
  • resolution: Unresolved
  • votes: 1
  • watchers: 3
  • imported: 20251211-071809
Raw content of original issue

JGitAPIImpl.<init> starts off by calling SshSessionFactory.setInstance(new TrileadSessionFactory()). This sets the VM-wide factory, which could be quite dangerous: it means that any other usage of JGit will not be using the standard logic in JschConfigSessionFactory to use ~/.ssh and so on.

Instead it should only set a TrileadSessionFactory directly using SshTransport.setSshSessionFactory when it calls Transport.open (and the result is an SshTransport). In some cases that is called directly; for PushCommand and similar uses that call Transport.open for you, it need only call TransportCommand.setTransportConfigCallback to configure an SshTransport with our authentication.

I can submit a pull request if you like—probably only JGitAPIImpl needs to be touched—though I am unsure how to test it. (I presume test_push does not push to a public server.)

Lingua principale
Java
Stelle
152
Fork
404
Merge medio
2g 7h
PR unite (30g)
5

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di jenkinsci/git-client-plugin

Tutte le issue di jenkinsci/git-client-plugin

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.