huggingface / llm-ls

LSP server leveraging LLMs for code completion (and more?)
Apache License 2.0
602 stars 49 forks source link

feat: add support for self-signed certificates #36

Open SteiMi opened 11 months ago

SteiMi commented 11 months ago

First of all: very cool project! I think this intermediate layer between plugin and llm backend makes a lot of sense.

Now regarding this issue: There is currently no way (that I am aware of) to let llm-ls trust custom self-signed certificates. This makes it impossible to communicate securely with backends that use such certificates.

After looking into this a bit, it seems that this could be alleviated relatively easily by not using the rustls-tls feature when importing reqwest:

reqwest = { version = "0.11", default-features = false, features = ["json", "rustls-tls"] }

By default, reqwest will then use system-native TLS (see: https://docs.rs/reqwest/latest/reqwest/#tls), which would allow the user to simply trust self-signed certificates within the OS and llm-ls should then also automatically trust this certificate.

McPatate commented 11 months ago

Thanks!

By default AFAIK reqwest uses openssl, for which I've had issues with when building on multiple platforms. There might be a way to do it with rustls, I'd have to dig. Feel free to take a stab at this if you feel like it!