-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Fix SSL error handling #6351
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
Fix SSL error handling #6351
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1254,18 +1254,29 @@ mod _ssl { | |
| } else { | ||
| // [SSL] PEM lib | ||
| super::compat::SslError::create_ssl_error_with_reason( | ||
| vm, "SSL", "", "PEM lib", | ||
| vm, | ||
| Some("SSL"), | ||
| "", | ||
| "PEM lib", | ||
| ) | ||
| } | ||
| } | ||
| // PEM parsing errors - [SSL] PEM lib | ||
| _ => super::compat::SslError::create_ssl_error_with_reason( | ||
| vm, "SSL", "", "PEM lib", | ||
| vm, | ||
| Some("SSL"), | ||
| "", | ||
| "PEM lib", | ||
| ), | ||
| } | ||
| } else { | ||
| // Unknown error type - [SSL] PEM lib | ||
| super::compat::SslError::create_ssl_error_with_reason(vm, "SSL", "", "PEM lib") | ||
| super::compat::SslError::create_ssl_error_with_reason( | ||
| vm, | ||
| Some("SSL"), | ||
| "", | ||
| "PEM lib", | ||
| ) | ||
| } | ||
| })?; | ||
|
|
||
|
|
@@ -1866,7 +1877,7 @@ mod _ssl { | |
| // [PEM: NO_START_LINE] no start line | ||
| return Err(super::compat::SslError::create_ssl_error_with_reason( | ||
| vm, | ||
| "PEM", | ||
| Some("PEM"), | ||
| "NO_START_LINE", | ||
| "[PEM: NO_START_LINE] no start line", | ||
| )); | ||
|
|
@@ -2127,7 +2138,10 @@ mod _ssl { | |
| } | ||
| // PEM parsing errors | ||
| _ => super::compat::SslError::create_ssl_error_with_reason( | ||
| vm, "X509", "", "PEM lib", | ||
| vm, | ||
| Some("X509"), | ||
| "", | ||
| "PEM lib", | ||
| ), | ||
|
Comment on lines
+2141
to
2145
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. X509 PEM parsing errors also use empty In _ => super::compat::SslError::create_ssl_error_with_reason(
vm,
Some("X509"),
"",
"PEM lib",
),This shares the same problem as the PEM-lib errors above: Consider updating to something like: - _ => super::compat::SslError::create_ssl_error_with_reason(
- vm,
- Some("X509"),
- "",
- "PEM lib",
- ),
+ _ => super::compat::SslError::create_ssl_error_with_reason(
+ vm,
+ Some("X509"),
+ "PEM lib",
+ "[X509] PEM lib",
+ ),so that callers relying on 🤖 Prompt for AI Agents |
||
| } | ||
| }) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PEM error calls pass empty
reasonstring; swapreason/messageusageIn
load_cert_chain, the non-password PEM error paths build the SSL error as:(and similarly in the
_and non-io::Errorbranches).Per
create_ssl_error_with_reason’s contract and other call sites,reasonshould hold a short reason like"PEM lib", whilemessageis the main display string. Using an empty reason here meansexc.reasonis not informative and is inconsistent with comments like// [SSL] PEM liband with usages such as theNO_START_LINEpath.Recommend at least giving
reasona non-empty value and, ideally, including the[SSL] …prefix in the message, e.g.:Apply the same pattern to the
_arm and theelsebranch so that all PEM-lib errors expose a consistent and non-emptyreasonattribute.🤖 Prompt for AI Agents