Skip to content

Commit

Permalink
Improve the message when insecure HTTP repositories are detected.
Browse files Browse the repository at this point in the history
We can at least emit the URL of the repository and the path of the
resource which was attempted.

Fixes #2391.
  • Loading branch information
technomancy committed Feb 21, 2018
1 parent 694691f commit cc44d42
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions leiningen-core/src/leiningen/core/main.clj
Original file line number Diff line number Diff line change
Expand Up @@ -416,9 +416,22 @@ Get the latest version of Leiningen at https://leiningen.org or by executing
(project/init-project)))

(defn- insecure-http-abort [& _]
(abort "Tried to use insecure HTTP repository without TLS.
This is almost certainly a mistake; however in rare cases where it's
intentional please see `lein help faq` for details."))
(let [repo (promise)]
(reify org.apache.maven.wagon.Wagon
(getRepository [this])
(setTimeout [this _])
(setInteractive [this _])
(addTransferListener [this _])
(^void connect [this
^org.apache.maven.wagon.repository.Repository the-repo
^org.apache.maven.wagon.authentication.AuthenticationInfo _
^org.apache.maven.wagon.proxy.ProxyInfoProvider _]
(deliver repo the-repo) nil)
(get [this resource _]
(abort "Tried to use insecure HTTP repository without TLS:\n"
(str (.getId @repo) ": " (.getUrl @repo) "\n " resource) "\n"
"\nThis is almost certainly a mistake; for details see"
"\nhttps://github.com/technomancy/leiningen/blob/master/doc/FAQ.md")))))

(defn -main
"Command-line entry point."
Expand Down

0 comments on commit cc44d42

Please sign in to comment.