Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support certificate related options #612

Merged
merged 3 commits into from
Jan 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions client/src/shared_types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export interface Settings {
/** Specify an explicit path to the `deno` cache instead of using DENO_DIR
* or the OS default. */
cache: string | null;
certificateStores: string[] | null;
/** Settings related to code lens. */
codeLens: {
implementations: boolean;
Expand Down Expand Up @@ -43,6 +44,8 @@ export interface Settings {
hosts: Record<string, boolean>;
} | null;
} | null;
tlsCertificate: string | null;
unsafelyIgnoreCertificateErrors: string[] | null;
/** Determine if the extension should be type checking against the unstable
* APIs. */
unstable: boolean;
Expand Down
24 changes: 24 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,15 @@
"markdownDescription": "A path to the cache directory for Deno. By default, the operating system's cache path plus `deno` is used, or the `DENO_DIR` environment variable, but if set, this path will be used instead.",
"scope": "window"
},
"deno.certificateStores": {
"type": "array",
"items": {
"type": "string"
},
"default": null,
"markdownDescription": "A list of root certificate stores used to validate TLS certificates when fetching and caching remote resources. This overrides the `DENO_TLS_CA_STORE` environment variable if set.",
"scope": "window"
},
"deno.codeLens.implementations": {
"type": "boolean",
"default": false,
Expand Down Expand Up @@ -257,6 +266,21 @@
"https://deno.land": true
}
},
"deno.tlsCertificate": {
"type": "string",
"default": null,
"markdownDescription": "A path to a PEM certificate to use as the certificate authority when validating TLS certificates when fetching and caching remote resources. This is like using `--cert` on the Deno CLI and overrides the `DENO_CERT` environment variable if set.",
"scope": "window"
},
"deno.unsafelyIgnoreCertificateErrors": {
"type": "array",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be a boolean?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No.

See

  /// An option, if set, will unsafely ignore certificate errors when fetching
  /// remote resources.
  #[serde(default)]
  pub unsafely_ignore_certificate_errors: Option<Vec<String>>,

I need to change the .d.ts files to string[] | null.

"items": {
"type": "string"
},
"default": null,
"markdownDescription": "**DANGER** disables verification of TLS certificates for the hosts provided. There is likely a better way to deal with any errors than use this option. This is like using `--unsafely-ignore-certificate-errors` in the Deno CLI.",
"scope": "window"
},
"deno.unstable": {
"type": "boolean",
"default": false,
Expand Down
3 changes: 3 additions & 0 deletions typescript-deno-plugin/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const projectSettings = new Map<string, PluginSettings>();
* received from the extension. */
const defaultSettings: Settings = {
cache: null,
certificateStores: null,
enable: false,
codeLens: null,
config: null,
Expand All @@ -46,6 +47,8 @@ const defaultSettings: Settings = {
hosts: {},
},
},
tlsCertificate: null,
unsafelyIgnoreCertificateErrors: null,
unstable: false,
};

Expand Down