Updates one or more prevention policy rules. Each item in edit_requests specifies a rule by its 32-character hexadecimal UUID and includes the fields to modify. Only explicitly provided (non-null) fields are updated; all others remain unchanged.
Constraints
- The default (catch-all) rule (
is_any = true) cannot be modified forname,description, ortarget_filter. - Profile IDs must exist, correspond to the correct profile type (exploit, malware, restrictions, agent_settings, or exceptions), and match the OS platform of the target rule.
- Updates are applied atomically. If the policy has been modified since it was last retrieved, the request fails with a
409 Conflicterror due to stale data.
Required license: Cortex XSIAM Premium or Cortex XSIAM Enterprise. In Cortex NG SIEM, requires endpoints or the Cortex Cloud Runtime Security add-on.
Authorization
String
required
{api_key}
{api_key}
authorization_example
x-xdr-auth-id
String
required
{api_key_id}
{api_key_id}
xXdrAuthId_example
curl -X 'POST'
-H
'Accept: application/json'
-H
'Content-Type: application/json'
-H
'Authorization: authorization_example'
-H
'x-xdr-auth-id: xXdrAuthId_example'
'https://api-yourfqdn/public_api/v1/policies/prevention/edit'
-d
'{
"request_data" : {
"edit_requests" : [ {
"restrictions_id" : 5,
"exceptions_id" : 7,
"target_filter" : {
"filterData" : {
"AND" : [ {
"field" : "hostname",
"value" : "DESKTOP-ABC123",
"operator" : "EQ"
}, {
"field" : "hostname",
"value" : "DESKTOP-ABC123",
"operator" : "EQ"
} ]
}
},
"exploit_id" : 10,
"malware_id" : 42,
"agent_settings_id" : 3,
"name" : "My Custom Prevention Rule",
"description" : "Applies to all Windows workstations in Group A",
"id" : "a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4"
}, {
"restrictions_id" : 5,
"exceptions_id" : 7,
"target_filter" : {
"filterData" : {
"AND" : [ {
"field" : "hostname",
"value" : "DESKTOP-ABC123",
"operator" : "EQ"
}, {
"field" : "hostname",
"value" : "DESKTOP-ABC123",
"operator" : "EQ"
} ]
}
},
"exploit_id" : 10,
"malware_id" : 42,
"agent_settings_id" : 3,
"name" : "My Custom Prevention Rule",
"description" : "Applies to all Windows workstations in Group A",
"id" : "a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4"
} ]
}
}'
import http.client
conn = http.client.HTTPSConnection("api-yourfqdn")
payload = "{\"request_data\":{\"edit_requests\":[{\"id\":\"a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4\",\"name\":\"My Custom Prevention Rule\",\"description\":\"Applies to all Windows workstations in Group A\",\"target_filter\":{\"filterData\":{\"AND\":[{\"field\":\"hostname\",\"operator\":\"EQ\",\"value\":\"DESKTOP-ABC123\"}]}},\"exploit_id\":10,\"malware_id\":42,\"restrictions_id\":5,\"agent_settings_id\":3,\"exceptions_id\":7}]}}"
headers = {
'Authorization': "SOME_STRING_VALUE",
'x-xdr-auth-id': "SOME_STRING_VALUE",
'content-type': "application/json"
}
conn.request("POST", "/public_api/v1/policies/prevention/edit", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))require 'uri'
require 'net/http'
require 'openssl'
url = URI("https://api-yourfqdn/public_api/v1/policies/prevention/edit")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'SOME_STRING_VALUE'
request["x-xdr-auth-id"] = 'SOME_STRING_VALUE'
request["content-type"] = 'application/json'
request.body = "{\"request_data\":{\"edit_requests\":[{\"id\":\"a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4\",\"name\":\"My Custom Prevention Rule\",\"description\":\"Applies to all Windows workstations in Group A\",\"target_filter\":{\"filterData\":{\"AND\":[{\"field\":\"hostname\",\"operator\":\"EQ\",\"value\":\"DESKTOP-ABC123\"}]}},\"exploit_id\":10,\"malware_id\":42,\"restrictions_id\":5,\"agent_settings_id\":3,\"exceptions_id\":7}]}}"
response = http.request(request)
puts response.read_bodyconst data = JSON.stringify({
"request_data": {
"edit_requests": [
{
"id": "a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4",
"name": "My Custom Prevention Rule",
"description": "Applies to all Windows workstations in Group A",
"target_filter": {
"filterData": {
"AND": [
{
"field": "hostname",
"operator": "EQ",
"value": "DESKTOP-ABC123"
}
]
}
},
"exploit_id": 10,
"malware_id": 42,
"restrictions_id": 5,
"agent_settings_id": 3,
"exceptions_id": 7
}
]
}
});
const xhr = new XMLHttpRequest();
xhr.withCredentials = true;
xhr.addEventListener("readystatechange", function () {
if (this.readyState === this.DONE) {
console.log(this.responseText);
}
});
xhr.open("POST", "https://api-yourfqdn/public_api/v1/policies/prevention/edit");
xhr.setRequestHeader("Authorization", "SOME_STRING_VALUE");
xhr.setRequestHeader("x-xdr-auth-id", "SOME_STRING_VALUE");
xhr.setRequestHeader("content-type", "application/json");
xhr.send(data);HttpResponse<String> response = Unirest.post("https://api-yourfqdn/public_api/v1/policies/prevention/edit")
.header("Authorization", "SOME_STRING_VALUE")
.header("x-xdr-auth-id", "SOME_STRING_VALUE")
.header("content-type", "application/json")
.body("{\"request_data\":{\"edit_requests\":[{\"id\":\"a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4\",\"name\":\"My Custom Prevention Rule\",\"description\":\"Applies to all Windows workstations in Group A\",\"target_filter\":{\"filterData\":{\"AND\":[{\"field\":\"hostname\",\"operator\":\"EQ\",\"value\":\"DESKTOP-ABC123\"}]}},\"exploit_id\":10,\"malware_id\":42,\"restrictions_id\":5,\"agent_settings_id\":3,\"exceptions_id\":7}]}}")
.asString();import Foundation
let headers = [
"Authorization": "SOME_STRING_VALUE",
"x-xdr-auth-id": "SOME_STRING_VALUE",
"content-type": "application/json"
]
let parameters = ["request_data": ["edit_requests": [
[
"id": "a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4",
"name": "My Custom Prevention Rule",
"description": "Applies to all Windows workstations in Group A",
"target_filter": ["filterData": ["AND": [
[
"field": "hostname",
"operator": "EQ",
"value": "DESKTOP-ABC123"
]
]]],
"exploit_id": 10,
"malware_id": 42,
"restrictions_id": 5,
"agent_settings_id": 3,
"exceptions_id": 7
]
]]] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "https://api-yourfqdn/public_api/v1/policies/prevention/edit")! as URL,
cachePolicy: .useProtocolCachePolicy,
timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data
let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
if (error != nil) {
print(error)
} else {
let httpResponse = response as? HTTPURLResponse
print(httpResponse)
}
})
dataTask.resume()<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api-yourfqdn/public_api/v1/policies/prevention/edit",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{\"request_data\":{\"edit_requests\":[{\"id\":\"a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4\",\"name\":\"My Custom Prevention Rule\",\"description\":\"Applies to all Windows workstations in Group A\",\"target_filter\":{\"filterData\":{\"AND\":[{\"field\":\"hostname\",\"operator\":\"EQ\",\"value\":\"DESKTOP-ABC123\"}]}},\"exploit_id\":10,\"malware_id\":42,\"restrictions_id\":5,\"agent_settings_id\":3,\"exceptions_id\":7}]}}",
CURLOPT_HTTPHEADER => [
"Authorization: SOME_STRING_VALUE",
"content-type: application/json",
"x-xdr-auth-id: SOME_STRING_VALUE"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}CURL *hnd = curl_easy_init();
curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(hnd, CURLOPT_URL, "https://api-yourfqdn/public_api/v1/policies/prevention/edit");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Authorization: SOME_STRING_VALUE");
headers = curl_slist_append(headers, "x-xdr-auth-id: SOME_STRING_VALUE");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\"request_data\":{\"edit_requests\":[{\"id\":\"a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4\",\"name\":\"My Custom Prevention Rule\",\"description\":\"Applies to all Windows workstations in Group A\",\"target_filter\":{\"filterData\":{\"AND\":[{\"field\":\"hostname\",\"operator\":\"EQ\",\"value\":\"DESKTOP-ABC123\"}]}},\"exploit_id\":10,\"malware_id\":42,\"restrictions_id\":5,\"agent_settings_id\":3,\"exceptions_id\":7}]}}");
CURLcode ret = curl_easy_perform(hnd);var client = new RestClient("https://api-yourfqdn/public_api/v1/policies/prevention/edit");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "SOME_STRING_VALUE");
request.AddHeader("x-xdr-auth-id", "SOME_STRING_VALUE");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\"request_data\":{\"edit_requests\":[{\"id\":\"a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4\",\"name\":\"My Custom Prevention Rule\",\"description\":\"Applies to all Windows workstations in Group A\",\"target_filter\":{\"filterData\":{\"AND\":[{\"field\":\"hostname\",\"operator\":\"EQ\",\"value\":\"DESKTOP-ABC123\"}]}},\"exploit_id\":10,\"malware_id\":42,\"restrictions_id\":5,\"agent_settings_id\":3,\"exceptions_id\":7}]}}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);request_dataobject
edit_requestsarrayrequiredList of policy rule edits to apply. All edits are validated before any change is persisted.
List of policy rule edits to apply. All edits are validated before any change is persisted.
idstringrequired32-character hexadecimal UUID of the prevention policy rule to edit. Must be an existing rule ID.
32-character hexadecimal UUID of the prevention policy rule to edit. Must be an existing rule ID.
"a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4"namestringNew display name for the rule. Must be a non-empty string. Cannot be set on the default (catch-all) rule.
New display name for the rule. Must be a non-empty string. Cannot be set on the default (catch-all) rule.
"My Custom Prevention Rule"descriptionstringNew description for the rule. Must be a string (may be empty only if the field is omitted entirely; an explicit empty string is rejected). Cannot be set on the default rule.
New description for the rule. Must be a string (may be empty only if the field is omitted entirely; an explicit empty string is rejected). Cannot be set on the default rule.
"Applies to all Windows workstations in Group A"target_filterobjectReplaces the rule's target filter. Must be a valid filter object (see TargetFilter). Cannot be set on the default rule. The locked portion of the existing filter is preserved automatically.
Replaces the rule's target filter. Must be a valid filter object (see TargetFilter). Cannot be set on the default rule. The locked portion of the existing filter is preserved automatically.
filterDataobjectRoot of the condition tree. Must contain exactly one key: either AND or OR.
Root of the condition tree. Must contain exactly one key: either AND or OR.
ANDarrayrequiredList of search condition objects (all must match).
List of search condition objects (all must match).
fieldstringrequiredThe endpoint attribute to filter on. Must be one of: agent_type, group_id, hostname, os_description, tags.
The endpoint attribute to filter on. Must be one of: agent_type, group_id, hostname, os_description, tags.
"hostname"operatorstringrequiredComparison operator. Valid operators depend on the field:
agent_type: EQ, NEQ
group_id: AGENTS_GROUP_EQ, AGENTS_GROUP_NEQ
hostname, os_description: string operators (e.g. EQ, NEQ, CONTAINS)
tags: string or list operators
Comparison operator. Valid operators depend on the field:
agent_type:EQ,NEQgroup_id:AGENTS_GROUP_EQ,AGENTS_GROUP_NEQhostname,os_description: string operators (e.g.EQ,NEQ,CONTAINS)tags: string or list operators
"EQ"valueobjectrequiredThe value to compare against. Type depends on the field:
agent_type: string (AgentType enum value)
group_id: string (group name)
hostname, os_description: string
tags: string or array of strings
The value to compare against. Type depends on the field:
agent_type: string (AgentType enum value)group_id: string (group name)hostname,os_description: stringtags: string or array of strings
"DESKTOP-ABC123" stringThe value to compare against. Type depends on the field:
agent_type: string (AgentType enum value)
group_id: string (group name)
hostname, os_description: string
tags: string or array of strings
The value to compare against. Type depends on the field:
agent_type: string (AgentType enum value)group_id: string (group name)hostname,os_description: stringtags: string or array of strings
"DESKTOP-ABC123"ORarrayrequiredList of AND-groups (at least two). The rule matches if any group matches.
List of AND-groups (at least two). The rule matches if any group matches.
ANDarrayrequiredList of search condition objects (all must match).
List of search condition objects (all must match).
fieldstringrequiredThe endpoint attribute to filter on. Must be one of: agent_type, group_id, hostname, os_description, tags.
The endpoint attribute to filter on. Must be one of: agent_type, group_id, hostname, os_description, tags.
"hostname"operatorstringrequiredComparison operator. Valid operators depend on the field:
agent_type: EQ, NEQ
group_id: AGENTS_GROUP_EQ, AGENTS_GROUP_NEQ
hostname, os_description: string operators (e.g. EQ, NEQ, CONTAINS)
tags: string or list operators
Comparison operator. Valid operators depend on the field:
agent_type:EQ,NEQgroup_id:AGENTS_GROUP_EQ,AGENTS_GROUP_NEQhostname,os_description: string operators (e.g.EQ,NEQ,CONTAINS)tags: string or list operators
"EQ"valueobjectrequiredThe value to compare against. Type depends on the field:
agent_type: string (AgentType enum value)
group_id: string (group name)
hostname, os_description: string
tags: string or array of strings
The value to compare against. Type depends on the field:
agent_type: string (AgentType enum value)group_id: string (group name)hostname,os_description: stringtags: string or array of strings
"DESKTOP-ABC123" stringThe value to compare against. Type depends on the field:
agent_type: string (AgentType enum value)
group_id: string (group name)
hostname, os_description: string
tags: string or array of strings
The value to compare against. Type depends on the field:
agent_type: string (AgentType enum value)group_id: string (group name)hostname,os_description: stringtags: string or array of strings
"DESKTOP-ABC123"exploit_idintegerID of the Exploit profile to assign to this rule. The profile must exist, be of type EXPLOIT, and match the rule's OS platform.
ID of the Exploit profile to assign to this rule. The profile must exist, be of type EXPLOIT, and match the rule's OS platform.
10malware_idintegerID of the Malware profile to assign to this rule. The profile must exist, be of type MALWARE, and match the rule's OS platform.
ID of the Malware profile to assign to this rule. The profile must exist, be of type MALWARE, and match the rule's OS platform.
42restrictions_idintegerID of the Restrictions profile to assign to this rule. The profile must exist, be of type RESTRICTIONS, and match the rule's OS platform.
ID of the Restrictions profile to assign to this rule. The profile must exist, be of type RESTRICTIONS, and match the rule's OS platform.
5agent_settings_idintegerID of the Agent Settings profile to assign to this rule. The profile must exist, be of type AGENT_SETTINGS, and match the rule's OS platform.
ID of the Agent Settings profile to assign to this rule. The profile must exist, be of type AGENT_SETTINGS, and match the rule's OS platform.
3exceptions_idintegerID of the Exceptions profile to assign to this rule. The profile must exist, be of type EXCEPTIONS, and match the rule's OS platform.
ID of the Exceptions profile to assign to this rule. The profile must exist, be of type EXCEPTIONS, and match the rule's OS platform.
7{
"request_data": {
"edit_requests": [
{
"id": "a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4",
"name": "Updated Rule Name",
"malware_id": 42
}
]
}
}{
"request_data": {
"edit_requests": [
{
"id": "a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4",
"target_filter": {
"filterData": {
"AND": [
{
"field": "hostname",
"operator": "EQ",
"value": "DESKTOP-ABC123"
}
]
}
}
}
]
}
}{
"request_data": {
"edit_requests": [
{
"id": "a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4",
"exploit_id": 10,
"restrictions_id": 5
},
{
"id": "b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5",
"description": "Updated description"
}
]
}
}