cli icon indicating copy to clipboard operation
cli copied to clipboard

refactor: use nodejs env var for --insecure

Open jahed-snyk opened this issue 3 years ago • 1 comments

Currently we're using global state and needle's rejectUnauthorized option to setup insecure mode. rejectUnauthorized is actually coming from the TLS module, needle just forwards it.

However, since Needle uses TLS module defaults, we can apply the same logic by using NodeJS's NODE_TLS_REJECT_UNAUTHORIZED env var.

https://nodejs.org/docs/latest/api/cli.html#node_tls_reject_unauthorizedvalue

The benefit is that we don't need to test it across multiple modules. This is a NodeJS feature which we can switch on globally. This also applies to any requests not going through our Needle wrapper so it's more thorough.

We have acceptance tests introduced by #3124

jahed-snyk avatar Nov 16 '21 16:11 jahed-snyk

Warnings
:warning:

Since the CLI is unifying on a standard and improved tooling, we're starting to migrate old-style imports and exports to ES6 ones. A file you've modified is using either module.exports or require(). If you can, please update them to ES6 import syntax and export syntax. Files found:

  • src/cli/args.ts

Generated by :no_entry_sign: dangerJS against 6312bd6baffd1c2553f84162e120b2e778c7f1f7

github-actions[bot] avatar Nov 16 '21 16:11 github-actions[bot]

Closing as stale

darscan avatar Nov 01 '23 14:11 darscan