Limitation
Rules can only be created for IaC Security and Secrets Security; creating rules for CI/CD Security is not supported.
Required license
Cortex XSIAM Premium. In Cortex XSIAM Enterprise and Cortex NG SIEM, requires the Cortex Cloud Posture Management add-on. Not supported in XSIAM Enterprise Plus.
Authorization
String
required
{api_key}
{api_key}
UCoWpG4rkNzgCp2dsh8m02iVpZsskwKHz7N1tErPcUV3Wmf59Gc9kytmgOv0pDWoem3PBlORyRIPiir4OcYdWUOWAM3JyTgoCxQf4nQoTlKmFRKz9Bj5vIjluw66p9WP
x-xdr-auth-id
String
required
{api_key_id}
{api_key_id}
241
curl -X 'POST'
-H
'Accept: application/json'
-H
'Content-Type: application/json'
-H
'Authorization: UCoWpG4rkNzgCp2dsh8m02iVpZsskwKHz7N1tErPcUV3Wmf59Gc9kytmgOv0pDWoem3PBlORyRIPiir4OcYdWUOWAM3JyTgoCxQf4nQoTlKmFRKz9Bj5vIjluw66p9WP '
-H
'x-xdr-auth-id: 241'
'https://api-yourfqdn/public_api/appsec/v1/rules'
-d
'{
"name" : "name",
"scanner" : {
"definitionLink" : "definitionLink",
"subCategory" : "",
"cspmRuleId" : "ff6a26a5-f036-4d3a-a650-d5de1d568bab",
"definition" : "definition:\\n cond_type: attribute\\n resource_types:\\n - aws_s3_bucket_public_access_block\\n attribute: block_public_acls\\n operator: equals\\n value: false",
"remediationDescription" : "Set block_public_acls to true in aws_s3_bucket_public_access_block resource"
},
"description" : "description",
"labels" : [ "Custom-Rule", "Custom-Rule" ]
}'
import http.client
conn = http.client.HTTPSConnection("api-yourfqdn")
payload = "{\"name\":\"string\",\"description\":\"string\",\"severity\":\"CRITICAL\",\"labels\":[\"Custom-Rule\"],\"scanner\":{\"name\":\"ARM\",\"category\":\"AI_ML\",\"subCategory\":\"GUARDRAILS\",\"cspmRuleId\":\"ff6a26a5-f036-4d3a-a650-d5de1d568bab\",\"definition\":\"definition:\\\\n cond_type: attribute\\\\n resource_types:\\\\n - aws_s3_bucket_public_access_block\\\\n attribute: block_public_acls\\\\n operator: equals\\\\n value: false\",\"definitionLink\":\"string\",\"remediationDescription\":\"Set block_public_acls to true in aws_s3_bucket_public_access_block resource\"}}"
headers = {
'Authorization': "UCoWpG4rkNzgCp2dsh8m02iVpZsskwKHz7N1tErPcUV3Wmf59Gc9kytmgOv0pDWoem3PBlORyRIPiir4OcYdWUOWAM3JyTgoCxQf4nQoTlKmFRKz9Bj5vIjluw66p9WP ",
'x-xdr-auth-id': "241",
'content-type': "application/json"
}
conn.request("POST", "/public_api/appsec/v1/rules", 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/appsec/v1/rules")
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"] = 'UCoWpG4rkNzgCp2dsh8m02iVpZsskwKHz7N1tErPcUV3Wmf59Gc9kytmgOv0pDWoem3PBlORyRIPiir4OcYdWUOWAM3JyTgoCxQf4nQoTlKmFRKz9Bj5vIjluw66p9WP '
request["x-xdr-auth-id"] = '241'
request["content-type"] = 'application/json'
request.body = "{\"name\":\"string\",\"description\":\"string\",\"severity\":\"CRITICAL\",\"labels\":[\"Custom-Rule\"],\"scanner\":{\"name\":\"ARM\",\"category\":\"AI_ML\",\"subCategory\":\"GUARDRAILS\",\"cspmRuleId\":\"ff6a26a5-f036-4d3a-a650-d5de1d568bab\",\"definition\":\"definition:\\\\n cond_type: attribute\\\\n resource_types:\\\\n - aws_s3_bucket_public_access_block\\\\n attribute: block_public_acls\\\\n operator: equals\\\\n value: false\",\"definitionLink\":\"string\",\"remediationDescription\":\"Set block_public_acls to true in aws_s3_bucket_public_access_block resource\"}}"
response = http.request(request)
puts response.read_bodyconst data = JSON.stringify({
"name": "string",
"description": "string",
"severity": "CRITICAL",
"labels": [
"Custom-Rule"
],
"scanner": {
"name": "ARM",
"category": "AI_ML",
"subCategory": "GUARDRAILS",
"cspmRuleId": "ff6a26a5-f036-4d3a-a650-d5de1d568bab",
"definition": "definition:\\n cond_type: attribute\\n resource_types:\\n - aws_s3_bucket_public_access_block\\n attribute: block_public_acls\\n operator: equals\\n value: false",
"definitionLink": "string",
"remediationDescription": "Set block_public_acls to true in aws_s3_bucket_public_access_block resource"
}
});
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/appsec/v1/rules");
xhr.setRequestHeader("Authorization", "UCoWpG4rkNzgCp2dsh8m02iVpZsskwKHz7N1tErPcUV3Wmf59Gc9kytmgOv0pDWoem3PBlORyRIPiir4OcYdWUOWAM3JyTgoCxQf4nQoTlKmFRKz9Bj5vIjluw66p9WP ");
xhr.setRequestHeader("x-xdr-auth-id", "241");
xhr.setRequestHeader("content-type", "application/json");
xhr.send(data);HttpResponse<String> response = Unirest.post("https://api-yourfqdn/public_api/appsec/v1/rules")
.header("Authorization", "UCoWpG4rkNzgCp2dsh8m02iVpZsskwKHz7N1tErPcUV3Wmf59Gc9kytmgOv0pDWoem3PBlORyRIPiir4OcYdWUOWAM3JyTgoCxQf4nQoTlKmFRKz9Bj5vIjluw66p9WP ")
.header("x-xdr-auth-id", "241")
.header("content-type", "application/json")
.body("{\"name\":\"string\",\"description\":\"string\",\"severity\":\"CRITICAL\",\"labels\":[\"Custom-Rule\"],\"scanner\":{\"name\":\"ARM\",\"category\":\"AI_ML\",\"subCategory\":\"GUARDRAILS\",\"cspmRuleId\":\"ff6a26a5-f036-4d3a-a650-d5de1d568bab\",\"definition\":\"definition:\\\\n cond_type: attribute\\\\n resource_types:\\\\n - aws_s3_bucket_public_access_block\\\\n attribute: block_public_acls\\\\n operator: equals\\\\n value: false\",\"definitionLink\":\"string\",\"remediationDescription\":\"Set block_public_acls to true in aws_s3_bucket_public_access_block resource\"}}")
.asString();import Foundation
let headers = [
"Authorization": "UCoWpG4rkNzgCp2dsh8m02iVpZsskwKHz7N1tErPcUV3Wmf59Gc9kytmgOv0pDWoem3PBlORyRIPiir4OcYdWUOWAM3JyTgoCxQf4nQoTlKmFRKz9Bj5vIjluw66p9WP ",
"x-xdr-auth-id": "241",
"content-type": "application/json"
]
let parameters = [
"name": "string",
"description": "string",
"severity": "CRITICAL",
"labels": ["Custom-Rule"],
"scanner": [
"name": "ARM",
"category": "AI_ML",
"subCategory": "GUARDRAILS",
"cspmRuleId": "ff6a26a5-f036-4d3a-a650-d5de1d568bab",
"definition": "definition:\n cond_type: attribute\n resource_types:\n - aws_s3_bucket_public_access_block\n attribute: block_public_acls\n operator: equals\n value: false",
"definitionLink": "string",
"remediationDescription": "Set block_public_acls to true in aws_s3_bucket_public_access_block resource"
]
] as [String : Any]
let postData = JSONSerialization.data(withJSONObject: parameters, options: [])
let request = NSMutableURLRequest(url: NSURL(string: "https://api-yourfqdn/public_api/appsec/v1/rules")! 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/appsec/v1/rules",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{\"name\":\"string\",\"description\":\"string\",\"severity\":\"CRITICAL\",\"labels\":[\"Custom-Rule\"],\"scanner\":{\"name\":\"ARM\",\"category\":\"AI_ML\",\"subCategory\":\"GUARDRAILS\",\"cspmRuleId\":\"ff6a26a5-f036-4d3a-a650-d5de1d568bab\",\"definition\":\"definition:\\\\n cond_type: attribute\\\\n resource_types:\\\\n - aws_s3_bucket_public_access_block\\\\n attribute: block_public_acls\\\\n operator: equals\\\\n value: false\",\"definitionLink\":\"string\",\"remediationDescription\":\"Set block_public_acls to true in aws_s3_bucket_public_access_block resource\"}}",
CURLOPT_HTTPHEADER => [
"Authorization: UCoWpG4rkNzgCp2dsh8m02iVpZsskwKHz7N1tErPcUV3Wmf59Gc9kytmgOv0pDWoem3PBlORyRIPiir4OcYdWUOWAM3JyTgoCxQf4nQoTlKmFRKz9Bj5vIjluw66p9WP ",
"content-type: application/json",
"x-xdr-auth-id: 241"
],
]);
$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/appsec/v1/rules");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Authorization: UCoWpG4rkNzgCp2dsh8m02iVpZsskwKHz7N1tErPcUV3Wmf59Gc9kytmgOv0pDWoem3PBlORyRIPiir4OcYdWUOWAM3JyTgoCxQf4nQoTlKmFRKz9Bj5vIjluw66p9WP ");
headers = curl_slist_append(headers, "x-xdr-auth-id: 241");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(hnd, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "{\"name\":\"string\",\"description\":\"string\",\"severity\":\"CRITICAL\",\"labels\":[\"Custom-Rule\"],\"scanner\":{\"name\":\"ARM\",\"category\":\"AI_ML\",\"subCategory\":\"GUARDRAILS\",\"cspmRuleId\":\"ff6a26a5-f036-4d3a-a650-d5de1d568bab\",\"definition\":\"definition:\\\\n cond_type: attribute\\\\n resource_types:\\\\n - aws_s3_bucket_public_access_block\\\\n attribute: block_public_acls\\\\n operator: equals\\\\n value: false\",\"definitionLink\":\"string\",\"remediationDescription\":\"Set block_public_acls to true in aws_s3_bucket_public_access_block resource\"}}");
CURLcode ret = curl_easy_perform(hnd);var client = new RestClient("https://api-yourfqdn/public_api/appsec/v1/rules");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "UCoWpG4rkNzgCp2dsh8m02iVpZsskwKHz7N1tErPcUV3Wmf59Gc9kytmgOv0pDWoem3PBlORyRIPiir4OcYdWUOWAM3JyTgoCxQf4nQoTlKmFRKz9Bj5vIjluw66p9WP ");
request.AddHeader("x-xdr-auth-id", "241");
request.AddHeader("content-type", "application/json");
request.AddParameter("application/json", "{\"name\":\"string\",\"description\":\"string\",\"severity\":\"CRITICAL\",\"labels\":[\"Custom-Rule\"],\"scanner\":{\"name\":\"ARM\",\"category\":\"AI_ML\",\"subCategory\":\"GUARDRAILS\",\"cspmRuleId\":\"ff6a26a5-f036-4d3a-a650-d5de1d568bab\",\"definition\":\"definition:\\\\n cond_type: attribute\\\\n resource_types:\\\\n - aws_s3_bucket_public_access_block\\\\n attribute: block_public_acls\\\\n operator: equals\\\\n value: false\",\"definitionLink\":\"string\",\"remediationDescription\":\"Set block_public_acls to true in aws_s3_bucket_public_access_block resource\"}}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);Define the Application Security custom rule. The category option should match your selection for scanner.
namestringrequiredA unique name for the Appsec rule.
A unique name for the Appsec rule.
descriptionstringDescription of the rule
Description of the rule
severitystring (Enum)requiredSeverity
Severity
labelsarray[string]Labels to be assigned to the rule
Labels to be assigned to the rule
scannerobjectrequiredThe type of security scanner used to detect findings of this rule. Choose any one of the scanners. Allowed Values: IAC or SECRETS.
The type of security scanner used to detect findings of this rule. Choose any one of the scanners. Allowed Values: IAC or SECRETS.
namestring (Enum)requiredName of the configured frameworks.
Name of the configured frameworks.
categorystring (Enum)Custom rule IaC category
Custom rule IaC category
subCategoryobject
string (Enum)Custom rule subcategory
Custom rule subcategory
cspmRuleIdstringThe unique identifier of the Cloud Security rule to which the custom Application Security rule will be mapped.
The unique identifier of the Cloud Security rule to which the custom Application Security rule will be mapped.
"ff6a26a5-f036-4d3a-a650-d5de1d568bab"definitionstringrequiredThe rule definition
The rule definition
"definition:\\n cond_type: attribute\\n resource_types:\\n - aws_s3_bucket_public_access_block\\n attribute: block_public_acls\\n operator: equals\\n value: false"definitionLinkstringhttp link to the definition documentation.
http link to the definition documentation.
remediationDescriptionstringThe remediation steps that will appear on the Appsec rule's findings.
The remediation steps that will appear on the Appsec rule's findings.
"Set block_public_acls to true in aws_s3_bucket_public_access_block resource"categorystring (Enum)Custom rule secret category
Custom rule secret category
definitionstringrequiredThe rule definition
The rule definition
"definition:\\n cond_type: secrets\\n value: AIza[0-9A-Za-z-_]{35}"definitionLinkstringhttp link to the documentation.
http link to the documentation.
remediationDescriptionstringThe remediation steps that will appear on the Appsec rule's findings.
The remediation steps that will appear on the Appsec rule's findings.
"Revoke the GCP API key immediately through the Google Cloud Console."{
"name": "S3 Bucket Public Access Check",
"description": "Detects S3 buckets with public access enabled",
"severity": "HIGH",
"scanner": "IAC",
"category": "PUBLIC",
"subCategory": "STORAGE_BUCKETS",
"labels": [
"Custom-Rule",
"S3-Security"
],
"frameworks": [
{
"name": "TERRAFORM",
"definition": "definition:\n cond_type: attribute\n resource_types:\n - aws_s3_bucket_public_access_block\n attribute: block_public_acls\n operator: equals\n value: false",
"remediationDescription": "Set block_public_acls to true in aws_s3_bucket_public_access_block resource"
}
]
}{
"name": "example secret rule",
"description": "This is a secret rule description",
"severity": "LOW",
"scanner": "SECRETS",
"labels": [
"my-label"
],
"category": "API_KEYS",
"frameworks": [
{
"name": "GIT",
"definition": "definition:\n cond_type: secrets\n value: AIza[0-9A-Za-z-_]{35}",
"remediationDescription": "Revoke the GCP API key immediately through the Google Cloud Console."
}
]
}