• BlackBerry Spark AppSecure
  • Security library for Android applications
  • 0.7.915.0
ContentCheckerRules Class Reference

Configure how ContentChecker performs checks. More...

Description

Content checked using the Content Checker interface is by default configured to send the URL, IP address or message to the BlackBerry Cloud for verification. Advanced machine-learning capabilities and accumulated knowledge from threat intelligence feeds are used to provide an instant assessment of the safety of the content.

Use this class to configure additional custom allowlists and denylists to evaluate when checking URLs or IP addresses. Alternatively, opt to evaluate content using a recent threat detection model running locally on the device. Using the on-device model prevents the need to make networking requests to the BlackBerry Cloud.

Configure a Custom Allowlist or Denylist

To evaluate content against a custom allowlist and denylist, call ManageRules.setContentCheckerRules to configure a list of URLs or IP addresses. IP addresses maybe be defined as either IPv4 or IPv6.

ContentCheckerRules newContentCheckerRule = new ContentCheckerRules()
.setCheckType(ThreatType.SafeBrowsing, ContentCheckerRules.CheckType.CHECKLIST_ONLY)
.setCheckList(ContentCheckerRules.CheckListType.ALLOWLIST,
ContentCheckerRules.CheckListCategory.IP,Arrays.asList("100.200.30.40"));
boolean rulesSaved = manageRules.setContentCheckerRules(newContentCheckerRule);

Configure On-device Check

To configure content checks to only use the BlackBerry Protect on-device threat model, call ManageRules.setContentCheckerRules with the CheckType set to ON_DEVICE.

Classes

enum  CheckListCategory
 Enumeration defining the category of a checklist. More...
 
enum  CheckListType
 Enumeration specifying whether a list is a denylist or a allowlist. More...
 
enum  CheckType
 Enumeration which defines the type of check performed. More...
 

Public Member Functions

CheckType getCheckType (ThreatType threatType)
 Determine how the library will evaluate content which needs to be checked. More...
 
ContentCheckerRules setCheckType (ThreatType threatType, CheckType checkType)
 Control how the content will be evaluated. More...
 
List< String > getCheckList (CheckListType checkListType, CheckListCategory checkListCategory)
 Return the items within the checklist. More...
 
ContentCheckerRules setCheckList (CheckListType checkListType, CheckListCategory checkListCategory, List< String > list)
 Define the items within the checklist. More...
 

Member Function Documentation

◆ getCheckType()

CheckType getCheckType ( ThreatType  threatType)

The default configuration is to query the threat model hosted within BlackBerry Cloud in combination with any configured checklists. If the device is off-line the check will fall back to using the on-device threat model.

Parameters
threatTypethreatType Specify if you want to look at the safeMessaging or safeBrowsing ThreatType.

◆ setCheckType()

ContentCheckerRules setCheckType ( ThreatType  threatType,
CheckType  checkType 
)

Control how the URLs and IPs checked by ContentChecker will be evaluated. (Cloud or Device)

Parameters
threatTypethreatType Indicate if you want to control safeMessaging of safeBrowsing ThreatType.
checkTypecheckType Set if you want the library to use device or cloud based models or just to use a configured checklist.

◆ getCheckList()

List<String> getCheckList ( CheckListType  checkListType,
CheckListCategory  checkListCategory 
)

Return the items within the checklist matching the specified parameters.

Parameters
checkListTypeA checkListType which defines if the items are allowed or denied.
checkListCategoryA ChecklistCategory which indicates if the items are domain URLs or IP address.
Returns
Returns the list strings (URLs or IP addresses) configured in the checklist.

◆ setCheckList()

ContentCheckerRules setCheckList ( CheckListType  checkListType,
CheckListCategory  checkListCategory,
List< String >  list 
)

Define the list of items within a checklist.

Parameters
checkListTypeA checkListType which defines if the items are allowed or denied.
checkListCategoryA ChecklistCategory which defines if the items are domain URLs or IP address.
listThe full list of strings (URLs or IP addresses) to be configured for this checklist.