feat: Warn when a server certificate has changed

Assisted-by: ClaudeCode:claude-opus-5.5
Signed-off-by: Ivan Sein <[email protected]>
This commit is contained in:
Ivan Sein committed 2026-11-02 12:34:35 +01:00
1 parent c4b760bc80
commit 96aa1bc305
2 files changed
+13 -1

No files matched your search

+10 -1
View File
@@ -120,10 +120,19 @@ static SecCertificateRef SecTrustGetLeafCertificate(SecTrustRef trust)
}
__weak id<CCCertificateDelegate> weakDelegate = delegate;
NSString *certificatePath = [[self directoryForHost:host] stringByAppendingPathComponent:certificateFileName];
BOOL certificateChanged = [[NSFileManager defaultManager] fileExistsAtPath:certificatePath];
NSString *message = NSLocalizedString(@"Do you want to connect to the server anyway?", nil);
if (certificateChanged) {
message = NSLocalizedString(@"The certificate of this server has changed since you last accepted it. Do you want to connect to the server anyway?", nil);
}
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 0.5 * NSEC_PER_SEC), dispatch_get_main_queue(), ^{
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:error.localizedDescription message:NSLocalizedString(@"Do you want to connect to the server anyway?", nil) preferredStyle:UIAlertControllerStyleAlert];
UIAlertController *alertController = [UIAlertController alertControllerWithTitle:error.localizedDescription message:message preferredStyle:UIAlertControllerStyleAlert];
[alertController addAction: [UIAlertAction actionWithTitle:NSLocalizedString(@"Yes", nil) style:UIAlertActionStyleDefault handler:^(UIAlertAction *action) {
@@ -2455,6 +2455,9 @@
/* No comment provided by engineer. */
"The call might be recorded" = "The call might be recorded";
/* No comment provided by engineer. */
"The certificate of this server has changed since you last accepted it. Do you want to connect to the server anyway?" = "The certificate of this server has changed since you last accepted it. Do you want to connect to the server anyway?";
/* No comment provided by engineer. */
"The password is wrong" = "The password is wrong";