feat: Add --unsafely-treat-insecure-origin-as-secure flag to disable SSL verification (#11324)

This commit adds "--unsafely-treat-insecure-origin-as-secure" flag 
that allows to disable SSL verification for all domains, or specific
domains if they were passed as an argument to the flag.

Co-authored-by: Bartek Iwańczuk <biwanczuk@gmail.com>
This commit is contained in:
TheAifam5 2021-08-09 16:53:21 +02:00 committed by GitHub
parent 3ab50b3551
commit 353a4a1af3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
22 changed files with 284 additions and 12 deletions

View file

@ -1,5 +1,6 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
use crate::colors;
use crate::config_file::ConfigFile;
use crate::deno_dir;
use crate::file_fetcher::CacheSetting;
@ -117,6 +118,21 @@ impl ProgramState {
}
}
if let Some(insecure_allowlist) =
flags.unsafely_treat_insecure_origin_as_secure.as_ref()
{
let domains = if insecure_allowlist.is_empty() {
"for all domains".to_string()
} else {
format!("for: {}", insecure_allowlist.join(", "))
};
let msg = format!(
"DANGER: SSL ceritificate validation is disabled {}",
domains
);
eprintln!("{}", colors::yellow(msg));
}
let cache_usage = if flags.cached_only {
CacheSetting::Only
} else if !flags.cache_blocklist.is_empty() {
@ -137,6 +153,7 @@ impl ProgramState {
!flags.no_remote,
Some(root_cert_store.clone()),
blob_store.clone(),
flags.unsafely_treat_insecure_origin_as_secure.clone(),
)?;
let lockfile = if let Some(filename) = &flags.lock {