intitni / CopilotForXcode

The missing GitHub Copilot, Codeium and ChatGPT Xcode Source Editor Extension

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Help Wanted]: How to use self-signed certificates with GitHub Copilot

jerrylcliu opened this issue · comments

Before Reporting

  • I have checked FAQ, and there is no solution to my issue
  • I have searched the existing issues, and there is no existing issue for my issue

Describe your issue

Using copilot behind a Corporate network, will get this error: self signed certificate in certificate chain.
Behind a normal network, CopilotForXcode works well.
In VSCode, the extension "Mac CA VScode" can solve this;
How to solve this error in CopilotForXcode?

You can try:

  1. Add NODE_OPTIONS=--use-openssl-ca to ~/.bashrc.
  2. Change "Run node with" to /bin/bash -i -l, so that the app will read ~/.bashrc for configurations.
  3. Restart the service and host app to restart the language server.

I have tested that with this change, I can MITM the requests to https://api.github.com/copilot_internal/v2/token with a self-signed certificate.

The GitHub Copilot language server doesn't allow self-signed certificate of copilot-proxy.githubusercontent.com (for non-enterprise users?), but it works If I use Mac CA VSCode, so I am not sure if it will work.

Nailed it!

  1. Go to ~/Library/Application Support/com.intii.CopilotForXcode/GitHub Copilot/executable/copilot/dist
  2. Rename agent.js to _agent.js.
  3. Download the following file, save it to the dist folder, and rename it to agent.js. The file is a javascript version of Mac CA VSCode.
  4. Restart the app to restart the language server.

agent.js.txt

I will try to include it in the app in the next release.

Nailed it!

  1. Go to ~/Library/Application Support/com.intii.CopilotForXcode/GitHub Copilot/executable/copilot/dist
  2. Rename agent.js to _agent.js.
  3. Download the following file, save it to the dist folder, and rename it to agent.js. The file is a javascript version of Mac CA VSCode.
  4. Restart the app to restart the language server.

agent.js.txt

I will try to include it in the app in the next release.

Thanks for your reply. I try this, it does not work.
The error is still "self signed certificate in certificate chain".
Suggestion cannot show, it works well behind normal network

It should work. Did you restart the service app? Where did you get the error message? I have never seen the message before.

Screenshot 2024-03-12 at 12 59 50 Screenshot 2024-03-12 at 12 55 38

It should work. Did you restart the service app? Where did you get the error message? I have never seen the message before.

Screenshot 2024-03-12 at 12 59 50 Screenshot 2024-03-12 at 12 55 38

It has now taken effect. I had already restarted the app before my last reply, but it didn't work at that time. Just now, after restarting a few more times and opening Xcode, I found that it has indeed taken effect.
The error message is from console.app - CopilotForXcodeExtensionService, now it doesn't show😂

Released in 0.33.1 beta

Released in 0.33.1