Add Global Rules

Global rules allow you to enforce and track block rules that have a global scope over all protected computers in your network. Currently, this feature is only available for block rules. Generally, use the following steps to create global rules:

  1. Create and configure an ApplicationControlGlobalRule object.
  2. Use an ApplicationControlGlobalRuleApi object to create the global rule on Deep Security Manager.

See the Create and add new global rules operation in the API Reference. For more information about global rules, see the Deep Security Help Center.

Example: Add software to the Global Rules

The following example code adds software to the Global Rules.

def add_global_rules(sha256_list, api, configuration, api_version, api_exception):
    """ Adds new Global Rules
    :param sha256_list: The list of SHA-256 hashes of the executables to create new rules for.
    :param api: The Deep Security API modules.
    :param configuration: Configuration object to pass to the api client.
    :param api_version: The version of the API to use.
    :param api_exception: The Deep Security API exception module.
    :return: The list of new rules added.

    # Create the rules
    new_rules = []
    for sha256 in sha256_list:
        new_rule = api.ApplicationControlGlobalRule()
        new_rule.sha256 = sha256

    # Add the rules
    global_rules_api = api.GlobalRulesApi(api.ApiClient(configuration))
    rules_list = api.ApplicationControlGlobalRules()
    rules_list.application_control_global_rules = new_rules
    return global_rules_api.add_global_rules(rules_list, api_version)
 * Adds new Global Rules
 * @param {Array} sha256List The list of SHA-256 hashes of the executables to create new rules for.
 * @param {ApiClient} api The Deep Security API exports.
 * @param {String} apiVersion The api version to use.
 * @returns {Promise} A promise object that resolves to an Array of ApplicationControlGlobalRule objects.

exports.addGlobalRules = function (sha256List, api, apiVersion) {
  return new Promise((resolve, reject) => {
    // Create the rules
    const globalRules = new api.ApplicationControlGlobalRules();
    globalRules.applicationControlGlobalRules = => {
      const newRule = new api.ApplicationControlGlobalRule();
      newRule.sha256 = sha256;
      return newRule;

    // Add the rules
    const globalRuleApi = new api.GlobalRulesApi();
    globalRuleApi.addGlobalRules(globalRules, apiVersion)
    .then(rules => {
    .catch(error => {
 * Add new global rules.
 * @param sha256List The list of SHA-256 hashes to create rules for.
 * @param apiVersion The api version.
 * @return A list of ApplicationControlGlobalRule objects.

public static ApplicationControlGlobalRules addGlobalRules(List sha256List, String apiVersion) {
    // Create global rules
    ApplicationControlGlobalRules globalRules = new ApplicationControlGlobalRules();
    for (String sha256 : sha256List) {
        ApplicationControlGlobalRule globalRule = new ApplicationControlGlobalRule();

    // Add the global rules
    GlobalRulesApi globalRulesApi = new GlobalRulesApi();
    try {
        return globalRulesApi.addGlobalRules(globalRules, apiVersion);
    } catch (ApiException e) {
    return null;