Updater: deutsche Fehlermeldung bei ungültiger Versionssignatur, Log bei Benachrichtigung
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
1 parent
464825265e
commit
e86a9dd601
2 files changed
+14
-3
No files matched your search
@@ -216,6 +216,8 @@ fn announce(app: &AppHandle, info: &UpdateInfo) {
|
||||
.show();
|
||||
if let Err(err) = result {
|
||||
tracing::warn!(%err, "Benachrichtigung konnte nicht angezeigt werden");
|
||||
} else {
|
||||
tracing::info!(version = %info.version, "Benachrichtigung über Update gesendet");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -103,7 +103,12 @@ pub fn classify_error(message: &str) -> ErrorKind {
|
||||
];
|
||||
if CERT.iter().any(|p| m.contains(p)) {
|
||||
ErrorKind::Certificate
|
||||
} else if m.contains("signature") || m.contains("minisign") || m.contains("signed version") {
|
||||
} else if m.contains("signature")
|
||||
|| m.contains("minisign")
|
||||
|| m.contains("signed version")
|
||||
|| m.contains("signed for version")
|
||||
|| m.contains("tampered")
|
||||
{
|
||||
ErrorKind::Signature
|
||||
} else if m.contains("404") || m.contains("not found") {
|
||||
ErrorKind::NotFound
|
||||
@@ -126,8 +131,8 @@ pub fn friendly_error(message: &str) -> String {
|
||||
ErrorKind::NotFound => "Die Update-Beschreibung (latest.json) wurde auf dem Server nicht gefunden. Möglicherweise ist noch kein Release veröffentlicht."
|
||||
.to_owned(),
|
||||
ErrorKind::Network => "Der Update-Server ist nicht erreichbar. Bitte die Netzwerkverbindung prüfen.".to_owned(),
|
||||
ErrorKind::Signature => "Die Signatur des Updates ist ungültig. Das Update wurde aus Sicherheitsgründen nicht installiert.".to_owned(),
|
||||
ErrorKind::Other => format!("Die Update-Prüfung ist fehlgeschlagen: {message}"),
|
||||
ErrorKind::Signature => "Die Signatur oder Versionsangabe des Updates ist ungültig. Das Update wurde aus Sicherheitsgründen nicht installiert.".to_owned(),
|
||||
ErrorKind::Other => format!("Beim Update ist ein Fehler aufgetreten: {message}"),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -176,6 +181,10 @@ mod tests {
|
||||
assert_eq!(classify_error("Download request failed with status: 404 Not Found"), ErrorKind::NotFound);
|
||||
assert_eq!(classify_error("error sending request for url: dns error"), ErrorKind::Network);
|
||||
assert_eq!(classify_error("minisign: signature verification failed"), ErrorKind::Signature);
|
||||
assert_eq!(
|
||||
classify_error("The update was signed for version 0.1.1 but the update endpoint announced version 9.9.9. The endpoint response may have been tampered with"),
|
||||
ErrorKind::Signature
|
||||
);
|
||||
assert!(friendly_error("unknown ca").contains("Zertifikat"));
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user