I have a predicate for query in core data base but i don't know what is the correct way to validate its params?
- (void) queryToDatabaseWithStoreId:(NSInteger) storeId {
[NSPredicate predicateWithFormat:@"store.storeId = %d", storeId];
}
My question is how can i validate storeId param or what i need to use for that vulnerability to dissapear?
And if i have a list:
- (void) queryToDataBaseWithListStore:(NSArray<Store *> *) storeList {
[NSPredicate predicateWithFormat:@"store.storeId IN %@", [storeList valueForObject:@"storeId"]];
}
I need avoid that:
The following commonly-used functions and methods are subject to format-string attacks:
Standard C
printf and other functions listed on the printf(3) manual page sscanf and other functions listed on the scanf(3) manual page syslog and vsyslog
Carbon
AEBuildDesc and vAEBuildDesc AEBuildParameters and vAEBuildParameters AEBuildAppleEvent and vAEBuildAppleEvent Core Foundation CFStringCreateWithFormat CFStringCreateWithFormatAndArguments CFStringAppendFormat CFStringAppendFormatAndArguments
Cocoa
stringWithFormat:, initWithFormat:, and other NSString methods that take formatted strings as arguments appendFormat: in the NSMutableString class alertWithMessageText:defaultButton:alternateButton:otherButton:informativeTextWithFormat: in NSAlert predicateWithFormat:, predicateWithFormat:arguments:, and predicateWithFormat:argumentArray: in NSPredicate raise:format: and raise:format:arguments: in NSException NSRunAlertPanel and other AppKit functions that create or return panels or sheets
What is the best way to avoid this attack?