feat: add allowUnsafeSSL config for self-signed certificates#306
feat: add allowUnsafeSSL config for self-signed certificates#306lihuanshuai wants to merge 1 commit into
Conversation
|
@lihuanshuai Sorry for late reply. Your code is not compiling right now. Please see the log in travis for the compile error. |
| "default": false, | ||
| "scope": "resource" | ||
| }, | ||
| "github.rejectUnauthorized": { |
There was a problem hiding this comment.
I would like to name this allowUnsafeSSL and default it to false.
With that name its much more clear what it does.
There was a problem hiding this comment.
yes, I will modify it later
| switch (tokenInfo.provider) { | ||
| case 'github': | ||
| return new GithubClient(protocol, hostname, tokens[hostname].token, logger); | ||
| return new GithubClient( |
There was a problem hiding this comment.
Please add it for the gitlab client as well.
There was a problem hiding this comment.
added in new commit
| constructor(protocol: string, hostname: string, token: string, logger: (message: string) => void) { | ||
| this.client = getClient(this.getApiEndpoint(protocol, hostname), token, logger); | ||
| constructor(protocol: string, hostname: string, token: string, logger: (message: string) => void, | ||
| rejectUnauthoized = false) { |
There was a problem hiding this comment.
This should default to true right now I think.
Default default should be to reject invalid ssl chains.
|
@KnisterPeter sorry for late reply. The compiling problem has confused me a lot. I am not quite familar with typing system of typescript. although the error reported, The compiled javascript code worked on my mac.
interface RequestInit {
//whatwg/fetch standard options
method?: string;
headers?: HeaderInit | { [index: string]: string };
body?: BodyInit;
redirect?: RequestRedirect;
//node-fetch extensions
timeout?: number; //=0 req/res timeout in ms, it resets on redirect. 0 to disable (OS limit applies)
compress?: boolean; //=true support gzip/deflate content encoding. false to disable
size?: number; //=0 maximum response body size in bytes. 0 to disable
agent?: Agent; //=null http.Agent instance, allows custom proxy, certificate etc.
follow?: number; //=20 maximum redirect count. 0 to not follow redirect
//node-fetch does not support mode, cache or credentials options
}
interface RequestInit {
signal?: AbortSignal;
body?: Blob | BufferSource | FormData | string | null;
cache?: RequestCache;
credentials?: RequestCredentials;
headers?: HeadersInit;
integrity?: string;
keepalive?: boolean;
method?: string;
mode?: RequestMode;
redirect?: RequestRedirect;
referrer?: string;
referrerPolicy?: ReferrerPolicy;
window?: any;
}The field is missing in definition, (but actually it exists). I tried installing |
|
@lihuanshuai I will fix this later, then you can have a look at it. |
|
@lihuanshuai Nice. I'll fix the compile error and merge it afterwards. Thank for your contribution. 🚀 |
resolve #304
Set
github.allowUnsafeSSLtotruein workspace settings to overcome https self-signed certificates problem.