In my managed package I have a custom RestResource that looks something like this (simplified):
@RestResource(urlMapping='/customsettings')
global class setCustomSettings {
CustomSetting__c newCustomSetting;
String sResponse = RestContext.request.requestBody.toString();
Map<String, Object> m = (Map<String, Object>)JSON.deserializeUntyped(sResponse);
String orgId = [Select Id from Organization][0].Id;
newCustomSetting.custom_key__c = (String)m.get('custom_key__c');
newCustomSetting.custom_client__c = (String)m.get('custom_client__c');
newCustomSetting.SetupOwnerId = String.escapeSingleQuotes(orgId);
update newCustomSetting;
RestContext.response.responseBody = Blob.valueOf('{"Success":"true"}');
}
This is getting flagged in the Checkmarx scan as an "FLS" vulnerability. Is that because I need to somehow check for permissions before I update this record? I was relying on the fact that this call is being made with the admin user's OAuth token and thats the only way the request would be allowed so therefore they should have permission. What am I missing?