feat(core): Add URL encryption for GDPR compliancy. Disable url encryption for caldav.

This commit is contained in:
smizrahi
2024-02-12 14:52:01 +01:00
parent 42511d666f
commit fc778295ff
6 changed files with 17 additions and 14 deletions
+1 -1
View File
@@ -980,7 +980,7 @@
if ([[[path objectAtIndex: i] lowercaseString] isEqualToString:@"dav"]) {
if ([path count] > (i + 1)) {
[path replaceObjectAtIndex: (i +1)
withObject: [SOGoUser getDecryptedUsernameIfNeeded: [path objectAtIndex: (i + 1)]]];
withObject: [SOGoUser getDecryptedUsernameIfNeeded: [path objectAtIndex: (i + 1)] request: [context request]]];
}
}
}
+3 -2
View File
@@ -41,6 +41,7 @@
@class NSString;
@class WOContext;
@class WORequest;
@class SOGoAppointmentFolder;
@class SOGoAppointmentFolders;
@@ -136,8 +137,8 @@
- (SOGoContactFolder *) personalContactsFolderInContext: (WOContext *) context;
/* Encryption */
+ (NSString *)getEncryptedUsernameIfNeeded:(NSString *)username;
+ (NSString *)getDecryptedUsernameIfNeeded:(NSString *)username;
+ (NSString *)getEncryptedUsernameIfNeeded:(NSString *)username request:(WORequest *)request;
+ (NSString *)getDecryptedUsernameIfNeeded:(NSString *)username request:(WORequest *)request;
@end
+4 -4
View File
@@ -1296,13 +1296,13 @@ static const NSString *kEncryptedUserNamePrefix = @"uenc";
}
/* Encryption */
+ (NSString *) getEncryptedUsernameIfNeeded:(NSString *)username
+ (NSString *) getEncryptedUsernameIfNeeded:(NSString *)username request: (WORequest *)request
{
NSException *exception;
NSString *tmp, *cacheKey;
SOGoCache *cache;
if (![[SOGoSystemDefaults sharedSystemDefaults] isURLEncryptionEnabled] || [username isEqualToString: @"anonymous"])
if (![[SOGoSystemDefaults sharedSystemDefaults] isURLEncryptionEnabled] || [username isEqualToString: @"anonymous"] || [[request requestHandlerKey] isEqualToString:@"dav"])
return username;
cache = [SOGoCache sharedCache];
@@ -1331,13 +1331,13 @@ static const NSString *kEncryptedUserNamePrefix = @"uenc";
}
}
+ (NSString *) getDecryptedUsernameIfNeeded:(NSString *)username
+ (NSString *) getDecryptedUsernameIfNeeded:(NSString *)username request: (WORequest *)request
{
NSException *exception;
NSString *tmp, *cacheKey;
SOGoCache *cache;
if (![[SOGoSystemDefaults sharedSystemDefaults] isURLEncryptionEnabled] || [username isEqualToString: @"anonymous"])
if (![[SOGoSystemDefaults sharedSystemDefaults] isURLEncryptionEnabled] || [username isEqualToString: @"anonymous"] || [[request requestHandlerKey] isEqualToString:@"dav"])
return username;
cache = [SOGoCache sharedCache];
+1 -1
View File
@@ -87,7 +87,7 @@
}
- (NSString *) nameInContainer {
return [SOGoUser getEncryptedUsernameIfNeeded: [super nameInContainer]];
return [SOGoUser getEncryptedUsernameIfNeeded: [super nameInContainer] request: [context request]];
}
/* ownership */