mirror of
https://github.com/denoland/deno.git
synced 2025-02-08 07:16:56 -05:00
fix(cli): Fix panic in load_native_certs
(#27863)
Fixes https://github.com/denoland/deno/issues/27528 Can't really trigger the panic myself hence no test.
This commit is contained in:
parent
1cecc0a8b0
commit
b8a878cfc2
1 changed files with 5 additions and 1 deletions
|
@ -60,6 +60,8 @@ pub enum RootCertStoreLoadError {
|
|||
FailedAddPemFile(String),
|
||||
#[error("Failed opening CA file: {0}")]
|
||||
CaFileOpenError(String),
|
||||
#[error("Failed to load platform certificates: {0}")]
|
||||
FailedNativeCerts(String),
|
||||
}
|
||||
|
||||
/// Create and populate a root cert store based on the passed options and
|
||||
|
@ -89,7 +91,9 @@ pub fn get_root_cert_store(
|
|||
root_cert_store.extend(webpki_roots::TLS_SERVER_ROOTS.to_vec());
|
||||
}
|
||||
"system" => {
|
||||
let roots = load_native_certs().expect("could not load platform certs");
|
||||
let roots = load_native_certs().map_err(|err| {
|
||||
RootCertStoreLoadError::FailedNativeCerts(err.to_string())
|
||||
})?;
|
||||
for root in roots {
|
||||
if let Err(err) = root_cert_store
|
||||
.add(rustls::pki_types::CertificateDer::from(root.0.clone()))
|
||||
|
|
Loading…
Add table
Reference in a new issue