Detection Rules /   DETECTION RULE
Generate Code Validate Data Nightfall Console  

Secrets & Credentials

This is a DLP detection rule template that you can implement easily in the Nightfall platform.

Description: Aims to prevent the exposure of credentials.
Logical operator: ANY i.e. This rule will evaluate to TRUE if any of the Detectors meet their criteria below.

Detectors in this Detection Rule

Detector Minimum Confidence Minimum Number of Findings Scope
API Key VERY_LIKELY 1 content
Cryptographic Key VERY_LIKELY 1 content
Database Connection String VERY_LIKELY 1 content
Password VERY_LIKELY 1 content

Used in These Policies


Use Detection Rule via API

Read API Reference

curl --request POST \
     --url https://api.nightfall.ai/v3/scan \
     --header 'Accept: application/json' \
     --header 'Authorization: Bearer  REPLACE-WITH-YOUR-KEY' \
     --header 'Content-Type: application/json' \
     --data '
{
     "policy": {
          "detectionRules": [
               {
                    "detectors": [
                         {
                              "minNumFindings": 1,
                              "minConfidence": "VERY_LIKELY",
                              "displayName": "API Key",
                              "detectorType": "NIGHTFALL_DETECTOR",
                              "nightfallDetector": "API_KEY"
                         },                         {
                              "minNumFindings": 1,
                              "minConfidence": "VERY_LIKELY",
                              "displayName": "Cryptographic Key",
                              "detectorType": "NIGHTFALL_DETECTOR",
                              "nightfallDetector": "CRYPTOGRAPHIC_KEY"
                         },                         {
                              "minNumFindings": 1,
                              "minConfidence": "VERY_LIKELY",
                              "displayName": "Database Connection String",
                              "detectorType": "NIGHTFALL_DETECTOR",
                              "nightfallDetector": "DATABASE_CONNECTION_STRING"
                         },                         {
                              "minNumFindings": 1,
                              "minConfidence": "VERY_LIKELY",
                              "displayName": "Password",
                              "detectorType": "NIGHTFALL_DETECTOR",
                              "nightfallDetector": "PASSWORD_IN_CODE"
                         }
                    ],
                    "name": "My Inline Detection Rule",
                    "logicalOp": "ANY"
               }
          ]
     },
     "payload": [
          "INSERT 1+ PAYLOAD(S)",
          "INSERT 1+ PAYLOAD(S)"
     ]
}
'

          import requests
          import json

          api_key = "REPLACE-WITH-YOUR-KEY"
          url = "https://api.nightfall.ai/v3/scan"

          headers = {
              "Accept": "application/json",
              "Authorization": f"Bearer {api_key}",
              "Content-Type": "application/json"
          }

          payload = {
              "policy": {
                  "detectionRules": [
                      {
                          "detectors": [
                              {
                                  "minNumFindings": 1,
                                  "minConfidence": "VERY_LIKELY",
                                  "displayName": "API Key",
                                  "detectorType": "NIGHTFALL_DETECTOR",
                                  "nightfallDetector": "API_KEY"
                              },
                              {
                                  "minNumFindings": 1,
                                  "minConfidence": "VERY_LIKELY",
                                  "displayName": "Cryptographic Key",
                                  "detectorType": "NIGHTFALL_DETECTOR",
                                  "nightfallDetector": "CRYPTOGRAPHIC_KEY"
                              },
                              {
                                  "minNumFindings": 1,
                                  "minConfidence": "VERY_LIKELY",
                                  "displayName": "Database Connection String",
                                  "detectorType": "NIGHTFALL_DETECTOR",
                                  "nightfallDetector": "DATABASE_CONNECTION_STRING"
                              },
                              {
                                  "minNumFindings": 1,
                                  "minConfidence": "VERY_LIKELY",
                                  "displayName": "Password",
                                  "detectorType": "NIGHTFALL_DETECTOR",
                                  "nightfallDetector": "PASSWORD_IN_CODE"
                              }
                          ],
                          "name": "My Inline Detection Rule",
                          "logicalOp": "ANY"
                      }
                  ]
              },
              "payload": [
                  "INSERT 1+ PAYLOAD(S)",
                  "INSERT 1+ PAYLOAD(S)"
              ]
          }

          response = requests.post(url, headers=headers, data=json.dumps(payload))
          print(response.status_code)
          print(response.json())
          

Secrets & Credentials Detection Rule Validator

Input any text to validate or test. The default minimum confidence is set to "Possible".