Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...


curl --request POST \
--url https://api.nightfall.ai/v3/scan \
--header 'Accept: application/json' \
--header 'Authorization: Bearer NF-rEpLaCeM3w1ThYoUrNiGhTfAlLKeY123' \
--header 'Content-Type: application/json' \
--data '
{
"policy": {
"detectionRules": [
{
"detectors": [
{
"minNumFindings": 1,
"minConfidence": "LIKELY",
"displayName": "US Social Security Number",
"detectorType": "NIGHTFALL_DETECTOR",
"nightfallDetector": "US_SOCIAL_SECURITY_NUMBER"
}
],
"name": "My Match Rule",
"logicalOp": "ANY"
}
]
},
"payload": [
"The customer social security number is 458-02-6124",
"No PII in this string"
]
}scan endpoint





curl --location --request POST 'https://api.nightfall.ai/v3/scan' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer NF-rEpLaCeM3w1ThYoUrNiGhTfAlLKeY123' \
--header 'Content-Type: application/json' \
--data-raw '{
"policy": {
"detectionRules": [
{
"detectors": [
{
"regex": {
"pattern": "(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))",
"isCaseSensitive": false
},
"exclusionRules": [
{
"wordList": {
"values": [
"4111111111111111",
"5105105105105100"
]
},
"exclusionType": "WORD_LIST",
"matchType": "FULL"
}
],
"minNumFindings": 1,
"minConfidence": "POSSIBLE",
"displayName": "Credit Card Reg Ex",
"detectorType": "REGEX"
}
],
"name": "Credit Card Detection Rule",
"logicalOp": "ALL"
}
]
},
"payload": [
"5105105105105100",
"4111111111111111",
"4012888888881881"
]
}'{
"findings":[
[
],
[
],
[
{
"finding":"4012888888881881",
"detector":{
"name":"Credit Card Reg Ex",
"uuid":"93024e88-e6de-4c84-8295-75157cdd1b52"
},
"confidence":"LIKELY",
"location":{
"byteRange":{
"start":0,
"end":16
},
"codepointRange":{
"start":0,
"end":16
},
"rowRange":null,
"columnRange":null,
"commitHash":""
},
"matchedDetectionRuleUUIDs":[
],
"matchedDetectionRules":[
"Credit Card Detection Rule"
]
}
]
],
"redactedPayload":[
"",
"",
""
]
}detector_list = ['US_SOCIAL_SECURITY_NUMBER', 'ICD9_CODE', 'US_DRIVERS_LICENSE_NUMBER']
detector_object = [{'name':detector} for detector in detector_list][{'name':'US_SOCIAL_SECURITY_NUMBER'},
{'name':'ICD9_CODE'},
{'name':'US_DRIVERS_LICENSE_NUMBER'}]



curl --location --request POST 'https://api.nightfall.ai/v3/scan' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer NF-rEpLaCeM3w1ThYoUrNiGhTfAlLKeY123' \
--header 'Content-Type: application/json' \
--data-raw '{
"policy": {
"detectionRules": [
{
"detectors": [
{
"regex": {
"isCaseSensitive": false,
"pattern": "\\d{3}-\\d{2}-\\d{4}"
},
"contextRules": [
{
"regex": {
"pattern": "SSN",
"isCaseSensitive": false
},
"proximity": {
"windowBefore": 20,
"windowAfter": 20
},
"confidenceAdjustment": {
"fixedConfidence": "VERY_LIKELY"
}
}
],
"minNumFindings": 1,
"minConfidence": "POSSIBLE",
"detectorType": "REGEX",
"displayName": "SSN Match Detector"
}
],
"name": "SSN Match Detection Rule",
"logicalOp": "ALL"
}
],
"contextBytes": 20
},
"payload": [
"My SSN is 555-55-5555",
"Here it is : 555-55-5555"
]
}
'import json
import os
import requestsendpoint = 'https://api.nightfall.ai/v1/scan'h = {
'Content-Type': 'application/json',
'x-api-key': os.getenv('NIGHTFALL_API_KEY')
}with open('sample_data.csv', 'r') as f:
raw_data = f.read()
d = {
'detectors': detector_object,
'payload':{'items':[raw_data]}
}import os
if os.stat('sample_data.csv').st_size < 500000:
print('This file will fit in a single API call.')
else:
print('This file will need to be broken into pieces across multiple calls.')response = requests.post(endpoint, headers = h, data = json.dumps(d))
if (response.status_code == 200) & (len(response.content.decode()) > 4):
print('This file contains sensitive data.')
print(json.loads(response.content.decode()))
elif response.status_code == 200:
print('No sensitive data detected. Hooray!')
else:
print(f'Something went wrong -- Response {response.status_code}.')[
[
{'fragment': '172-32-1176',
'detector': 'US_SOCIAL_SECURITY_NUMBER',
'confidence': {'bucket': 'LIKELY'},
'location': {'byteRange': {'start': 122, 'end': 133},
'unicodeRange': {'start': 122, 'end': 133}}},
{'fragment': '514-14-8905',
'detector': 'US_SOCIAL_SECURITY_NUMBER',
'confidence': {'bucket': 'LIKELY'},
'location': {'byteRange': {'start': 269, 'end': 280},
'unicodeRange': {'start': 269, 'end': 280}}},
{'fragment': '213-46-8915',
'detector': 'US_SOCIAL_SECURITY_NUMBER',
'confidence': {'bucket': 'LIKELY'},
'location': {'byteRange': {'start': 418, 'end': 429},
'unicodeRange': {'start': 418, 'end': 429}}}
]
]
{
"finding": "zImaKNJJ8u/seIbm1UszokVz3SSARukJs6cghEBXD",
"detector": {
"name": "API key",
"uuid": "0e95732f-bc5c-448f-9d15-bd1417177360"
},
"confidence": "VERY_LIKELY",
...
"findingMetadata": {
"apiKeyMetadata": {
"status": "ACTIVE",
"kind": "AWS",
"description": "Access Key ID: AKIA52FSMBPZS1JIDTPX"
}
}
}
curl --request POST \
--url https://api.nightfall.ai/v3/scan \
--header 'Authorization: Bearer NF-rEpLaCeM3w1ThYoUrNiGhTfAlLKeY123' \
--header 'Content-Type: application/json' \
--data '{
"policy": {
"detectionRules": [
{
"detectors": [
{
"detectorType": "NIGHTFALL_DETECTOR",
"nightfallDetector": "API_KEY",
"minNumFindings": 1,
"minConfidence": "LIKELY",
"displayName": "API Key"
}
],
"name": "My Match Rule",
"logicalOp": "ANY"
}
]
},
"payload": [
"Is this an active nightfall key? NF-OZ6F9fzF2z5mRxMrUdfL8FddFS51kPzE"
]
}'curl --request POST \
--url https://api.nightfall.ai/v3/upload/<fileid>/scan \
--header 'Accept: application/json' \
--header 'Authorization: Bearer NF-<yourNightfallKey> \
--header 'Content-Type: application/json' \
--data '
{
"policy": {
"detectionRules": [
{
"detectors": [
{
"regex": {
"pattern": "*\.txt",
"isCaseSensitive": false
},
"detectorType": "REGEX",
"scope": "ContentAndFile"
}
],
"name": "File Name Detector",
"logicalOp": "ANY"
}
]
}
}
{
"findings":[
[
{
"finding":"555-55-5555",
"beforeContext":"My SSN is ",
"detector":{
"name":"SSN Match Detector",
"uuid":"6131f41c-dbdd-47a9-8c6f-1819c9baf388"
},
"confidence":"VERY_LIKELY",
"location":{
"byteRange":{
"start":10,
"end":21
},
"codepointRange":{
"start":10,
"end":21
},
"rowRange":null,
"columnRange":null,
"commitHash":""
},
"matchedDetectionRuleUUIDs":[
],
"matchedDetectionRules":[
"SSN Match Detection Rule"
]
}
],
[
{
"finding":"555-55-5555",
"beforeContext":"Here it is : ",
"detector":{
"name":"SSN Match Detector",
"uuid":"6131f41c-dbdd-47a9-8c6f-1819c9baf388"
},
"confidence":"LIKELY",
"location":{
"byteRange":{
"start":13,
"end":24
},
"codepointRange":{
"start":13,
"end":24
},
"rowRange":null,
"columnRange":null,
"commitHash":""
},
"matchedDetectionRuleUUIDs":[
],
"matchedDetectionRules":[
"SSN Match Detection Rule"
]
}
]
],
"redactedPayload":[
"",
""
]
}{
"errors": [],
"findingsPresent": true,
"findingsURL": "https://files.nightfall.ai/877442c5-1573-4637-a223-595bf620e3e5.json?Expires=1645722381&Signature=C-kQbtonFAPXfooGcm0dYgbsn9jfGu~vGSv5yK5j1z2f7aAhk0WuaL4bISUwx5MZkQmPVFgeyMwemvEoI8aI11lPA-ORsX5LtRdGJBOma4sPVl~9f9qBPKE2VSrdGDmT4EpBLc8ewUtKrLm2xE-0BzW~5PdLSvZ~NQxtB7OMBaYm7h~y2NSUZfpqzdzENyKhyHx5QxH2PJvxeN5IvMXqNUrKyZsxviSYY6kDNAiGExS-u6PmKKS1GhXOaFLdJSRjgtFhUxDLyWl~xTYR-lJol5UTgtcuYU8AaJ3xVTF1-1JYRlioRlaf9shAvme4djFyg8k~zOB8bYgzBeaRqSjeWA__&Key-Pair-Id=K3RYMP51FKX5HX",
"requestMetadata": "some data",
"uploadID": "877442c5-1573-4637-a223-595bf620e3e5",
"validUntil": "2022-02-24T17:06:21.412377682Z"
}{
"findings": [
{
"detector": {
"id": "74d1315e-c0c3-4ef5-8b1e-6cf98664a854"
},
"finding": "4242-4242-4242-4242",
"confidence": "VERY_LIKELY",
"location": {
"byteRange": {
"start": 146,
"end": 165
},
"codepointRange": {
"start": 146,
"end": 165
},
"lineRange": {
"start": 3,
"end": 3
},
"rowRange": null,
"columnRange": null,
"commitHash": ""
},
"beforeContext": "nd HIPAA Defined PII\nHIPAA HIPAA hooray\n",
"afterContext": " is my credit card number\n\n",
"matchedDetectionRuleUUIDs": ["7bd6166a-b9af-4069-847d-487a88788122"],
"matchedDetectionRules": []
}
]
}{
"findings": [
[
{
"finding": "4242-4242-4242-4242",
"beforeContext": "hello world cc ",
"detector": {
"name": "Credit card number",
"uuid": "74c1815e-c0c3-4df5-8b1e-6cf98864a454"
},
"confidence": "VERY_LIKELY",
"location": {
"byteRange": {
"start": 15,
"end": 34
},
"codepointRange": {
"start": 15,
"end": 34
},
"rowRange": null,
"columnRange": null,
"commitHash": ""
},
"matchedDetectionRuleUUIDs": [
"42efe36c-6479-412a-9049-fd8cdf895ced"
],
"matchedDetectionRules": []
}
]
],
"redactedPayload": [""]
}{
"mcpServers": {
"nightfall": {
"command": "npx",
"args": [
"-y",
"mcp-remote@latest",
"https://api.nightfall.ai/mcp",
"--header",
"Authorization: Bearer YOUR_NIGHTFALL_API_KEY"
]
}
}
}{
"mcpServers": {
"nightfall": {
"url": "https://api.nightfall.ai/mcp",
"headers": {
"Authorization": "Bearer YOUR_NIGHTFALL_API_KEY"
}
}
}
}{
"mcpServers": {
"nightfall": {
"serverUrl": "https://api.nightfall.ai/mcp",
"headers": {
"Authorization": "Bearer YOUR_NIGHTFALL_API_KEY"
}
}
}
}POST https://api.nightfall.ai/mcp
Authorization: Bearer YOUR_NIGHTFALL_API_KEY
Content-Type: application/jsonrowRangecurl --request POST \
--url https://api.nightfall.ai/v3/scan \
--header 'Accept: application/json' \
--header 'Authorization: Bearer NF-rEpLaCeM3w1ThYoUrNiGhTfAlLKeY123' \
--header 'Content-Type: application/json' \
--data '
{
"policy": {
"detectionRuleUUIDs": [
"950833c9-8608-4c66-8a3a-0734eac11157"
]
},
"payload": [
"4916-6734-7572-5015 is my credit card number",
"This string does not have any sensitive data",
"my api key is yr+ZWwIZp6ifFgaHV8410b2BxbRt5QiAj1EZx1qj and my 💳 credit card number 💰 is 30204861594838"
]
}
'curl --request POST \
--url https://api.nightfall.ai/v3/scan \
--header 'accept: application/json' \
--header 'Authorization: Bearer NF-rEpLaCeM3w1ThYoUrNiGhTfAlLKeY123' \
--header 'content-type: application/json' \
--data '
{
"policy": {
"detectionRules": [
{
"detectors": [
{
"nightfallDetector": "CREDIT_CARD_NUMBER",
"detectorType": "NIGHTFALL_DETECTOR",
"minConfidence": "POSSIBLE",
"minNumFindings": 1
}
],
"logicalOp": "ALL"
}
]
},
"payload": [
"4916-6734-7572-5015 is my credit card number",
"This string does not have any sensitive data",
"my api key is yr+ZWwIZp6ifFgaHV8410b2BxbRt5QiAj1EZx1qj and my 💳 credit card number 💰 is 30204861594838"
]
}
'{
"findings": [
[
{
"finding": "4916-6734-7572-5015",
"detector": {
"name": "Credit card number",
"uuid": "74c1815e-c0c3-4df5-8b1e-6cf98864a454"
},
"confidence": "VERY_LIKELY",
"location": {
"byteRange": {
"start": 0,
"end": 19
},
"codepointRange": {
"start": 0,
"end": 19
}
},
"matchedDetectionRuleUUIDs": [
"950833c9-8608-4c66-8a3a-0734eac11157"
],
"matchedDetectionRules": []
}
],
[],
[
{
"finding": "30204861594838",
"detector": {
"name": "Phone number",
"uuid": "d08edfc4-b5e2-420a-a5fe-3693fb6276c4"
},
"confidence": "LIKELY",
"location": {
"byteRange": {
"start": 94,
"end": 108
},
"codepointRange": {
"start": 88,
"end": 102
}
},
"matchedDetectionRuleUUIDs": [
"950833c9-8608-4c66-8a3a-0734eac11157"
],
"matchedDetectionRules": []
},
{
"finding": "30204861594838",
"detector": {
"name": "Credit card number",
"uuid": "74c1815e-c0c3-4df5-8b1e-6cf98864a454"
},
"confidence": "LIKELY",
"location": {
"byteRange": {
"start": 94,
"end": 108
},
"codepointRange": {
"start": 88,
"end": 102
}
},
"matchedDetectionRuleUUIDs": [
"950833c9-8608-4c66-8a3a-0734eac11157"
],
"matchedDetectionRules": []
}
]
]
}
"location": {
"byteRange": {
"start": 94,
"end": 108
},
"codepointRange": {
"start": 88,
"end": 102
}
},
"matchedDetectionRuleUUIDs": [
"950833c9-8608-4c66-8a3a-0734eac11157"
],
"matchedDetectionRules": []
},
{
"finding": "30204861594838",
"detector": {
"name": "Credit card number",
"uuid": "74c1815e-c0c3-4df5-8b1e-6cf98864a454"
},
"confidence": "LIKELY",
"location": {
"byteRange": {
"start": 94,
"end": 108
},
"codepointRange": {
"start": 88,
"end": 102
}
},
"matchedDetectionRuleUUIDs": [
"950833c9-8608-4c66-8a3a-0734eac11157"
],
"matchedDetectionRules": []
}
]
]payload = [
"The customer social security number is 458-02-6124",
"No PII in this string",
"My credit card number is 4916-6734-7572-5015"
]
result, _ = nightfall.scan_text(
payload,
detection_rule_uuids=[detection_rule_uuid]
)payload = [
"The customer social security number is 458-02-6124",
"No PII in this string",
"My credit card number is 4916-6734-7572-5015"
]
result, _ = nightfall.scan_text(
payload,
detection_rules=[
DetectionRule(
name="Sample_Detection_Rule",
logical_op=LogicalOp.ANY,
detectors=[
Detector(
min_confidence=Confidence.VERY_LIKELY,
min_num_findings=1,
display_name="Credit Card",
nightfall_detector="CREDIT_CARD_NUMBER",
),
Detector(
min_confidence=Confidence.VERY_LIKELY,
min_num_findings=1,
display_name="Social",
nightfall_detector="US_SOCIAL_SECURITY_NUMBER",
)
]
)
]
)[
[Finding(finding='458-02-6124', redacted_finding=None, before_context=None, after_context=None, detector_name='US social security number (SSN)', detector_uuid='e30d9a87-f6c7-46b9-a8f4-16547901e069', confidence=<Confidence.VERY_LIKELY: 'VERY_LIKELY'>, byte_range=Range(start=39, end=50), codepoint_range=Range(start=39, end=50), matched_detection_rule_uuids=['c67e3dd7-560e-438f-8c72-6ec54979396f'], matched_detection_rules=[])],
[],
[Finding(finding='4916-6734-7572-5015', redacted_finding=None, before_context=None, after_context=None, detector_name='Credit card number', detector_uuid='74c1815e-c0c3-4df5-8b1e-6cf98864a454', confidence=<Confidence.VERY_LIKELY: 'VERY_LIKELY'>, byte_range=Range(start=25, end=44), codepoint_range=Range(start=25, end=44), matched_detection_rule_uuids=['c67e3dd7-560e-438f-8c72-6ec54979396f'], matched_detection_rules=[])]
][
[Finding(finding='458-02-6124', redacted_finding=None, before_context=None, after_context=None, detector_name='Social', detector_uuid='e30d9a87-f6c7-46b9-a8f4-16547901e069', confidence=<Confidence.VERY_LIKELY: 'VERY_LIKELY'>, byte_range=Range(start=39, end=50), codepoint_range=Range(start=39, end=50), matched_detection_rule_uuids=[], matched_detection_rules=['Sample_Detection_Rule'])],
[],
[Finding(finding='4916-6734-7572-5015', redacted_finding=None, before_context=None, after_context=None, detector_name='Credit Card', detector_uuid='74c1815e-c0c3-4df5-8b1e-6cf98864a454', confidence=<Confidence.VERY_LIKELY: 'VERY_LIKELY'>, byte_range=Range(start=25, end=44), codepoint_range=Range(start=25, end=44), matched_detection_rule_uuids=[], matched_detection_rules=['Sample_Detection_Rule'])],
][[], [], []]import os
from nightfall import Confidence, DetectionRule, Detector, LogicalOp, Nightfallnightfall = Nightfall(os.environ['NIGHTFALL_API_KEY'])detection_rule_uuid = os.environ.get('DETECTION_RULE_UUID')<!--pom.xml-->
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.foo</groupId>
<artifactId>my-artifact</artifactId>
<version>1.0.0</version>
<name>${project.groupId}:${project.artifactId}</name>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>ai.nightfall</groupId>
<artifactId>scan-api</artifactId>
<version>1.0.1</version>
</dependency>
</dependencies>
</project>//List of imports
import ai.nightfall.scan.NightfallClient;
import ai.nightfall.scan.model.Confidence;
import ai.nightfall.scan.model.DetectionRule;
import ai.nightfall.scan.model.Detector;
import ai.nightfall.scan.model.LogicalOp;
import ai.nightfall.scan.model.NightfallAPIException;
import ai.nightfall.scan.model.ScanTextConfig;
import ai.nightfall.scan.model.ScanTextRequest;
import ai.nightfall.scan.model.ScanTextResponse;
import java.util.Arrays;
import java.util.List;//Sample Payload
List<String> payload = Arrays.asList(
"hello",
"world",
"my data is 4242-4242-4242-4242 but shhhh 🙊 ",
"my ssn is 678-99-8212"
);//Build the Scan Request
public static ScanTextRequest buildScanTextRequest() {
// Define some detectors to use to scan your data
Detector creditCard = new Detector("CREDIT_CARD_NUMBER");
creditCard.setMinConfidence(Confidence.LIKELY);
creditCard.setMinNumFindings(1);
Detector ssn = new Detector("US_SOCIAL_SECURITY_NUMBER");
ssn.setMinConfidence(Confidence.POSSIBLE);
ssn.setMinNumFindings(1);
DetectionRule rule = new DetectionRule(Arrays.asList(creditCard, ssn), LogicalOp.ANY);
ScanTextConfig config = ScanTextConfig.fromDetectionRules(Arrays.asList(rule), 20);
return new ScanTextRequest(payload, config);
}//Run the Scan Request
public class Runner {
public static void main(String[] args) {
try (NightfallClient c = NightfallClient.Builder.defaultClient()) {
try {
ScanTextResponse response = c.scanText(buildScanTextRequest());
System.out.println("response: " + response.getFindings());
} catch (NightfallAPIException e) {
// not a checked exception, just for illustrative purposes
System.out.println("got error: " + e);
}
}
}
}{
"findings":[
{
"path":"Sheet1 (5)",
"detector":{
"id":"e30d9a87-f6c7-46b9-a8f4-16547901e069",
"name":"US social security number (SSN)",
"version":1
},
"finding":"624-84-9182",
"confidence":"LIKELY",
"location":{
"byteRange":{
"start":2505,
"end":2516
},
"codepointRange":{
"start":2452,
"end":2463
},
"lineRange":{
"start":55,
"end":55
},
"rowRange":{
"start":55,
"end":55
},
"columnRange":{
"start":2,
"end":2
},
"commitHash":""
},
"matchedDetectionRuleUUIDs":[
"950833c9-8608-4c66-8a3a-0734eac11157"
],
"matchedDetectionRules":[
]
},
...{
"findings":[
{
"path":"f607a067..53e59684/nightfall.go",
"detector":{
"id":"6123060e-2d9f-4f35-a7a1-743379ea5616",
"name":"URL"
},
"finding":"https://api.nightfall.ai/\"",
"confidence":"LIKELY",
"location":{
"byteRange":{
"start":142,
"end":168
},
"codepointRange":{
"start":142,
"end":168
},
"lineRange":{
"start":16,
"end":16
},
"rowRange":{
"start":0,
"end":0
},
"columnRange":{
"start":0,
"end":0
},
"commitHash":"53e59684d9778ceb0f0ed6a4b949c464c24d35ce"
},
"beforeContext":"tp\"\n\t\"os\"\n\t\"time\"\n)\n\nconst (\n\tAPIURL = \"",
"afterContext":"\n\n\tDefaultFileUploadConcurrency = 1\n\tDef",
"matchedDetectionRuleUUIDs":[
"cda0367f-aa75-4d6a-904f-0311209b3383"
],
"matchedDetectionRules":[
]
},
...cd nightfall-go-sdk
git checkout 53e59684d9778ceb0f0ed6a4b949c464c24d35ce{"challenge": "z78woE1uDFu7tPrPvEBV"}X-Nightfall-Timestampfrom datetime import datetime, timedelta
import hmac
import hashlib
from flask import request
SIGNING_SECRET = "super-secret"
given_signature = request.headers.get('X-Nightfall-Signature')
req_timestamp = request.headers.get('X-Nightfall-Timestamp')
now = datetime.now()
if now-timedelta(minutes=5) <= datetime.fromtimestamp(int(req_timestamp)) <= now:
raise Exception("could not validate timestamp is within the last few minutes")
computed_signature = hmac.new(
SIGNING_SECRET.encode(),
msg=F"{req_timestamp}:{request.get_data(as_text=True)}".encode(),
digestmod=hashlib.sha256
).hexdigest().lower()
if computed_signature != given_signature:
raise Exception("could not validate signature of inbound request!")import hmac
import hashlib
from os import getenv, path, mkdir
from flask import Flask, request
import requests
app = Flask(__name__)
output_dir = "findings"
SIGNING_SECRET = getenv("NF_SIGNING_SECRET")
@app.route("/", methods=['POST'])
def hello():
content = request.get_json(silent=True)
challenge = content.get("challenge")
if challenge:
return challenge
else:
verify_signature()
print(F"Received request metadata: {content['requestMetadata']}")
print(F"Received errors: {content['errors']}")
if not content["findingsPresent"]:
print(F"No findings for {content['uploadID']}")
return "", 200
print(F"S3 findings valid until {content['validUntil']}")
response = requests.get(content["findingsURL"])
save_findings(content["uploadID"], response.text)
return "", 200
def verify_signature():
if SIGNING_SECRET is None:
return
given_signature = request.headers.get('X-Nightfall-Signature')
nonce = request.headers.get('X-Nightfall-Timestamp')
computed_signature = hmac.new(
SIGNING_SECRET.encode(),
msg=F"{nonce}:{request.get_data(as_text=True)}".encode(),
digestmod=hashlib.sha256
).hexdigest().lower()
if computed_signature != given_signature:
raise Exception("could not validate signature of inbound request!")
def save_findings(scan_id, finding_json):
if not path.isdir(output_dir):
mkdir(output_dir)
output_path = path.join(output_dir, f"{scan_id}.json")
with open(output_path, "w+") as out_file:
out_file.write(finding_json)
print(F"Findings for {scan_id} written to {output_path}")
if __name__ == "__main__":
app.run(port=8075)integration_name:github AND risk_label:HIGH AND state:ACTIVEuser_email:[email protected] AND integration_name:slackuser_email:[email protected] OR user_email:[email protected]slack.channel_name:general AND state:PENDINGcreatedAfter=<unix_timestamp> AND risk_label:HIGHget_violation to understand context and available remediation actionslist_posture_events with the same time rangesearch_posture_events with query actor_email:[email]# Load dependencies
require 'open-uri'
require 'net/http'
require 'json'# Load environment variables for Nightfall API
nightfall_api_key = ENV['NIGHTFALL_API_KEY']
detection_rule_uuid = ENV['NIGHTFALL_DETECTION_RULE_UUID']# Text data to scan
payload = [
"The customer social security number is 458-02-6124",
"No PII in this string",
"My credit card number is 4916-6734-7572-5015"
]# Configure detection settings
config = {
"config": {
"detectionRuleUUIDs": [detection_rule_uuid]
},
"payload": payload
}# Build API request
url = URI("https://api.nightfall.ai/v3/scan")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Accept"] = 'application/json'
request["Content-Type"] = 'application/json'
request["Authorization"] = "Bearer #{nightfall_api_key}"
request.body = config.to_json# Make API request
response = http.request(request)
# Parse response
if response.code.to_i == 200 and response.body['findings']
puts "This text contains sensitive data.\n\n"
puts JSON.pretty_generate(JSON.parse(response.body))
elsif response.code.to_i == 200
puts "No sensitive data found. Hooray!"
else
puts "Something went wrong -- Response #{response.code}."
endruby nightfall_demo.rbThis text contains sensitive data.
{
"findings": [
[
{
"finding": "458-02-6124",
"detector": {
"name": "US social security number (SSN)",
"uuid": "e30d9a87-f6c7-46b9-a8f4-16547901e069"
},
"confidence": "VERY_LIKELY",
"location": {
"byteRange": {
"start": 39,
"end": 50
},
"codepointRange": {
"start": 39,
"end": 50
}
},
"matchedDetectionRuleUUIDs": [
"996a3c12-35d1-48cb-b858-5ee0841c652d"
],
"matchedDetectionRules": [
]
}
],
[
],
[
{
"finding": "4916-6734-7572-5015",
"detector": {
"name": "Credit card number",
"uuid": "74c1815e-c0c3-4df5-8b1e-6cf98864a454"
},
"confidence": "VERY_LIKELY",
"location": {
"byteRange": {
"start": 25,
"end": 44
},
"codepointRange": {
"start": 25,
"end": 44
}
},
"matchedDetectionRuleUUIDs": [
"996a3c12-35d1-48cb-b858-5ee0841c652d"
],
"matchedDetectionRules": [
]
}
]
],
"redactedPayload": [
"",
"",
""
]
}
# nightfall_demo.rb
# Load dependencies
require 'open-uri'
require 'net/http'
require 'json'
# Load environment variables for Nightfall API
nightfall_api_key = ENV['NIGHTFALL_API_KEY']
detection_rule_uuid = ENV['NIGHTFALL_DETECTION_RULE_UUID']
# Text data to scan
payload = [
"The customer social security number is 458-02-6124",
"No PII in this string",
"My credit card number is 4916-6734-7572-5015"
]
# Configure detection settings
config = {
"config": {
"detectionRuleUUIDs": [detection_rule_uuid]
},
"payload": payload
}
# Build API request
url = URI("https://api.nightfall.ai/v3/scan")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Accept"] = 'application/json'
request["Content-Type"] = 'application/json'
request["Authorization"] = "Bearer #{nightfall_api_key}"
request.body = config.to_json
# Make API request
response = http.request(request)
# Parse response
if response.code.to_i == 200 and response.body['findings']
puts "This text contains sensitive data.\n\n"
puts JSON.pretty_generate(JSON.parse(response.body))
elsif response.code.to_i == 200
puts "No sensitive data found. Hooray!"
else
puts "Something went wrong -- Response #{response.code}."
end>>> from nightfall import Confidence, DetectionRule, Detector, Nightfall, EmailAlert
//this script assumes the node sdk has been installed locally with `npm install` and `npm run build`
import { Nightfall } from
curl --request POST \
--url https://api.nightfall.ai/v3/scan \
--header 'Accept: application/json' \
--header 'Authorization: Bearer NF-rEpLaCeM3w1ThYoUrNiGhTfAlLKeY123' \
--header 'Content-Type: application/json' \
--data '
{
"policy": {
"detectionRules": [
{
"detectors": [
{
"minNumFindings": 1,
"minConfidence": "VERY_LIKELY",
curl --location --request POST 'https://api.nightfall.ai/v3/upload' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer NF-rEpLaCeM3w1ThYoUrNiGhTfAlLKeY123' \
--data-raw '{
"fileSizeBytes": 73891,
"mimeType" : "image/png"
}'{
"id": "f9dbdb15-c9fa-46ff-86ec-cd5c09aa550d",
"fileSizeBytes": 73891,
"chunkSize": 10485760,
"mimeType": "image/png"
}PATCH /v3/upload/<uploadUUID>curl --location --request PATCH 'https://api.nightfall.ai/v3/upload/f9dbdb15-c9fa-46ff-86ec-cd5c09aa550d' \
--header 'X-Upload-Offset: 0' \
--header 'Content-Type: application/octet-stream' \
--header 'Authorization: Bearer NF-rEpLaCeM3w1ThYoUrNiGhTfAlLKeY123' \
--data-binary '@/Users/myname/Documents/work/Nightfall/Nightfall Upload Sequence.png'curl --location --request POST 'https://api.nightfall.ai/v3/upload/f9dbdb15-c9fa-46ff-86ec-cd5c09aa550d/finish' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer NF-rEpLaCeM3w1ThYoUrNiGhTfAlLKeY123' \
--data-raw '""'{
"id": "152848af-2ac9-4e0a-8563-2b82343d964a",
"fileSizeBytes": 2349,
"chunkSize": 10485760,
"mimeType": "application/zip"
}curl --request POST \
--url https://api.nightfall.ai/v3/upload/f9dbdb15-c9fa-46ff-86ec-cd5c09aa550d/scan \
--header 'Accept: application/json' \
--header 'Authorization: Bearer NF-rEpLaCeM3w1ThYoUrNiGhTfAlLKeY123' \
--header 'Content-Type: application/json' \
--data '
{
"policy": {
"detectionRuleUUIDs": [
"950833c9-8608-4c66-8a3a-0734eac11157"
],
"webhookURL": "https://mycompany.org/webhookservice"
},
"requestMetadata": "your file metadata"
}
'from os import getenv, path
import fire
import requests
BASE_UPLOAD_URL = getenv("FILE_UPLOAD_HOST", "http://api.nightfall.ai/v3")
NF_API_KEY = getenv("NF_API_KEY")
def upload(filepath, mimetype, policy_uuid):
"""Upload the given file using the provided MIMEType and PolicyUUID.
Arguments:
file_path -- an absolute or relative path to the file that will be
uploaded to the API.
mimetype -- (optional) The mimetype of the file being uploaded.
policy_uuid -- The UUID corresponding to an existing policy. This
policy must be active and have a webhook URL associated with it.
"""
default_headers = {
"Authorization": F"Bearer {NF_API_KEY}",
}
# =*=*=*=*=* Initiate Upload =*=*=*=*=*=*
file_size = path.getsize(filepath)
upload_request_body = {"fileSizeBytes": file_size, "mimeType": mimetype}
r = requests.post(F"{BASE_UPLOAD_URL}/upload",
headers=default_headers,
json=upload_request_body)
upload = r.json()
if not r.ok:
raise Exception(F"Unexpected error initializing upload - {upload}")
# =*=*=*=*=*=* Upload Chunks =*=*=*=*=*=*
chunk_size = upload["chunkSize"]
i = 0
with open(filepath, "rb") as file:
while file.tell() < file_size:
upload_chunk_headers = {
**default_headers,
"X-UPLOAD-OFFSET": str(file.tell())
}
r = requests.patch(F"{BASE_UPLOAD_URL}/upload/{upload['id']}",
headers=upload_chunk_headers,
data=file.read(chunk_size))
if not r.ok:
raise Exception(F"Unexpected error uploading chunk - {r.text}")
i += 1
# =*=*=*=*=*=* Finish Upload =*=*=*=*=*=*
r = requests.post(F"{BASE_UPLOAD_URL}/upload/{upload['id']}/finish",
headers=default_headers)
if not r.ok:
raise Exception(F"Unexpected error finalizing upload - {r.text}")
# =*=*=*=*=* Scan Uploaded File =*=*=*=*=*
r = requests.post(F"{BASE_UPLOAD_URL}/upload/{upload['id']}/scan",
json={"policyUUID": policy_uuid},
headers=default_headers)
if not r.ok:
raise Exception(F"Unexpected error initiating scan - {r.text}")
print("Scan Initiated Successfully - await response on configured webhook")
quota_remaining = r.headers.get('X-Quota-Remaining')
if quota_remaining is not None and int(quota_remaining) <= 0:
print(F"Scan quota exhausted - Quota will reset on {r.headers['X-Quota-Period-End']}")
if __name__ == "__main__":
fire.Fire(upload)// By default, the client reads your API key from the environment variable NIGHTFALL_API_KEY
const nfClient = new Nightfall();
const payload = [
"The customer social security number is 458-02-6124",
"No PII in this string",
"My credit card number is 5310-2768-6832-9293"
];
const policy = {
"detectionRules": [
{
"detectors": [
{
"minNumFindings": 1,
"minConfidence": "LIKELY",
"displayName": "US Social Security Number",
"detectorType": "NIGHTFALL_DETECTOR",
"nightfallDetector": "US_SOCIAL_SECURITY_NUMBER"
},
{
"redactionConfig": {
"maskConfig": {
"charsToIgnore": [
"-"
],
"maskingChar": "#"
}
},
"minNumFindings": 1,
"minConfidence": "LIKELY",
"displayName": "Credit Card Number",
"detectorType": "NIGHTFALL_DETECTOR",
"nightfallDetector": "CREDIT_CARD_NUMBER"
}
],
"name": "My Match Rule",
"logicalOp": "ANY"
}
]
};
const response = await nfClient.scanText(payload, policy);
if (response.isError) {
console.log(response.getError());
} else {
response.data.findings.forEach((finding) => {
if (finding.length > 0) {
finding.forEach((result) => {
console.log(`Finding: ${result.finding}, Confidence: ${result.confidence}`);
});
}
});
}// Some code>>> from nightfall import Confidence, DetectionRule, Detector, Nightfall
>>> # By default, the client reads the API key from the environment variable NIGHTFALL_API_KEY
>>> nightfall = Nightfall()
>>> # A rule contains a set of detectors to scan with
>>> cc = Detector(min_confidence=Confidence.LIKELY, nightfall_detector="CREDIT_CARD_NUMBER")
>>> ssn = Detector(min_confidence=Confidence.POSSIBLE, nightfall_detector="US_SOCIAL_SECURITY_NUMBER")
>>> detection_rule = DetectionRule([cc, ssn])
>>> payload = ["hello world", "my SSN is 678-99-8212", "4242-4242-4242-4242"]
>>> findings, _ = nightfall.scan_text( payload, detection_rules=[detection_rule]){
"findings": [
[
{
"finding": "458-02-6124",
"redactedFinding": "XXX-XXXX-XXXX-9293",
"detector": {
"name": "US Social Security Number",
"uuid": "e30d9a87-f6c7-46b9-a8f4-16547901e069"
},
"confidence": "VERY_LIKELY",
"location": {
"byteRange": {
"start": 39,
"end": 50
},
"codepointRange": {
"start": 39,
"end": 50
},
"rowRange": null,
"columnRange": null,
"commitHash": ""
},
"matchedDetectionRuleUUIDs": [],
"matchedDetectionRules": [
"My Match Rule"
]
}
],
[],
[
{
"finding": "5310-2768-6832-9293",
"redactedFinding": "XXXX-XXXX-XXXX-9293",
"detector": {
"name": "Credit Card Number",
"uuid": "74c1815e-c0c3-4df5-8b1e-6cf98864a454"
},
"confidence": "VERY_LIKELY",
"location": {
"byteRange": {
"start": 25,
"end": 44
},
"codepointRange": {
"start": 25,
"end": 44
},
"rowRange": null,
"columnRange": null,
"commitHash": ""
},
"redactedLocation": {
"byteRange": {
"start": 25,
"end": 44
},
"codepointRange": {
"start": 25,
"end": 44
},
"rowRange": null,
"columnRange": null,
"commitHash": ""
},
"matchedDetectionRuleUUIDs": [],
"matchedDetectionRules": [
"My Match Rule"
]
}
]
],
"redactedPayload": [
"",
"",
"My credit card number is XXXX-XXXX-XXXX-9293"
]
}curl --request POST \
--url https://api.nightfall.ai/v3/scan \
--header 'Authorization: Bearer NF-rEpLaCeM3w1ThYoUrNiGhTfAlLKeY123' \
--header 'Content-Type: application/json' \
--data '{
"policy": {
"detectionRules": [
{
"detectors": [
{
"detectorType": "NIGHTFALL_DETECTOR",
"nightfallDetector": "US_SOCIAL_SECURITY_NUMBER",
"minNumFindings": 1,
"minConfidence": "LIKELY",
"displayName": "US Social Security Number"
},
{
"detectorType": "NIGHTFALL_DETECTOR",
"nightfallDetector": "CREDIT_CARD_NUMBER",
"minNumFindings": 1,
"minConfidence": "LIKELY",
"displayName": "Credit Card Number",
"redactionConfig": {
"maskConfig": {
"maskingChar": "👀",
"charsToIgnore": ["-"]
}
}
}
],
"name": "My Match Rule",
"logicalOp": "ANY"
}
]
},
"payload": [
"The customer social security number is 458-02-6124",
"No PII in this string",
"My credit card number is 5310-2768-6832-9293"
]
}'{
"findings": [
[
{
"finding": "458-02-6124",
"detector": {
"name": "US Social Security Number",
"uuid": "e30d9a87-f6c7-46b9-a8f4-16547901e069"
},
"confidence": "VERY_LIKELY",
"location": {
"byteRange": {
"start": 39,
"end": 50
},
"codepointRange": {
"start": 39,
"end": 50
}
},
"matchedDetectionRuleUUIDs": [],
"matchedDetectionRules": [
"My Match Rule"
]
}
],
[],
[
{
"finding": "5310-2768-6832-9293",
"redactedFinding": "👀👀👀👀-👀👀👀👀-👀👀👀👀-👀👀👀👀",
"detector": {
"name": "Credit Card Number",
"uuid": "74c1815e-c0c3-4df5-8b1e-6cf98864a454"
},
"confidence": "VERY_LIKELY",
"location": {
"byteRange": {
"start": 25,
"end": 44
},
"codepointRange": {
"start": 25,
"end": 44
}
},
"redactedLocation": {
"byteRange": {
"start": 25,
"end": 44
},
"codepointRange": {
"start": 25,
"end": 44
}
},
"matchedDetectionRuleUUIDs": [],
"matchedDetectionRules": [
"My Match Rule"
]
}
]
],
"redactedPayload": [
"",
"",
"My credit card number is 👀👀👀👀-👀👀👀👀-👀👀👀👀-👀👀👀👀"
]
}curl --location --request POST 'https://api.nightfall.ai/v3/scan' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer NF-rEpLaCeM3w1ThYoUrNiGhTfAlLKeY123' \
--header 'Content-Type: application/json' \
--data-raw '{
"config": {
"detectionRules": [
{
"detectors": [
{
"regex": {
"isCaseSensitive": false,
"pattern": "[A-Z]{2}-?\\w{3}-?\\d{2}-?\\d{5}"
},
"minNumFindings": 1,
"minConfidence": "POSSIBLE",
"detectorType": "REGEX",
"displayName": "ISRC Code Detector"
},
{
"regex": {
"isCaseSensitive": false,
"pattern": "T-[0-9]{3}\\.[0-9]{3}\\.[0-9]{3}-[0-9]"
},
"minNumFindings": 1,
"minConfidence": "POSSIBLE",
"detectorType": "REGEX",
"displayName": "ISWC Code Detector"
}
],
"name": "ISRC and ISWC Code Detection Rule",
"logicalOp": "ANY"
}
]
},
"payload": [
"Non Matching Payload",
"US-S1Z-99-00001 is an example ISRC Code: ",
"The ISWC for Symphony No. 9 is T-905.029.737-5"
]
}
'{
"findings": [
[],
[
{
"finding": "US-S1Z-99-00001",
"detector": {
"name": "ISRC Code Detector",
"uuid": "d8be87c9-4b44-41fd-b78c-8d638fe56069"
},
"confidence": "LIKELY",
"location": {
"byteRange": {
"start": 0,
"end": 15
},
"codepointRange": {
"start": 0,
"end": 15
}
},
"matchedDetectionRuleUUIDs": [],
"matchedDetectionRules": [
"ISRC and ISWC Code Detection Rule"
]
}
],
[
{
"finding": "T-905.029.737-5",
"detector": {
"name": "ISWC Code Detector",
"uuid": "faf4c830-f2ac-4934-bf9c-ff20f5a6f420"
},
"confidence": "LIKELY",
"location": {
"byteRange": {
"start": 31,
"end": 46
},
"codepointRange": {
"start": 31,
"end": 46
}
},
"matchedDetectionRuleUUIDs": [],
"matchedDetectionRules": [
"ISRC and ISWC Code Detection Rule"
]
}
]
]
}curl --location --request POST 'https://api.nightfall.ai/v3/scan' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--header 'x-api-key: NF-rEpLaCeM3w1ThYoUrNiGhTfAlLKeY123' \
--data-raw '{
"config": {
"detectionRules": [
{
"detectors": [
{
"wordList": {
"values": [
"cat",
"dog",
"rat"
],
"isCaseSensitive": false
},
"minNumFindings": 1,
"minConfidence": "POSSIBLE",
"displayName": "animals",
"detectorType": "WORD_LIST"
}
],
"name": "WordListExamples",
"logicalOp": "ANY"
}
]
},
"payload": [
"THE CAT SAT ON THE MAT",
"The dog and the rat are on the west bank of the river",
"No one here but use chickens"
]
}'{
"findings": [
[
{
"finding": "cat",
"detector": {
"name": "animals",
"uuid": "c033e224-034a-417f-9c0d-0c8d13f462bb"
},
"confidence": "LIKELY",
"location": {
"byteRange": {
"start": 4,
"end": 7
},
"codepointRange": {
"start": 4,
"end": 7
}
},
"matchedDetectionRuleUUIDs": [],
"matchedDetectionRules": [
"WordListExamples"
]
}
],
[
{
"finding": "dog",
"detector": {
"name": "animals",
"uuid": "c033e224-034a-417f-9c0d-0c8d13f462bb"
},
"confidence": "LIKELY",
"location": {
"byteRange": {
"start": 4,
"end": 7
},
"codepointRange": {
"start": 4,
"end": 7
}
},
"matchedDetectionRuleUUIDs": [],
"matchedDetectionRules": [
"WordListExamples"
]
},
{
"finding": "rat",
"detector": {
"name": "animals",
"uuid": "c033e224-034a-417f-9c0d-0c8d13f462bb"
},
"confidence": "LIKELY",
"location": {
"byteRange": {
"start": 16,
"end": 19
},
"codepointRange": {
"start": 16,
"end": 19
}
},
"matchedDetectionRuleUUIDs": [],
"matchedDetectionRules": [
"WordListExamples"
]
}
],
[]
],
"redactedPayload": [
"",
"",
""
]
}{
"findings":[
{
"path":"Sheet1 (5)",
"detector":{
"id":"e30d9a87-f6c7-46b9-a8f4-16547901e069",
"name":"US social security number (SSN)",
"version":1
},
"finding":"624-84-9182",
"confidence":"LIKELY",
"location":{
"byteRange":{
"start":2505,
"end":2516
},
"codepointRange":{
"start":2452,
"end":2463
},
"lineRange":{
"start":55,
"end":55
},
"rowRange":{
"start":55,
"end":55
},
"columnRange":{
"start":2,
"end":2
},
"commitHash":""
},
"matchedDetectionRuleUUIDs":[
"950833c9-8608-4c66-8a3a-0734eac11157"
],
"matchedDetectionRules":[
]
},
...curl --request POST \
--url https://api.nightfall.ai/v3/upload/02a0c5e1-c950-4e28-a988-f6fffefc4205/scan \
--header 'Accept: application/json' \
--header 'Authorization: Bearer NF-<Your API Key>' \
--header 'Content-Type: application/json' \
--data '
{
"policy": {
"detectionRuleUUIDs": [
"950833c9-8608-4c66-8a3a-0734eac11157"
],
"alertConfig": {
"email": {
"address": "<your email addres>"
}
},
"defaultRedactionConfig": {
"maskConfig": {
"charsToIgnore": [
"-",
"@"
],
"maskingChar": "*"
}
},
"enableFileRedaction": true
},
"requestMetadata": "csv redaction test"
}
'{
"errors":null,
"findingsPresent":true,
"findingsURL":"https://files.nightfall.ai/asdfc5e1-c950-4e28-a988-f6fffefc4205.json?Expires=1655324479&Signature=zjo1nT-PECHC-fiTvAgdA8aDnceoY~6iGfzOBCcBjscKqOHnIar8hoH4gGufffiulBw5BpfJuvWwBW~lXO~ZNhN139LDwoTsfLJswJiQCB2Hj-Az0Em6go~1j8WBqCS8G0Gk17M-zcPedHGX3z~1pw8nm5sh6Pa-jJwfw9NIEiqmBb3Vdcj3J-~Wzag~ENV4499rnG299ee-ig5Ms1oVlzycb4YxzgTMrTL5Q07ozNenwFZcGDNQre1inLXmV-m8teLX-K3boklenp9KXiNDDV0wi74ADN-QfIR1q1oU7mEI1f3aVC3kju0QRErp2lsfs08EtZKLE3C4N17jDJdYcw__&Key-Pair-Id=K24YOPZ1EKX0YC",
"redactedFile":{
"fileURL":"https://files.nightfall.ai/asdfc5e1-c950-4e28-a988-f6fffefc4205-redacted.csv?Expires=1655324479&Signature=Hx8kRh88maLeStysy3fsLbFVG9VELEtfemtQe2lWUnFjAMd9HqlEksTmirqAWFWV4zPVUB73izlMj5cSer8v2N5ZCcnD3dz~nnwR4P5LewGJ2CQzGnDnXgh70HW5qp04gnUD-pYWp~bGPVspkJKCkl1zH-EoGonvcNVq3SNsVzOlsVIjep7Y7otQKEEyAZ7JmHiVfuBxrvn8pleuC5lEJ3f9miPyoRqH9DyPlNTJTIuijqe9q32Qcui2RsDR6IT-foFX52dy6rRa01ZV0gZMDWJokMlCr8Iu5An~qnhxC49bqTtI82oz9FcBaP-Yea8cq1TiAfGxX7CJ0~JeTLvr6g__&Key-Pair-Id=K24YOPZ1EKX0YC",
"validUntil":"2022-06-15T20:21:19.750990823Z"
},
"requestMetadata":"csv redaction test",
"uploadID":"02a0c5e1-c950-4e28-a988-f6fffefc4205",
"validUntil":"2022-06-15T20:21:19.723045787Z"
}name,email,phone,alphanumeric
Ulric Burton,*****@*************,*-***-***-****,TEL82EBM1GQ
Wade Jones,******************@***********,(********-****,VVF64PJV2EF
Molly Mccullough,*****************@**********,(********-****,OHO41SFZ2BR
Raja Riggs,************@**********,(********-****,UVD51JTE5NZ
Colin Carter,**********************@*********,(********-****,LNI34LLC5WV// Some code{
"findings":[
{
"path":"f607a067..53e59684/nightfall.go",
"detector":{
"id":"6123060e-2d9f-4f35-a7a1-743379ea5616",
"name":"URL"
},
"finding":"https://api.nightfall.ai/\"",
"confidence":"LIKELY",
"location":{
"byteRange":{
"start":142,
"end":168
},
"codepointRange":{
"start":142,
"end":168
},
"lineRange":{
"start":16,
"end":16
},
"rowRange":{
"start":0,
"end":0
},
"columnRange":{
"start":0,
"end":0
},
"commitHash":"53e59684d9778ceb0f0ed6a4b949c464c24d35ce"
},
"beforeContext":"tp\"\n\t\"os\"\n\t\"time\"\n)\n\nconst (\n\tAPIURL = \"",
"afterContext":"\n\n\tDefaultFileUploadConcurrency = 1\n\tDef",
"matchedDetectionRuleUUIDs":[
"cda0367f-aa75-4d6a-904f-0311209b3383"
],
"matchedDetectionRules":[
]
},
...cd nightfall-go-sdk
git checkout 53e59684d9778ceb0f0ed6a4b949c464c24d35ce{
"findingsURL": "https://files.nightfall.ai/asdfasdf-asdf-asdf-asdf-asdfasdfasdf.json?Expires=1635135397&Signature=asdfasdfQ2qTmPFnS9uD5I3QGEqHY2KlsYv4S-WOeEEROj~~x6W2slP2GvPPgPlYs~lwdr-mtJjVFu4LtyDhdfYezC7B0ysfJytyMIyAFriVMqOGsRJXqoQfsg8Ckd2b6kRcyDZXJE25cW8zBS08lyVwMBCsGS0BKSin8uSuD7pQu3QAubT7p~MPkfc6PSXYIJREBr3q4-8c7UnrYOAiXfSW1AmFE47rr3Wxh2TpU3E-Fxu-6e3DKN4q6meACdgZb2KHZo3e-NK7ug9f8sxBp1YT0n5oiVuW4KXguIyXWN~aKEHMa6DzZ4cUJ61LmnMzGndc2sVKhii39FHwTsYog__&Key-Pair-Id=asdfOPZ1EKX0YC",
"validUntil": "2021-10-25T04:16:37.734633129Z",
"uploadID": "152848af-2ac9-4e0a-8563-2b82343d964a",
"findingsPresent": true,
"requestMetadata": "",
"errors": []
}{
"findings":[
{
"path":"fileupload/upload.py",
"detector":{
"id":"58861dee-b213-4dbc-97fa-a148acb8bd1a",
"name":"localhost url"
},
"finding":"http://localhost",
"confidence":"LIKELY",
"location":{
"byteRange":{
"start":105,
"end":121
},
"codepointRange":{
"start":105,
"end":121
},
"lineRange":{
"start":7,
"end":7
}
},
"beforeContext":"PLOAD_URL = getenv(\"FILE_UPLOAD_HOST\", \"",
"afterContext":":8080/v3\")\nNF_API_KEY = getenv(\"NF_API_K",
"matchedDetectionRuleUUIDs":[
"950833c9-8608-4c66-8a3a-0734eac11157"
],
"matchedDetectionRules":[
]
},
{
"path":"fileupload/README.md",
"detector":{
"id":"58861dee-b213-4dbc-97fa-a148acb8bd1a",
"name":"localhost url"
},
"finding":"http://localhost",
"confidence":"LIKELY",
"location":{
"byteRange":{
"start":570,
"end":586
},
"codepointRange":{
"start":570,
"end":586
},
"lineRange":{
"start":22,
"end":22
}
},
"beforeContext":"t the script will send the requests to `",
"afterContext":":8080`, but this can be overridden using",
"matchedDetectionRuleUUIDs":[
"950833c9-8608-4c66-8a3a-0734eac11157"
],
"matchedDetectionRules":[
]
},
{
"path":"fileupload/README.md",
"detector":{
"id":"58861dee-b213-4dbc-97fa-a148acb8bd1a",
"name":"localhost url"
},
"finding":"http://localhost",
"confidence":"LIKELY",
"location":{
"byteRange":{
"start":965,
"end":981
},
"codepointRange":{
"start":965,
"end":981
},
"lineRange":{
"start":26,
"end":26
}
},
"beforeContext":"ice deployment you want to connect to | ",
"afterContext":":8080 |\n| `NF_API_KEY` | the API Ke",
"matchedDetectionRuleUUIDs":[
"950833c9-8608-4c66-8a3a-0734eac11157"
],
"matchedDetectionRules":[
]
}
]
}The UUID of the policy to update
Successful response (processed immediately)
Invalid request parameters
Authentication failure
Operation prohibited on the policy
Policy not found
Rate Limit Exceeded or Daily Quota Exceeded
Internal Nightfall Error
The UUID of the policy to update
Successful response (processed immediately)
Invalid request parameters
Authentication failure
Operation prohibited on the policy
Policy not found
Rate Limit Exceeded or Daily Quota Exceeded
Internal Nightfall Error
The maximum number of records to be returned in the response
100Cursor for getting the next page of results
Successful response
Invalid request parameters
Authentication failure
Rate Limit Exceeded or Daily Quota Exceeded
Internal Nightfall Error
The maximum number of agents to be returned in the response
500Cursor for getting the next page of results
Successful response
Invalid request parameters
Authentication failure
Rate Limit Exceeded or Daily Quota Exceeded
Internal Nightfall Error
POST /policy/v1/{policyID}/scope/domains HTTP/1.1
Host: api.nightfall.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 96
{
"add": {
"include": [
"text"
],
"exclude": [
"text"
]
},
"delete": {
"include": [
"text"
],
"exclude": [
"text"
]
}
}GET /apps/v1/github/repositories HTTP/1.1
Host: api.nightfall.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
GET /apps/v1/endpoint/devices HTTP/1.1
Host: api.nightfall.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
policyconfig
POST /policy/v1/{policyID}/scope/users HTTP/1.1
Host: api.nightfall.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 136
{
"add": {
"include": [
"[email protected]"
],
"exclude": [
"[email protected]"
]
},
"delete": {
"include": [
"[email protected]"
],
"exclude": [
"[email protected]"
]
}
}{
"includedUsers": [
"text"
],
"excludedUsers": [
"text"
]
}{
"includedDomains": [
"text"
],
"excludedDomains": [
"text"
]
}{
"repositories": [
{
"repositoryID": 1,
"repositoryName": "text",
"isRepoPrivate": true,
"repoLink": "text",
"scannedAt": 1,
"isMonitored": true,
"githubUsername": "text"
}
],
"nextPageToken": "text"
}{
"agents": [
{
"os": "MAC_OS",
"deviceName": "text",
"deviceId": "text",
"macAddresses": [
"text"
],
"connectionStatus": "CONNECTED",
"lastConnection": "2026-03-03T18:32:03.192Z",
"agentVersion": "text",
"osVersion": "text"
}
],
"totalAgents": 1,
"nextPageToken": "text"
}{
"policy": {
"detectionRules": [
{
"detectors": [
{
"detectorType": "NIGHTFALL_DETECTOR",
"nightfallDetector": "US_SOCIAL_SECURITY_NUMBER",
"minNumFindings": 1,
"minConfidence": "LIKELY",
"displayName": "US Social Security Number"
}
],
"name": "SSN Match Detection Rule",
"logicalOp": "ALL"
}
],
"contextBytes": 5,
"alertConfig": {
"email": {
"address": "[email protected]"
}
}
},
"payload": [
"The customer's social security number is 555-55-5555",
"No SSN in this string"
]
}{
"findings": [
[
{
"finding": "555-55-5555",
"beforeContext": "r is ",
"detector": {
"name": "US Social Security Number",
"uuid": "e30d9a87-f6c7-46b9-a8f4-16547901e069"
},
"confidence": "VERY_LIKELY",
"location": {
"byteRange": {
"start": 41,
"end": 52
},
"codepointRange": {
"start": 41,
"end": 52
},
"rowRange": null,
"columnRange": null,
"commitHash": ""
},
"matchedDetectionRuleUUIDs": [],
"matchedDetectionRules": [
"SSN Match Detection Rule"
]
}
],
[]
],
"redactedPayload": [
"",
""
]
}curl --request POST \
--url https://api.nightfall.ai/v3/scan \
--header 'accept: application/json' \
--header 'authorization: Bearer <InsertYourApiKeyHere>' \
--header 'content-type: application/json' \
--data '
{
"policyUUIDs": [
"2b2ced32-80c3-4a89-8757-489743ec4640"
],
"payload": [
"My payload to scan"
]
}
'{
"redactedPayload": [
"",
""
],
"findings": [
[
{
"confidence": "LIKELY",
"matchedDetectionRules": [
"SSN Match Detection Rule"
],
"matchedDetectionRuleUUIDs": [],
"location": {
"codepointRange": {
"start": 41,
"end": 52
},
"rowRange": null,
"byteRange": {
"start": 41,
"end": 52
},
"columnRange": null,
"commitHash": ""
},
"finding": "555-55-5555",
"detector": {
"name": "SSN Match Detector",
"uuid": "7270ccd5-07c5-44e5-b280-c768e0028963"
},
"beforeContext": "r is "
}
],
[]
]
}
{
"policy": {
"detectionRuleUUIDs": [
"c8d43147-0a63-4c01-8a57-83d8108422f5"
],
"alertConfig": {
"url": {
"address": "https://mywebhookurl.com"
}
}
},
"payload": [
"The customer's social security number is 555-55-5555"
]
}{
"policy": {
"detectionRules": [
{
"detectors": [
{
"detectorType": "NIGHTFALL_DETECTOR",
"nightfallDetector": "US_SOCIAL_SECURITY_NUMBER",
"minNumFindings": 1,
"minConfidence": "LIKELY",
"displayName": "US Social Security Number"
}
],
"name": "Simple SSN Match Detection Rule",
"logicalOp": "ALL"
}
],
"alertConfig": {
"slack": {
"target": "#securityalert"
}
}
},
"payload": [
"The customer's social security number is 555-55-5555",
"No SSN in this string"
]
}{
"policy": {
"detectionRules": [
{
"detectors": [
{
"nightfallDetector": "CREDIT_CARD_NUMBER",
"detectorType": "NIGHTFALL_DETECTOR",
"minConfidence": "POSSIBLE",
"minNumFindings": 1
}
],
"logicalOp": "ALL"
}
],
"alertConfig": {
"email": {
"address": "<your email>"
},
"siem": {
"sensitiveHeaders": {
"Authorization": "Splunk <your token value>"
},
"address": "https://http-inputs-<yourhost>.splunkcloud.com:8088/services/collector/event"
}
}
},
"payload": [
"4916-6734-7572-5015 is my credit card number",
"This string does not have any sensitive data",
"my api key is yr+ZWwIZp6ifFgaHV8410b2BxbRt5QiAj1EZx1qj and my 💳 credit card number 💰 is 30204861594838"
]
}
{
"policy": {
"detectionRules": [
{
"detectors": [
{
"detectorType": "NIGHTFALL_DETECTOR",
"nightfallDetector": "US_SOCIAL_SECURITY_NUMBER",
"minNumFindings": 1,
"minConfidence": "LIKELY",
"displayName": "US Social Security Number"
}
],
"name": "Simple SSN Match Detection Rule",
"logicalOp": "ALL"
}
],
"defaultRedactionConfig": {
"maskConfig": {
"charsToIgnore": [
"-"
],
"maskingChar": "#",
"numCharsToLeaveUnmasked": 4,
"maskLeftToRight": true
}
},
"contextBytes": 5,
"alertConfig": {
"email": {
"address": "[email protected]"
}
}
},
"payload": [
"The customers social security number is 555-55-5555",
"No SSN in this string"
]
}nightfall
Flask
Gunicornexport NIGHTFALL_API_KEY=<your_key_here>
export NIGHTFALL_SIGNING_SECRET=<your_secret_here>import os
from flask import Flask, request, render_template
from nightfall import Confidence, DetectionRule, Detector, RedactionConfig, MaskConfig, Nightfall
from datetime import datetime, timedelta
import urllib.request, urllib.parse, json
app = Flask(__name__)
nightfall = Nightfall(
key=os.getenv('NIGHTFALL_API_KEY'),
signing_secret=os.getenv('NIGHTFALL_SIGNING_SECRET')
)@app.route("/ping")
def ping():
return "Hello World", 200[2021-11-26 14:22:53 -0800] [61196] [INFO] Starting gunicorn 20.1.0
[2021-11-26 14:22:53 -0800] [61196] [INFO] Listening at: http://127.0.0.1:8000 (61196)
[2021-11-26 14:22:53 -0800] [61196] [INFO] Using worker: sync
[2021-11-26 14:22:53 -0800] [61246] [INFO] Booting worker with pid: 61246Account Nightfall Example
Version 2.3.40
Region United States (us)
Web Interface http://127.0.0.1:4040
Forwarding http://3ecedafba368.ngrok.io -> http://localhost:8000
Forwarding https://3ecedafba368.ngrok.io -> http://localhost:8000export NIGHTFALL_SERVER_URL=https://3ecedafba368.ngrok.io# respond to POST requests at /ingest
# Nightfall will send requests to this webhook endpoint with file scan results
@app.route("/ingest", methods=['POST'])
def ingest():
data = request.get_json(silent=True)
# validate webhook URL with challenge response
challenge = data.get("challenge")
if challenge:
return challenge
# challenge was passed, now validate the webhook payload
else:
# get details of the inbound webhook request for validation
request_signature = request.headers.get('X-Nightfall-Signature')
request_timestamp = request.headers.get('X-Nightfall-Timestamp')
request_data = request.get_data(as_text=True)
if nightfall.validate_webhook(request_signature, request_timestamp, request_data):
# check if any sensitive findings were found in the file, return if not
if not data["findingsPresent"]:
print("No sensitive data present!")
return "", 200
# there are sensitive findings in the file
# URL escape the temporary signed S3 URL where findings are available for download
escaped_url = urllib.parse.quote(data['findingsURL'])
# print the download URL and the URL where we can view the results in our web app
print(f"Sensitive data present. Findings available until {data['validUntil']}.\n\nDownload:\n{data['findingsURL']}\n\nView:\n{request.url_root}view?findings_url={escaped_url}\n")
return "", 200
else:
return "Invalid webhook", 500import os
from nightfall import Confidence, DetectionRule, Detector, RedactionConfig, MaskConfig, Nightfall
nightfall = Nightfall() # reads API key from NIGHTFALL_API_KEY environment variable by default
filepath = "sample-pci-xs.csv" # sample file with sensitive data
webhook_url = f"{os.getenv('NIGHTFALL_SERVER_URL')}/ingest"scan_id, message = nightfall.scan_file(filepath,
webhook_url=webhook_url,
detection_rules=[ DetectionRule([
Detector(
min_confidence=Confidence.LIKELY,
nightfall_detector="CREDIT_CARD_NUMBER",
display_name="Credit Card Number"
)])
])
print(scan_id, message)Sensitive data present. Findings available until 2021-11-28T00:29:00.479700877Z.
Download:
https://files.nightfall.ai/d2160270-6b07-4304-b1ee-e7b98498be82.json?Expires=1638059340&Signature=AjSdNGlXWGXO0QGSi-lOoDBtbhJdLPE7IWXA7IaBCfLr~3X2IcZ1vavHF5iaEDaoZ-3etnZA4Nu8K8Dq8Kd81ShuX6Ze1o87mzb~8lD6WBk8hXShgW-TPBPpLMoBx2sA9TnefTqy94gI4ykt4tt1MttB67Cj69Miw-46cpFkgY9tannNPOF-90b3vlcS44PwqDUGrtTpQiN6WdsTT6LbpN1N92KbPJIRj3PkGwQW7VvpfM8L4wKmyVmVnRO3ixaW-mXXiOWk9rmfHP9UFMYnk99yaGHp4dZ1JfJiClci~Z8dBx288CrvXVjGUCXBJbdlwo6UrKQJCEk9i9vSbCpI2Q__&Key-Pair-Id=K24YOPZ1EKX0YC
View:
https://d3vwatchtower.ngrok.io/ingest/view?findings_url=https%3A//files.nightfall.ai/d2160270-6b07-4304-b1ee-e7b98498be82.json%3FExpires%3D1638059340%26Signature%3DAjSdNGlXWGXO0QGSi-lOoDBtbhJdLPE7IWXA7IaBCfLr~3X2IcZ1vavHF5iaEDaoZ-3etnZA4Nu8K8Dq8Kd81ShuX6Ze1o87mzb~8lD6WBk8hXShgW-TPBPpLMoBx2sA9TnefTqy94gI4ykt4tt1MttB67Cj69Miw-46cpFkgY9tannNPOF-90b3vlcS44PwqDUGrtTpQiN6WdsTT6LbpN1N92KbPJIRj3PkGwQW7VvpfM8L4wKmyVmVnRO3ixaW-mXXiOWk9rmfHP9UFMYnk99yaGHp4dZ1JfJiClci~Z8dBx288CrvXVjGUCXBJbdlwo6UrKQJCEk9i9vSbCpI2Q__%26Key-Pair-Id%3DK24YOPZ1EKX0YC# respond to GET requests at /view
# Users can access this page to view their file scan results in a table
@app.route("/view")
def view():
# get the findings URL from the query parameters
findings_url = request.args.get('findings_url')
if findings_url:
# download the findings from the findings URL and parse them as JSON
with urllib.request.urlopen(findings_url) as url:
data = json.loads(url.read().decode())
# render the view.html template and provide the findings object to display in the template
return render_template('view.html', findings=data['findings'])<!DOCTYPE HTML>
<html>
<head>
<title>File Scan Viewer</title>
<style>
table, th, td {
border: 1px solid black;
}
table {
width: 100%;
}
</style>
</head>
<body>
<table>
<thead>
<tr>
<th>Detector</th>
<th>beforeContext</th>
<th>Finding</th>
<th>afterContext</th>
<th>byteRangeStart</th>
<th>byteRangeEnd</th>
<th>Confidence</th>
</tr>
</thead>
<tbody>
{% for finding in findings %}
<tr>
<td>{{ finding['detector']['name'] }}</td>
<td>{{ finding['beforeContext'] }}</td>
<td>{{ finding['finding'] }}</td>
<td>{{ finding['afterContext'] }}</td>
<td>{{ finding['location']['byteRange']['start'] }}</td>
<td>{{ finding['location']['byteRange']['start'] }}</td>
<td>{{ finding['confidence'] }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</body>
</html>NIGHTFALL_API_KEY
NIGHTFALL_SIGNING_SECRETexport NIGHTFALL_SERVER_URL=https://your-app-url.onrender.com
python3 scan.pyNov 26 04:29:06 PM Sensitive data present. Findings available until 2021-11-28T00:28:24.564972786Z.
Nov 26 04:29:06 PM
Nov 26 04:29:06 PM Download:
Nov 26 04:29:06 PM https://files.nightfall.ai/d6b6ee4f-d1a8-4fb6-b35a-cb6f88d58083.json?Expires=1638059304&Signature=hz1TN5UXjCGTxCxq~jT2wfuUWlj9Se-mWNL1K-tJhiAIXUg1FxJrCVP2iH1I4TNymFBuOnj5TTiLGpD8tZAKGm9J0lTHncZkaeaU8KZQ2j-~8qYQVlunNj019sqtTkMbVRfakzYzW-qWHEvLXN-PFcGYX05g3LZHvW802-lAVlM-WpGApw2u8BnzoY1pdWAxpJ0VIN1Zax4UuVeQBKieR7k8H9v9HdYYJlVGkVA5F9EzklLy99fyD8r4WR~jfqN5Fr1KceDtsxffC6MPuZ8nIIdSG5~tVtjCjgIjyh3IePPW1Wq-E8yZiVAhpDDbYX1wngUTwlAu~MU7N39vd8mlYQ__&Key-Pair-Id=K24YOPZ1EKX0YC
Nov 26 04:29:06 PM
Nov 26 04:29:06 PM View:
Nov 26 04:29:06 PM https://flask-file-scanner-example.onrender.com/view?findings_url=https%3A//files.nightfall.ai/d6b6ee4f-d1a8-4fb6-b35a-cb6f88d58083.json%3FExpires%3D1638059304%26Signature%3Dhz1TN5UXjCGTxCxq~jT2wfuUWlj9Se-mWNL1K-tJhiAIXUg1FxJrCVP2iH1I4TNymFBuOnj5TTiLGpD8tZAKGm9J0lTHncZkaeaU8KZQ2j-~8qYQVlunNj019sqtTkMbVRfakzYzW-qWHEvLXN-PFcGYX05g3LZHvW802-lAVlM-WpGApw2u8BnzoY1pdWAxpJ0VIN1Zax4UuVeQBKieR7k8H9v9HdYYJlVGkVA5F9EzklLy99fyD8r4WR~jfqN5Fr1KceDtsxffC6MPuZ8nIIdSG5~tVtjCjgIjyh3IePPW1Wq-E8yZiVAhpDDbYX1wngUTwlAu~MU7N39vd8mlYQ__%26Key-Pair-Id%3DK24YOPZ1EKX0YC{
"minNumFindings":1,
"minConfidence":"POSSIBLE",
"detectorType":"NIGHTFALL_DETECTOR",
"nightfallDetector":"DATE_OF_BIRTH",
"redactionConfig":{
"maskConfig":{
"charsToIgnore":[
"/"
],
"maskingChar":"?",
"maskRightToLeft":true,
"numCharsToLeaveUnMasked":2
}
}
}{
"minNumFindings":1,
"minConfidence":"POSSIBLE",
"detectorType":"NIGHTFALL_DETECTOR",
"nightfallDetector":"EMAIL_ADDRESS",
"displayName":"email",
"redactionConfig":{
"cryptoConfig":{
"publicKey":"-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAydYMwOYUGyBXDgHkzv19YR/dYQES4kYTMUps39qv/amNDywz4nsBDvCUqUvcN3nEpplHlYGH5ShSeA4G/FcmRqynSLVyFPZat/8E7n+EeHsgihFrr8oDWo5UBjCwRinTrC0m11q/5SeNzwVCWkf9x40u94QBz13dQoa9yPwaZBX5uBzyH86R7yeZHpad2cLq0ltpmJ3j5UfsFilkOb3JB60TNpNDdfabprot/y30CEnDDOgAXGtV1m0AhQpQjKRnkUs39DntqSbS+i0UgbyqzEGNUkeR1WsotXekW4KnbWA7k6S8SfkO27vnTSY5b9g/KKaOdysn5YaWJPfTVT/nywIDAQAB\n-----END PUBLIC KEY-----"
}
}
}curl --location --request POST 'https://api.nightfall.ai/v3/scan' \
--header 'x-api-key: NF-rEpLaCeM3w1ThYoUrNiGhTfAlLKeY123' \
--header 'Content-Type: text/plain' \
--data-raw '{
"payload":[
"my ssn is 123-45-5555 and date of birth is 01/11/1995 and my credit card number is 4242 4242 4242 4242 and my email is [email protected].",
"my date of birth is 03 23 4242 4242 4242 4242 amex"
],
"policy":{
"detectionRules":[
{
"detectors":[
{
"minNumFindings":1,
"minConfidence":"POSSIBLE",
"detectorType":"NIGHTFALL_DETECTOR",
"nightfallDetector":"CREDIT_CARD_NUMBER",
"displayName":"cc",
"redactionConfig":{
"infoTypeSubstitutionConfig":{
},
"removeFinding":true
}
},
{
"minNumFindings":1,
"minConfidence":"POSSIBLE",
"detectorType":"NIGHTFALL_DETECTOR",
"nightfallDetector":"US_SOCIAL_SECURITY_NUMBER",
"displayName":"ssn",
"redactionConfig":{
"substitutionConfig":{
"substitutionPhrase":"*REDACTED*"
}
}
},
{
"minNumFindings":1,
"minConfidence":"POSSIBLE",
"detectorType":"NIGHTFALL_DETECTOR",
"nightfallDetector":"EMAIL_ADDRESS",
"displayName":"email",
"redactionConfig":{
"cryptoConfig":{
"publicKey":"-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAydYMwOYUGyBXDgHkzv19YR/dYQES4kYTMUps39qv/amNDywz4nsBDvCUqUvcN3nEpplHlYGH5ShSeA4G/FcmRqynSLVyFPZat/8E7n+EeHsgihFrr8oDWo5UBjCwRinTrC0m11q/5SeNzwVCWkf9x40u94QBz13dQoa9yPwaZBX5uBzyH86R7yeZHpad2cLq0ltpmJ3j5UfsFilkOb3JB60TNpNDdfabprot/y30CEnDDOgAXGtV1m0AhQpQjKRnkUs39DntqSbS+i0UgbyqzEGNUkeR1WsotXekW4KnbWA7k6S8SfkO27vnTSY5b9g/KKaOdysn5YaWJPfTVT/nywIDAQAB\n-----END PUBLIC KEY-----"
}
}
},
{
"minNumFindings":1,
"minConfidence":"POSSIBLE",
"detectorType":"NIGHTFALL_DETECTOR",
"nightfallDetector":"DATE_OF_BIRTH",
"redactionConfig":{
"maskConfig":{
"charsToIgnore":[
"/"
],
"maskingChar":"?",
"maskRightToLeft":true,
"numCharsToLeaveUnMasked":2
}
}
}
],
"name":"cc",
"logicalOp":"ANY"
}
]
}
}'{
"findings":[
[
{
"finding":"[email protected]",
"redactedFinding":"X8QL0mZGHZ+N47nPEccjsLHf2F/5cFqjF16P6wgYJhy8IaxHipHWMBRAufKR4T8FFkvTuTEanu6ZAA+V8NTkNmTLxHarcWPSVClJ8kjXAPltLuR4I2H4eeT+sWEvUP3ik/BF1KcxRpsYWDQO1bNYk+WReXkWlW72Q7rbWuTGFj2uDFCPS+DUraDh9wNBsMPELFOnh1GSQIKCp9U5GMp/kkpo/0idh83RVHXyjZPT4ReKEST2oG2lQ9UuP5LJy/mHX1VYgd8DwlETn8nkhqJ1T0mGs6kHSh22G6N0ic0PjHnj73RiMnQdPwlLw3qyPmFf6RRLKtFuzmFan8ZGtZhcKA==",
"detector":{
"name":"email",
"uuid":"c0235299-0f26-4ad6-ad8c-71f83daf44e9"
},
"confidence":"VERY_LIKELY",
"location":{
"byteRange":{
"start":120,
"end":135
},
"codepointRange":{
"start":120,
"end":135
},
"rowRange":null,
"columnRange":null,
"commitHash":""
},
"redactedLocation":{
"byteRange":{
"start":120,
"end":135
},
"codepointRange":{
"start":120,
"end":135
},
"rowRange":null,
"columnRange":null,
"commitHash":""
},
"matchedDetectionRuleUUIDs":[
],
"matchedDetectionRules":[
"cc"
]
},
{
"finding":"01/11/1995",
"redactedFinding":"??/??/??95",
"detector":{
"name":"DATE_OF_BIRTH",
"uuid":"540856cb-99cb-42e7-b8aa-cd4f22f019d7"
},
"confidence":"LIKELY",
"location":{
"byteRange":{
"start":43,
"end":53
},
"codepointRange":{
"start":43,
"end":53
},
"rowRange":null,
"columnRange":null,
"commitHash":""
},
"redactedLocation":{
"byteRange":{
"start":43,
"end":53
},
"codepointRange":{
"start":43,
"end":53
},
"rowRange":null,
"columnRange":null,
"commitHash":""
},
"matchedDetectionRuleUUIDs":[
],
"matchedDetectionRules":[
"cc"
]
},
{
"finding":"",
"redactedFinding":"[CREDIT_CARD_NUMBER]",
"detector":{
"name":"cc",
"uuid":"74c1815e-c0c3-4df5-8b1e-6cf98864a454"
},
"confidence":"VERY_LIKELY",
"location":{
"byteRange":{
"start":84,
"end":103
},
"codepointRange":{
"start":84,
"end":103
},
"rowRange":null,
"columnRange":null,
"commitHash":""
},
"redactedLocation":{
"byteRange":{
"start":84,
"end":103
},
"codepointRange":{
"start":84,
"end":103
},
"rowRange":null,
"columnRange":null,
"commitHash":""
},
"matchedDetectionRuleUUIDs":[
],
"matchedDetectionRules":[
"cc"
]
},
{
"finding":"123-45-5555",
"redactedFinding":"*REDACTED*",
"detector":{
"name":"ssn",
"uuid":"e30d9a87-f6c7-46b9-a8f4-16547901e069"
},
"confidence":"VERY_LIKELY",
"location":{
"byteRange":{
"start":10,
"end":21
},
"codepointRange":{
"start":10,
"end":21
},
"rowRange":null,
"columnRange":null,
"commitHash":""
},
"redactedLocation":{
"byteRange":{
"start":10,
"end":21
},
"codepointRange":{
"start":10,
"end":21
},
"rowRange":null,
"columnRange":null,
"commitHash":""
},
"matchedDetectionRuleUUIDs":[
],
"matchedDetectionRules":[
"cc"
]
}
],
[
{
"finding":"",
"redactedFinding":"[CREDIT_CARD_NUMBER]",
"detector":{
"name":"cc",
"uuid":"74c1815e-c0c3-4df5-8b1e-6cf98864a454"
},
"confidence":"VERY_LIKELY",
"location":{
"byteRange":{
"start":26,
"end":45
},
"codepointRange":{
"start":26,
"end":45
},
"rowRange":null,
"columnRange":null,
"commitHash":""
},
"redactedLocation":{
"byteRange":{
"start":26,
"end":45
},
"codepointRange":{
"start":26,
"end":45
},
"rowRange":null,
"columnRange":null,
"commitHash":""
},
"matchedDetectionRuleUUIDs":[
],
"matchedDetectionRules":[
"cc"
]
},
{
"finding":"03 23 4242",
"redactedFinding":"????????42",
"detector":{
"name":"DATE_OF_BIRTH",
"uuid":"540856cb-99cb-42e7-b8aa-cd4f22f019d7"
},
"confidence":"LIKELY",
"location":{
"byteRange":{
"start":20,
"end":30
},
"codepointRange":{
"start":20,
"end":30
},
"rowRange":null,
"columnRange":null,
"commitHash":""
},
"redactedLocation":{
"byteRange":{
"start":20,
"end":30
},
"codepointRange":{
"start":20,
"end":30
},
"rowRange":null,
"columnRange":null,
"commitHash":""
},
"matchedDetectionRuleUUIDs":[
],
"matchedDetectionRules":[
"cc"
]
}
]
],
"redactedPayload":[
"my ssn is *REDACTED* and date of birth is ??/??/??95 and my credit card number is [CREDIT_CARD_NUMBER] and my email is X8QL0mZGHZ+N47nPEccjsLHf2F/5cFqjF16P6wgYJhy8IaxHipHWMBRAufKR4T8FFkvTuTEanu6ZAA+V8NTkNmTLxHarcWPSVClJ8kjXAPltLuR4I2H4eeT+sWEvUP3ik/BF1KcxRpsYWDQO1bNYk+WReXkWlW72Q7rbWuTGFj2uDFCPS+DUraDh9wNBsMPELFOnh1GSQIKCp9U5GMp/kkpo/0idh83RVHXyjZPT4ReKEST2oG2lQ9UuP5LJy/mHX1VYgd8DwlETn8nkhqJ1T0mGs6kHSh22G6N0ic0PjHnj73RiMnQdPwlLw3qyPmFf6RRLKtFuzmFan8ZGtZhcKA==.",
"my date of birth is [REDACTED BY NIGHTFALL] amex"
]
}nightfall
Flask
Gunicorn
watchdogexport NIGHTFALL_API_KEY=<your_key_here>
export NIGHTFALL_SIGNING_SECRET=<your_secret_here>import os
import time
from watchdog.observers import Observer
from watchdog.events import RegexMatchingEventHandler
from nightfall import Confidence, DetectionRule, Detector, RedactionConfig, MaskConfig, Nightfall
class MyHandler(RegexMatchingEventHandler):
# event handler callback that is called when a file is modified (created or changed)
def on_modified(self, event):
print(f'Event type: {event.event_type} | Path: {event.src_path}')
if __name__ == "__main__":
regexes = [ ".*" ]
# register event handler to monitor file paths that match our regex
event_handler = MyHandler(regexes)
observer = Observer()
observer.schedule(event_handler, path='', recursive=True)
observer.start()
try:
while True:
time.sleep(1)
except KeyboardInterrupt:
observer.stop()
observer.join()Event type: modified | Path: /Users/myuser/Library/Caches
Event type: modified | Path: /Users/myuser/Library/Caches/com.apple.nsservicescache.plist
Event type: modified | Path: /Users/myuser/Library/Caches
Event type: modified | Path: /Users/myuser/Library/Caches/Google/Chrome/Default/Cache
Event type: modified | Path: /private/tmp
Event type: modified | Path: /Users/myuser/Library/Preferences/ContextStoreAgent.plist
Event type: modified | Path: /private/tmp
Event type: modified | Path: /Users/myuser/Library/Assistant
Event type: modified | Path: /Users/myuser/Library/Assistant/SyncSnapshot.plist
...import os
import time
from watchdog.observers import Observer
from watchdog.events import RegexMatchingEventHandler
from nightfall import Confidence, DetectionRule, Detector, RedactionConfig, MaskConfig, Nightfall
class MyHandler(RegexMatchingEventHandler):
def scan_file(self, filepath):
nightfall = Nightfall() # reads API key from NIGHTFALL_API_KEY environment variable by default
webhook_url = f"{os.getenv('NIGHTFALL_SERVER_URL')}/ingest" # webhook server we'll create
try:
scan_id, message = nightfall.scan_file(
filepath,
webhook_url=webhook_url,
# detection rule to detect credit card numbers, SSNs, and API keys
detection_rules=[ DetectionRule([
Detector(
min_confidence=Confidence.LIKELY,
nightfall_detector="CREDIT_CARD_NUMBER",
display_name="Credit Card Number"),
Detector(
min_confidence=Confidence.LIKELY,
nightfall_detector="US_SOCIAL_SECURITY_NUMBER",
display_name="US Social Security Number"),
Detector(
min_confidence=Confidence.LIKELY,
nightfall_detector="API_KEY",
display_name="API Key")
])
])
return scan_id, message
except Exception as err:
print(f"Error processing {filepath} | {err}")
return None, None
def on_modified(self, event):
# scan file with Nightfall
scan_id, message = self.scan_file(event.src_path)
if scan_id:
print(f"Scan initiated | Path {event.src_path} | UploadID {scan_id}")
print(f'Event type: {event.event_type} | Path: {event.src_path}')
if __name__ == "__main__":
regexes = [ ".*/Downloads/.*", ".*/Desktop/.*", ".*/Documents/.*" ]
# register event handler to monitor file paths that match our regexes
event_handler = MyHandler(regexes)
observer = Observer()
observer.schedule(event_handler, path='', recursive=True)
observer.start()
try:
while True:
time.sleep(1)
except KeyboardInterrupt:
observer.stop()
observer.join()regexes = [ ".*/Downloads/.*", ".*/Desktop/.*", ".*/Documents/.*" ]regexes = [ "(?!/opt/|.*/Library/|.*/private/|/System/|/Applications/|/usr/).*" ]import os
from flask import Flask, request, render_template
from nightfall import Confidence, DetectionRule, Detector, RedactionConfig, MaskConfig, Nightfall
from datetime import datetime, timedelta
import urllib.request, urllib.parse, json
import csv
app = Flask(__name__)
nightfall = Nightfall(
key=os.getenv('NIGHTFALL_API_KEY'),
signing_secret=os.getenv('NIGHTFALL_SIGNING_SECRET')
)@app.route("/ping")
def ping():
return "Hello World", 200[2021-11-26 14:22:53 -0800] [61196] [INFO] Starting gunicorn 20.1.0
[2021-11-26 14:22:53 -0800] [61196] [INFO] Listening at: http://127.0.0.1:8000 (61196)
[2021-11-26 14:22:53 -0800] [61196] [INFO] Using worker: sync
[2021-11-26 14:22:53 -0800] [61246] [INFO] Booting worker with pid: 61246./ngrok http 8000Account Nightfall Example
Version 2.3.40
Region United States (us)
Web Interface http://127.0.0.1:4040
Forwarding http://3ecedafba368.ngrok.io -> http://localhost:8000
Forwarding https://3ecedafba368.ngrok.io -> http://localhost:8000export NIGHTFALL_SERVER_URL=https://3ecedafba368.ngrok.io# create CSV where sensitive findings will be written
headers = ["upload_id", "#", "datetime", "before_context", "finding", "after_context", "detector", "confidence", "loc", "detection_rules"]
with open(f"results.csv", 'a') as csvfile:
writer = csv.writer(csvfile)
writer.writerow(headers)
# respond to POST requests at /ingest
# Nightfall will send requests to this webhook endpoint with file scan results
@app.route("/ingest", methods=['POST'])
def ingest():
data = request.get_json(silent=True)
# validate webhook URL with challenge response
challenge = data.get("challenge")
if challenge:
return challenge
# challenge was passed, now validate the webhook payload
else:
# get details of the inbound webhook request for validation
request_signature = request.headers.get('X-Nightfall-Signature')
request_timestamp = request.headers.get('X-Nightfall-Timestamp')
request_data = request.get_data(as_text=True)
if nightfall.validate_webhook(request_signature, request_timestamp, request_data):
# check if any sensitive findings were found in the file, return if not
if not data["findingsPresent"]:
print("No sensitive data present!")
return "", 200
# there are sensitive findings in the file
output_results(data)
return "", 200
else:
return "Invalid webhook", 500def output_results(data):
findings_url = data['findingsURL']
# open findings URL provided by Nightfall to access findings
with urllib.request.urlopen(findings_url) as url:
findings = json.loads(url.read().decode())
findings = findings['findings']
print(f"Sensitive data found, outputting {len(findings)} finding(s) to CSV | UploadID {data['uploadID']}")
table = []
# loop through findings JSON, get relevant finding metadata, write each finding as a row into output CSV
for i, finding in enumerate(findings):
row = [
data['uploadID'],
i+1,
datetime.now(),
repr(finding['beforeContext']),
repr(finding['finding']),
repr(finding['afterContext']),
finding['detector']['name'],
finding['confidence'],
finding['location']['byteRange'],
finding['matchedDetectionRules']
]
table.append(row)
with open(f"results.csv", 'a') as csvfile:
writer = csv.writer(csvfile)
writer.writerow(row)
returnexport NIGHTFALL_SERVER_URL=https://3ecedafba368.ngrok.io
python scanner.pycurl https://raw.githubusercontent.com/nightfallai/dlp-sample-data/main/sample-pci.csv > ~/Downloads/sample-pci.csvEvent type: modified | Path: /Users/myuser/Downloads/sample-pci.csv
Scan initiated | Path /Users/myuser/Downloads/sample-pci.csv | UploadID c23fdde2-5e98-4183-90b0-31e2cdd20ac0Sensitive data found, outputting 10 finding(s) to CSV | UploadID ac6a4a9d-a7b9-4a78-810d-8a66f7644704upload_id,#,datetime,before_context,finding,after_context,detector,confidence,loc,detection_rules
ac6a4a9d-a7b9-4a78-810d-8a66f7644704,1,2021-12-04 22:12:21.039602,'Name\tCredit Card\nRep. Viviana Hintz\t','5433-9502-3725-7862','\nEloisa Champlin\t3457-389808-83234\nOmega',Credit Card Number,VERY_LIKELY,"{'start': 36, 'end': 55}",[]
...nohup python -u scanner.py > scanner.log &
nohup gunicorn app:app > server.log &Unix timestamp in seconds, filters records created ≥ the value, defaults to -180 days UTC
Unix timestamp in seconds, filters records created < the value, defaults to end of the current day UTC
Unix timestamp in seconds, filters records updated > the value
The maximum number of records to be returned in the response
50Cursor for getting the next page of results
Sort key and direction, defaults to descending order by creation time
TIME_DESCPossible values: The query containing filter clauses
Query structure and terminology
A query clause consists of a field followed by an operator followed by a value:
| term | value |
|---|---|
| clause | user_email:"[email protected]" |
| field | user_email |
| operator | : |
| value | [email protected] |
You can combine multiple query clauses in a search by separating them with a space.
Field types, substring matching, and numeric comparators
Every search field supports exact matching with a :. Certain fields such as user_email and user_name support substring matching.
Quotes
You may use quotation marks around string values. Quotation marks are required in case the value contains spaces. For example:
user_mail:[email protected]user_name:"John Doe"Special Characters
+ - && || ! ( ) { } [ ] ^ " ~ * ? : are special characters need to be escaped using \. For example:
(1+1):2 should be searched for using \(1\+1)\:2Search Syntax
The following table lists the syntax that you can use to construct a query.
| SYNTAX | USAGE | DESCRIPTION | EXAMPLES |
|---|---|---|---|
: |
field:value | Exact match operator (case insensitive) | state:"pending" returns records where the currency is exactly "PENDING" in a case-insensitive comparison |
(space) |
field1:value1 field2:value2 | The query returns only records that match both clauses | state:active slack.channel_name:general |
OR |
field:(value1 OR value2) | The query returns records that match either of the values (case insensitive) | state:(active OR pending) |
Query Fields
| param | description |
|---|---|
| event_id | the unique identifier of the posture event to filter on |
| integration_name | the name of the integration to filter on |
| state | the state of the event to filter on (active, pending, resolved, expired) |
| event_type | the type of posture event to filter on |
| actor_name | the name of the actor who performed the action to filter on |
| actor_email | the email of the actor who performed the action to filter on |
| user_name | the username of the user to filter on (backward compatibility) |
| user_email | the email of the user to filter on (backward compatibility) |
| notes | the comment or notes associated with the event to filter on |
| policy_id | the unique identifier of the policy to filter on |
| policy_name | the name of the policy to filter on |
| resource_id | the identifier of the resource to filter on |
| resource_name | the name of the resource to filter on |
| resource_owner_name | the name of the resource owner to filter on |
| resource_owner_email | the email of the resource owner to filter on |
| resource_content_type | the content type of the resource to filter on |
| endpoint.device_id | the device identifier for endpoint events to filter on |
| endpoint.machine_name | the machine name for endpoint events to filter on |
| gdrive.permission | the permission setting for Google Drive files to filter on |
| gdrive.shared_internal_email | the internal emails with which the file is shared to filter on |
| gdrive.shared_external_email | the external emails with which the file is shared to filter on |
| gdrive.drive | the Google Drive name to filter on |
| gdrive.file_owner | the owner of the Google Drive file to filter on |
| gdrive.label_name | the label name applied to Google Drive files to filter on |
| salesforce.report.scope | the scope of the Salesforce report to filter on |
| salesforce.report.event_source | the event source of the Salesforce report to filter on |
| salesforce.report.source_ip | the source IP address of the Salesforce report to filter on |
| salesforce.report.session_level | the session level of the Salesforce report to filter on |
| salesforce.report.operation | the operation type of the Salesforce report to filter on |
| salesforce.report.description | the description of the Salesforce report to filter on |
| salesforce.file.source_ip | the source IP address for Salesforce file events to filter on |
| salesforce.file.session_level | the session level for Salesforce file events to filter on |
Successful response
Invalid request parameters
Authentication failure
Rate Limit Exceeded or Daily Quota Exceeded
Internal Nightfall Error
Unix timestamp in seconds, filters records created ≥ the value, defaults to -90 days UTC
Unix timestamp in seconds, filters records created < the value, defaults to end of the current day UTC
Unix timestamp in seconds, filters records updated > the value
The maximum number of records to be returned in the response
50Cursor for getting the next page of results
Successful response
Invalid request parameters
Authentication failure
Rate Limit Exceeded or Daily Quota Exceeded
Internal Nightfall Error
The UUID of the event to fetch
Successful response
Invalid request parameters
Authentication failure
Event does not exist
Rate Limit Exceeded or Daily Quota Exceeded
Internal Nightfall Error
The UUID of the posture event
Number of activity items to fetch in one page
50Unix timestamp in seconds, filters activity created > the value
Unix timestamp in seconds, filters activity created < the value
Whether to sort results in descending order (default false)
falseCursor for getting the next page of results
Successful response
Invalid request parameters
Authentication failure
Event does not exist
Rate Limit Exceeded or Daily Quota Exceeded
Internal Nightfall Error
The ID of the asset to fetch activities for
Unix timestamp in seconds, filters activities created ≥ the value
Unix timestamp in seconds, filters activities created < the value
Cursor for getting the next page of results
Successful response
Invalid request parameters
Authentication failure
Rate Limit Exceeded or Daily Quota Exceeded
Internal Nightfall Error
The Nightfall ID of the actor to fetch activities for
Unix timestamp in seconds, filters activities created ≥ the value
Unix timestamp in seconds, filters activities created < the value
Cursor for getting the next page of results
Successful response
Invalid request parameters
Authentication failure
Rate Limit Exceeded or Daily Quota Exceeded
Internal Nightfall Error
{
"events": [
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"integration": "text",
"createdAt": 1,
"state": "text",
"eventType": "text",
"policyUUIDs": [
"123e4567-e89b-12d3-a456-426614174000"
],
"assetsCount": 1,
"userInfo": {
"username": "text",
"userEmail": "[email protected]",
"userProfileLink": "https://example.com",
"deviceId": "text",
"machineName": "text",
"isExternal": true
},
"appInfo": {
"id": "text",
"name": "text"
}
}
],
"nextPageToken": "text"
}{
"events": [
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"integration": "text",
"createdAt": 1,
"state": "text",
"eventType": "text",
"policyUUIDs": [
"123e4567-e89b-12d3-a456-426614174000"
],
"assetsCount": 1,
"userInfo": {
"username": "text",
"userEmail": "[email protected]",
"userProfileLink": "https://example.com",
"deviceId": "text",
"machineName": "text",
"isExternal": true
},
"appInfo": {
"id": "text",
"name": "text"
}
}
],
"nextPageToken": "text"
}{
"assets": {
"id": "text",
"name": "text",
"path": "text",
"sizeBytes": 1,
"mimetype": "text",
"owner": {
"id": "text",
"email": "[email protected]",
"comment": "text",
"metadata": {
"gdrive": {
"userBelongsToGroups": [
"text"
],
"isAdmin": true,
"isSuspended": true,
"createdAt": 1
},
"salesforce": {}
}
},
"comment": "text",
"ddrViolationIDs": [],
"metadata": {
"gdrive": {
"fileID": "text",
"fileName": "text",
"fileSize": "text",
"fileLink": "text",
"permissionSetting": "text",
"sharingExternalUsers": [
"text"
],
"sharingInternalUsers": [
"text"
],
"canViewersDownload": true,
"fileOwner": "text",
"isInTrash": true,
"createdAt": 1,
"updatedAt": 1,
"drive": "text",
"labels": [
"text"
],
"filePermissionType": "text"
},
"salesforce": {
"resourceType": "text",
"fileResourceMetadata": {
"fileAction": "text",
"sourceIP": "text",
"sessionLevel": "text"
},
"reportResourceMetadata": {
"description": "text",
"displayEntityFields": [
"text"
],
"dashboardName": "text",
"scope": "text",
"operation": "text",
"recordCount": 1,
"queriedEntities": [
"text"
],
"groupedColumnHeaders": [
"text"
],
"columnCount": 1,
"processedRowCount": 1,
"sourceIP": "text",
"eventSource": "text",
"sessionLevel": "text"
},
"bulkApiResourceMetadata": {
"query": "text",
"eventIdentifier": "text",
"sourceIP": "text",
"sessionKey": "text",
"sessionLevel": "text"
}
}
}
},
"actor": {
"id": "text",
"email": "[email protected]",
"comment": "text",
"metadata": {
"gdrive": {
"userBelongsToGroups": [
"text"
],
"isAdmin": true,
"isSuspended": true,
"createdAt": 1
},
"salesforce": {}
}
},
"events": {
"type": "PERMISSION_CHANGE",
"timestamp": 1,
"metadata": {
"gdrive": {
"originatingAppId": "text",
"originatingAppName": "text",
"isClientSyncEvent": true
},
"salesforce": {
"sourceIP": "text",
"sessionLevel": "text",
"sessionKey": "text",
"sfUserId": "text"
}
},
"assetIDs": []
}
}{
"activities": [
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"message": "text",
"timestamp": 1,
"type": "CREATION",
"data": {
"action": "ACKNOWLEDGE",
"userUUID": "123e4567-e89b-12d3-a456-426614174000",
"userName": "text",
"userEmail": "text",
"receiverEmail": "text",
"actionLogData": {
"applyLabelsActionLogData": {
"activityType": "LABELS_SUCCESSFULLY_APPLIED",
"labels": [
"text"
],
"labelUpdatesOnResource": {
"ANY_ADDITIONAL_PROPERTY": "text"
},
"failureReason": "text"
},
"setExpirationActionLogData": {
"expirationTime": 1
},
"revokeAccessActionLogData": {
"revokedEmails": [
"text"
],
"unRevokedEmails": [
"text"
]
},
"notifyEmailActionLogData": {
"receiverEmail": "text"
},
"genericActionLogData": {
"additionalContext": "text"
}
}
}
}
],
"nextPageToken": "text"
}{
"activities": [
{
"type": "DOWNLOAD",
"userEmail": "[email protected]",
"eventTime": 1,
"assetNames": [
"text"
],
"metadata": {
"downloadEventMetadata": {
"source": "text",
"fileName": "text"
},
"browserUploadMetadata": {
"domain": "text",
"fileName": "text"
},
"cloudSyncMetadata": {
"cloudApp": "text",
"fileName": "text"
},
"clipboardMetadata": {
"browserMetadata": {
"domain": "text"
}
}
}
}
],
"nextPageToken": "text"
}{
"activities": [
{
"type": "DOWNLOAD",
"userEmail": "[email protected]",
"eventTime": 1,
"assetNames": [
"text"
],
"metadata": {
"downloadEventMetadata": {
"source": "text",
"fileName": "text"
},
"browserUploadMetadata": {
"domain": "text",
"fileName": "text"
},
"cloudSyncMetadata": {
"cloudApp": "text",
"fileName": "text"
},
"clipboardMetadata": {
"browserMetadata": {
"domain": "text"
}
}
}
}
],
"nextPageToken": "text"
}GET /posture/v1/events HTTP/1.1
Host: api.nightfall.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
GET /posture/v1/events/{eventId} HTTP/1.1
Host: api.nightfall.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
GET /posture/v1/events/{eventId}/activity HTTP/1.1
Host: api.nightfall.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
GET /posture/v1/asset/activity?assetID=text&rangeStart=1&rangeEnd=1 HTTP/1.1
Host: api.nightfall.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
GET /posture/v1/actor/activity?actorID=text&rangeStart=1&rangeEnd=1 HTTP/1.1
Host: api.nightfall.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
GET /posture/v1/events/search?query=text HTTP/1.1
Host: api.nightfall.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
"mcpServers": {
"nightfall": {
"command": "npx",
"args": [
"-y",
"mcp-remote@latest",
"https://api.nightfall.ai/mcp",
"--header",
"Authorization: Bearer YOUR_NIGHTFALL_API_KEY"
]
}
}
}{
"mcpServers": {
"nightfall": {
"url": "https://api.nightfall.ai/mcp",
"headers": {
"Authorization": "Bearer YOUR_NIGHTFALL_API_KEY"
}
}
}
}{
"mcpServers": {
"nightfall": {
"serverUrl": "https://api.nightfall.ai/mcp",
"headers": {
"Authorization": "Bearer YOUR_NIGHTFALL_API_KEY"
}
}
}
}POST https://api.nightfall.ai/mcp
Authorization: Bearer YOUR_NIGHTFALL_API_KEY
Content-Type: application/jsonintegration_name:github AND risk_label:HIGH AND state:ACTIVEuser_email:[email protected] AND integration_name:slackuser_email:[email protected] OR user_email:[email protected]slack.channel_name:general AND state:PENDINGcreatedAfter=<unix_timestamp> AND risk_label:HIGHUnix timestamp in seconds, filters records created ≥ the value, defaults to -180 days UTC
Unix timestamp in seconds, filters records created < the value, defaults to end of the current day UTC
Unix timestamp in seconds, filters records updated > the value
The maximum number of records to be returned in the response
50Cursor for getting the next page of results
Sort key and direction, defaults to descending order by creation time
TIME_DESCPossible values: The query containing filter clauses
Query structure and terminology
A query clause consists of a field followed by an operator followed by a value:
| term | value |
|---|---|
| clause | user_email:"[email protected]" |
| field | user_email |
| operator | : |
| value | [email protected] |
You can combine multiple query clauses in a search by separating them with a space.
Field types, substring matching, and numeric comparators
Every search field supports exact matching with a :. Certain fields such as user_email and user_name support substring matching.
Quotes
You may use quotation marks around string values. Quotation marks are required in case the value contains spaces. For example:
user_mail:[email protected]user_name:"John Doe"Special Characters
+ - && || ! ( ) { } [ ] ^ " ~ * ? : are special characters need to be escaped using \. For example:
(1+1):2 should be searched for using \(1\+1)\:2Search Syntax
The following table lists the syntax that you can use to construct a query.
| SYNTAX | USAGE | DESCRIPTION | EXAMPLES |
|---|---|---|---|
: |
field:value | Exact match operator (case insensitive) | state:"pending" returns records where the currency is exactly "PENDING" in a case-insensitive comparison |
(space) |
field1:value1 field2:value2 | The query returns only records that match both clauses | state:active slack.channel_name:general |
OR |
field:(value1 OR value2) | The query returns records that match either of the values (case insensitive) | state:(active OR pending) |
Query Fields
| param | description |
|---|---|
| event_id | the unique identifier of the exfiltration event to filter on |
| integration_name | the name of the integration to filter on |
| state | the state of the event to filter on (active, pending, resolved, expired) |
| event_type | the type of exfiltration event to filter on |
| actor_name | the name of the actor who performed the action to filter on |
| actor_email | the email of the actor who performed the action to filter on |
| user_name | the username of the user to filter on (backward compatibility) |
| user_email | the email of the user to filter on (backward compatibility) |
| notes | the comment or notes associated with the event to filter on |
| policy_id | the unique identifier of the policy to filter on |
| policy_name | the name of the policy to filter on |
| resource_id | the identifier of the resource to filter on |
| resource_name | the name of the resource to filter on |
| resource_owner_name | the name of the resource owner to filter on |
| resource_owner_email | the email of the resource owner to filter on |
| resource_content_type | the content type of the resource to filter on |
| endpoint.device_id | the device identifier for endpoint events to filter on |
| endpoint.machine_name | the machine name for endpoint events to filter on |
| gdrive.permission | the permission setting for Google Drive files to filter on |
| gdrive.shared_internal_email | the internal emails with which the file is shared to filter on |
| gdrive.shared_external_email | the external emails with which the file is shared to filter on |
| gdrive.drive | the Google Drive name to filter on |
| gdrive.file_owner | the owner of the Google Drive file to filter on |
| gdrive.label_name | the label name applied to Google Drive files to filter on |
| salesforce.report.scope | the scope of the Salesforce report to filter on |
| salesforce.report.event_source | the event source of the Salesforce report to filter on |
| salesforce.report.source_ip | the source IP address of the Salesforce report to filter on |
| salesforce.report.session_level | the session level of the Salesforce report to filter on |
| salesforce.report.operation | the operation type of the Salesforce report to filter on |
| salesforce.report.description | the description of the Salesforce report to filter on |
| salesforce.file.source_ip | the source IP address for Salesforce file events to filter on |
| salesforce.file.session_level | the session level for Salesforce file events to filter on |
| last_actioned_by | the entity that performed the last action on the violation, can be one of NIGHTFALL, ADMIN or END_USER |
Successful response
Invalid request parameters
Authentication failure
Rate Limit Exceeded or Daily Quota Exceeded
Internal Nightfall Error
Unix timestamp in seconds, filters records created ≥ the value, defaults to -90 days UTC
Unix timestamp in seconds, filters records created < the value, defaults to end of the current day UTC
Unix timestamp in seconds, filters records updated > the value
The maximum number of records to be returned in the response
50Cursor for getting the next page of results
Successful response
Invalid request parameters
Authentication failure
Rate Limit Exceeded or Daily Quota Exceeded
Internal Nightfall Error
The UUID of the event to fetch
Successful response
Invalid request parameters
Authentication failure
Event does not exist
Rate Limit Exceeded or Daily Quota Exceeded
Internal Nightfall Error
The UUID of the exfiltration event
Number of activity items to fetch in one page
50Unix timestamp in seconds, filters activity created > the value
Unix timestamp in seconds, filters activity created < the value
Whether to sort results in descending order (default false)
falseCursor for getting the next page of results
Successful response
Invalid request parameters
Authentication failure
Event does not exist
Rate Limit Exceeded or Daily Quota Exceeded
Internal Nightfall Error
The ID of the asset to fetch activities for
Unix timestamp in seconds, filters activities created ≥ the value
Unix timestamp in seconds, filters activities created < the value
Cursor for getting the next page of results
Successful response
Invalid request parameters
Authentication failure
Rate Limit Exceeded or Daily Quota Exceeded
Internal Nightfall Error
The Nightfall ID of the actor to fetch activities for
Unix timestamp in seconds, filters activities created ≥ the value
Unix timestamp in seconds, filters activities created < the value
Cursor for getting the next page of results
Successful response
Invalid request parameters
Authentication failure
Rate Limit Exceeded or Daily Quota Exceeded
Internal Nightfall Error
The request body of the /v3/scan endpoint
A list of UUIDs referring to policies to use to scan the request payload. Policies can be built in the Nightfall Dashboard. Maximum 1.
The text sample(s) you wish to scan. This data is passed as a string list, so you may choose to segment your text into multiple items for better granularity. The aggregate size of your text (summed across all items in the list) must not exceed 500 KB for any individual request, and the number of items in that list may not exceed 50,000.
Success
Invalid request payload
Authentication failure
Unprocessable request payload
Rate Limit Exceeded or Monthly Quota Exceeded
Internal Nightfall Error
the number of bytes representing the size of the file to-be-uploaded.
Success
Invalid request payload
Authentication failure
Rate Limit Exceeded or Monthly Quota Exceeded
Internal Nightfall Error
a file ID returned from a previous file creation request
The numeric offset at which the bytes contained in the body should be written. This offset must be a multiple of the chunk size returned when the file upload was created.
The payload bytes to upload; the size of the request body must exactly match the chunkSize that was returned when the file upload was created.
Success
Invalid request payload
Authentication failure
Invalid File ID
Rate Limit Exceeded or Monthly Quota Exceeded
Internal Nightfall Error
No content
a file ID returned from a previous file creation request
Success
Invalid request payload
Authentication failure
Invalid File ID
File Upload in Incorrect State
Rate Limit Exceeded or Monthly Quota Exceeded
Internal Nightfall Error
a file ID returned from a previous file creation request
the UUID of the Detection Policy to be used with this scan. Exactly one of this field or "policy" should be provided.
A string containing arbitrary metadata. Callers may opt to use this to help identify their input file upon receiving a webhook response. Maximum length 10 KB.
Success
Invalid request payload
Authentication failure
Invalid File ID
Incorrect File State
Unprocessable request payload
Rate Limit Exceeded or Monthly Quota Exceeded
Internal Nightfall Error
GET /exfiltration/v1/events HTTP/1.1
Host: api.nightfall.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
GET /exfiltration/v1/events/{eventId} HTTP/1.1
Host: api.nightfall.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
GET /exfiltration/v1/events/{eventId}/activity HTTP/1.1
Host: api.nightfall.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
GET /exfiltration/v1/asset/activity?assetID=text&rangeStart=1&rangeEnd=1 HTTP/1.1
Host: api.nightfall.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
GET /exfiltration/v1/actor/activity?actorID=text&rangeStart=1&rangeEnd=1 HTTP/1.1
Host: api.nightfall.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
POST /v3/scan HTTP/1.1
Host: api.nightfall.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 1595
{
"policyUUIDs": [
"text"
],
"policy": {
"detectionRuleUUIDs": [
"text"
],
"detectionRules": [
{
"name": "text",
"logicalOp": "ANY",
"detectors": [
{
"minNumFindings": 1,
"minConfidence": "VERY_UNLIKELY",
"detectorUUID": "text",
"displayName": "text",
"detectorType": "NIGHTFALL_DETECTOR",
"nightfallDetector": "AMERICAN_BANKERS_CUSIP_ID",
"regex": {
"pattern": "text",
"isCaseSensitive": true
},
"wordList": {
"values": [
"text"
],
"isCaseSensitive": true
},
"contextRules": [
{
"regex": {
"pattern": "text",
"isCaseSensitive": true
},
"proximity": {
"windowBefore": 1,
"windowAfter": 1
},
"confidenceAdjustment": {
"fixedConfidence": "VERY_UNLIKELY"
}
}
],
"exclusionRules": [
{
"matchType": "PARTIAL",
"exclusionType": "REGEX",
"regex": {
"pattern": "text",
"isCaseSensitive": true
},
"wordList": {
"values": [
"text"
],
"isCaseSensitive": true
}
}
],
"redactionConfig": {
"maskConfig": {
"maskingChar": "text",
"charsToIgnore": [
"text"
],
"numCharsToLeaveUnmasked": 1,
"maskLeftToRight": true
},
"infoTypeSubstitutionConfig": {},
"substitutionConfig": {
"substitutionPhrase": "text"
},
"cryptoConfig": {
"publicKey": "text"
},
"removeFinding": true
},
"scope": "Content"
}
]
}
],
"contextBytes": 1,
"defaultRedactionConfig": {
"maskConfig": {
"maskingChar": "text",
"charsToIgnore": [
"text"
],
"numCharsToLeaveUnmasked": 1,
"maskLeftToRight": true
},
"infoTypeSubstitutionConfig": {},
"substitutionConfig": {
"substitutionPhrase": "text"
},
"cryptoConfig": {
"publicKey": "text"
},
"removeFinding": true
},
"alertConfig": {
"slack": {
"target": "text"
},
"email": {
"address": "text"
},
"url": {
"address": "text"
},
"siem": {
"address": "text",
"sensitiveHeaders": {
"ANY_ADDITIONAL_PROPERTY": "text"
},
"plainTextHeaders": {
"ANY_ADDITIONAL_PROPERTY": "text"
}
}
}
},
"payload": [
"text"
]
}POST /v3/upload HTTP/1.1
Host: api.nightfall.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 19
{
"fileSizeBytes": 1
}PATCH /v3/upload/{fileId} HTTP/1.1
Host: api.nightfall.ai
Authorization: Bearer YOUR_SECRET_TOKEN
X-Upload-Offset: 1
Content-Type: application/octet-stream
Accept: */*
POST /v3/upload/{fileId}/finish HTTP/1.1
Host: api.nightfall.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
POST /v3/upload/{fileId}/scan HTTP/1.1
Host: api.nightfall.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 1672
{
"policyUUID": "123e4567-e89b-12d3-a456-426614174000",
"policy": {
"detectionRuleUUIDs": [
"123e4567-e89b-12d3-a456-426614174000"
],
"detectionRules": [
{
"name": "text",
"logicalOp": "ANY",
"detectors": [
{
"minNumFindings": 1,
"minConfidence": "VERY_UNLIKELY",
"detectorUUID": "text",
"displayName": "text",
"detectorType": "NIGHTFALL_DETECTOR",
"nightfallDetector": "AMERICAN_BANKERS_CUSIP_ID",
"regex": {
"pattern": "text",
"isCaseSensitive": true
},
"wordList": {
"values": [
"text"
],
"isCaseSensitive": true
},
"contextRules": [
{
"regex": {
"pattern": "text",
"isCaseSensitive": true
},
"proximity": {
"windowBefore": 1,
"windowAfter": 1
},
"confidenceAdjustment": {
"fixedConfidence": "VERY_UNLIKELY"
}
}
],
"exclusionRules": [
{
"matchType": "PARTIAL",
"exclusionType": "REGEX",
"regex": {
"pattern": "text",
"isCaseSensitive": true
},
"wordList": {
"values": [
"text"
],
"isCaseSensitive": true
}
}
],
"redactionConfig": {
"maskConfig": {
"maskingChar": "text",
"charsToIgnore": [
"text"
],
"numCharsToLeaveUnmasked": 1,
"maskLeftToRight": true
},
"infoTypeSubstitutionConfig": {},
"substitutionConfig": {
"substitutionPhrase": "text"
},
"cryptoConfig": {
"publicKey": "text"
},
"removeFinding": true
},
"scope": "Content"
}
]
}
],
"alertConfig": {
"slack": {
"target": "text"
},
"email": {
"address": "text"
},
"url": {
"address": "text"
},
"siem": {
"address": "text",
"sensitiveHeaders": {
"ANY_ADDITIONAL_PROPERTY": "text"
},
"plainTextHeaders": {
"ANY_ADDITIONAL_PROPERTY": "text"
}
}
},
"defaultRedactionConfig": {
"maskConfig": {
"maskingChar": "text",
"charsToIgnore": [
"text"
],
"numCharsToLeaveUnmasked": 1,
"maskLeftToRight": true
},
"infoTypeSubstitutionConfig": {},
"substitutionConfig": {
"substitutionPhrase": "text"
},
"cryptoConfig": {
"publicKey": "text"
},
"removeFinding": true
},
"enableFileRedaction": true
},
"requestMetadata": "text"
}GET /exfiltration/v1/events/search?query=text HTTP/1.1
Host: api.nightfall.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
{
"events": [
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"integration": "text",
"createdAt": 1,
"state": "text",
"eventType": "text",
"policyUUIDs": [
"123e4567-e89b-12d3-a456-426614174000"
],
"assetsCount": 1,
"userInfo": {
"username": "text",
"userEmail": "[email protected]",
"userProfileLink": "https://example.com",
"deviceId": "text",
"machineName": "text",
"isExternal": true
},
"appInfo": {
"id": "text",
"name": "text"
}
}
],
"nextPageToken": "text"
}{
"events": [
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"integration": "text",
"createdAt": 1,
"state": "text",
"eventType": "text",
"policyUUIDs": [
"123e4567-e89b-12d3-a456-426614174000"
],
"assetsCount": 1,
"userInfo": {
"username": "text",
"userEmail": "[email protected]",
"userProfileLink": "https://example.com",
"deviceId": "text",
"machineName": "text",
"isExternal": true
},
"appInfo": {
"id": "text",
"name": "text"
}
}
],
"nextPageToken": "text"
}{
"assets": [
{
"id": "text",
"name": "text",
"path": "text",
"sizeBytes": 1,
"mimetype": "text",
"owner": {
"id": "text",
"email": "[email protected]",
"comment": "text",
"metadata": {
"gdrive": {
"userBelongsToGroups": [
"text"
],
"isAdmin": true,
"isSuspended": true,
"createdAt": 1
},
"salesforce": {},
"endpointAgent": {
"deviceID": "text",
"machineName": "text"
}
}
},
"comment": "text",
"ddrViolationIDs": [
"123e4567-e89b-12d3-a456-426614174000"
],
"metadata": {
"gdrive": {
"fileID": "text",
"fileName": "text",
"fileSize": "text",
"fileLink": "text",
"permissionSetting": "text",
"sharingExternalUsers": [
"text"
],
"sharingInternalUsers": [
"text"
],
"canViewersDownload": true,
"fileOwner": "text",
"isInTrash": true,
"createdAt": 1,
"updatedAt": 1,
"drive": "text",
"labels": [
"text"
],
"filePermissionType": "text"
},
"salesforce": {
"resourceType": "text",
"fileResourceMetadata": {
"fileAction": "text",
"sourceIP": "text",
"sessionLevel": "text"
},
"reportResourceMetadata": {
"description": "text",
"displayEntityFields": [
"text"
],
"dashboardName": "text",
"scope": "text",
"operation": "text",
"recordCount": 1,
"queriedEntities": [
"text"
],
"groupedColumnHeaders": [
"text"
],
"columnCount": 1,
"processedRowCount": 1,
"sourceIP": "text",
"eventSource": "text",
"sessionLevel": "text"
},
"bulkApiResourceMetadata": {
"query": "text",
"eventIdentifier": "text",
"sourceIP": "text",
"sessionKey": "text",
"sessionLevel": "text"
}
},
"endpointAgent": {
"medium": "EXFIL_MEDIUM_USB",
"mediumName": "text",
"user": "text"
}
}
}
],
"actor": {
"id": "text",
"email": "[email protected]",
"comment": "text",
"metadata": {
"gdrive": {
"userBelongsToGroups": [
"text"
],
"isAdmin": true,
"isSuspended": true,
"createdAt": 1
},
"salesforce": {},
"endpointAgent": {
"deviceID": "text",
"machineName": "text"
}
}
},
"events": [
{
"type": "DOWNLOAD",
"timestamp": 1,
"metadata": {
"endpointAgent": {
"endpointBrowserUploadMetadata": {
"browserName": "text",
"browserVersion": "text",
"domain": "text",
"browserTabURL": "text",
"browserTabTitle": "text",
"uploadStartTime": 1,
"uploadEndTime": 1,
"fileName": "text",
"originMetadata": [
{
"timestamp": 1,
"browserDownloadMetadata": {
"browserName": "text",
"browserVersion": "text",
"domain": "text",
"browserTabURL": "text",
"browserTabTitle": "text",
"downloadStartTime": 1,
"downloadEndTime": 1
},
"clipboardCopyMetadata": {
"contentType": "CCT_TEXT",
"browserMetadata": {
"browserName": "text",
"browserVersion": "text",
"domain": "text",
"browserTabURL": "text",
"browserTabTitle": "text"
}
}
}
]
},
"endpointCloudSyncMetadata": {
"app": "text",
"accountType": "text",
"accountName": "text",
"email": "text",
"destinationFilePath": "text",
"uploadStartTime": 1,
"uploadEndTime": 1,
"fileName": "text"
},
"endpointClipboardMetadata": {
"contentType": "text",
"originMetadata": [
{
"timestamp": 1,
"browserDownloadMetadata": {
"browserName": "text",
"browserVersion": "text",
"domain": "text",
"browserTabURL": "text",
"browserTabTitle": "text",
"downloadStartTime": 1,
"downloadEndTime": 1
},
"clipboardCopyMetadata": {
"contentType": "CCT_TEXT",
"browserMetadata": {
"browserName": "text",
"browserVersion": "text",
"domain": "text",
"browserTabURL": "text",
"browserTabTitle": "text"
}
}
}
],
"destinationMetadata": {
"browserMetadata": {
"browserName": "text",
"browserVersion": "text",
"domain": "text",
"browserTabURL": "text",
"browserTabTitle": "text"
}
}
}
},
"gdrive": {
"originatingAppId": "text",
"originatingAppName": "text",
"isClientSyncEvent": true
},
"salesforce": {
"sourceIP": "text",
"sessionLevel": "text",
"sessionKey": "text",
"sfUserId": "text"
}
},
"assetIDs": [
"text"
]
}
]
}{
"activities": [
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"message": "text",
"timestamp": 1,
"type": "CREATION",
"data": {
"action": "ACKNOWLEDGE",
"userUUID": "123e4567-e89b-12d3-a456-426614174000",
"userName": "text",
"userEmail": "text",
"receiverEmail": "text",
"actionLogData": {
"applyLabelsActionLogData": {
"activityType": "LABELS_SUCCESSFULLY_APPLIED",
"labels": [
"text"
],
"labelUpdatesOnResource": {
"ANY_ADDITIONAL_PROPERTY": "text"
},
"failureReason": "text"
},
"setExpirationActionLogData": {
"expirationTime": 1
},
"revokeAccessActionLogData": {
"revokedEmails": [
"text"
],
"unRevokedEmails": [
"text"
]
},
"notifyEmailActionLogData": {
"receiverEmail": "text"
},
"genericActionLogData": {
"additionalContext": "text"
}
}
}
}
],
"nextPageToken": "text"
}{
"activities": [
{
"type": "DOWNLOAD",
"userEmail": "[email protected]",
"eventTime": 1,
"assetNames": [
"text"
],
"metadata": {
"downloadEventMetadata": {
"source": "text",
"fileName": "text"
},
"browserUploadMetadata": {
"domain": "text",
"fileName": "text"
},
"cloudSyncMetadata": {
"cloudApp": "text",
"fileName": "text"
},
"clipboardMetadata": {
"browserMetadata": {
"domain": "text"
}
}
}
}
],
"nextPageToken": "text"
}{
"activities": [
{
"type": "DOWNLOAD",
"userEmail": "[email protected]",
"eventTime": 1,
"assetNames": [
"text"
],
"metadata": {
"downloadEventMetadata": {
"source": "text",
"fileName": "text"
},
"browserUploadMetadata": {
"domain": "text",
"fileName": "text"
},
"cloudSyncMetadata": {
"cloudApp": "text",
"fileName": "text"
},
"clipboardMetadata": {
"browserMetadata": {
"domain": "text"
}
}
}
}
],
"nextPageToken": "text"
}{
"findings": [
[
{
"finding": "text",
"redactedFinding": "text",
"beforeContext": "text",
"afterContext": "text",
"detector": {
"name": "text",
"uuid": "123e4567-e89b-12d3-a456-426614174000",
"subdetector": {
"name": "text",
"uuid": "123e4567-e89b-12d3-a456-426614174000"
}
},
"confidence": "VERY_UNLIKELY",
"location": {
"byteRange": {
"start": 1,
"end": 1
},
"codepointRange": {
"start": 1,
"end": 1
}
},
"redactedLocation": {
"byteRange": {
"start": 1,
"end": 1
},
"codepointRange": {
"start": 1,
"end": 1
}
}
}
]
],
"redactedPayload": [
"text"
]
}{
"id": "123e4567-e89b-12d3-a456-426614174000",
"fileSizeBytes": 1,
"chunkSize": 1,
"mimeType": "text"
}{
"id": "123e4567-e89b-12d3-a456-426614174000",
"fileSizeBytes": 1,
"chunkSize": 1,
"mimeType": "text"
}{
"id": "123e4567-e89b-12d3-a456-426614174000",
"message": "text"
}Unix timestamp in seconds, filters records created ≥ the value, defaults to -90 days UTC
Unix timestamp in seconds, filters records created < the value, defaults to end of the current day UTC
Unix timestamp in seconds, filters records updated > the value
The maximum number of records to be returned in the response
50Cursor for getting the next page of results
Successful response
Invalid request parameters
Authentication failure
Rate Limit Exceeded or Daily Quota Exceeded
Internal Nightfall Error
The UUID of the violation to fetch
Successful response
Invalid request parameters
Authentication failure
Violation does not exist
Rate Limit Exceeded or Daily Quota Exceeded
Internal Nightfall Error
Unix timestamp in seconds, filters records created ≥ the value, defaults to -90 days UTC
Unix timestamp in seconds, filters records created < the value, defaults to end of the current day UTC
Unix timestamp in seconds, filters records updated > the value
The maximum number of records to be returned in the response
50Cursor for getting the next page of results
Sort key and direction, defaults to descending order by creation time
TIME_DESCPossible values: The query containing filter clauses
Query structure and terminology
A query clause consists of a field followed by an operator followed by a value:
| term | value |
|---|---|
| clause | user_email:"[email protected]" |
| field | user_email |
| operator | : |
| value | [email protected] |
You can combine multiple query clauses in a search by separating them with a space.
Field types, substring matching, and numeric comparators
Every search field supports exact matching with a :. Certain fields such as user_email and user_name support substring matching.
Quotes
You may use quotation marks around string values. Quotation marks are required in case the value contains spaces. For example:
user_mail:[email protected]user_name:"John Doe"Special Characters
+ - && || ! ( ) { } [ ] ^ " ~ * ? : are special characters need to be escaped using \. For example:
(1+1):2 should be searched for using \(1\+1)\:2Search Syntax
The following table lists the syntax that you can use to construct a query.
| SYNTAX | USAGE | DESCRIPTION | EXAMPLES |
|---|---|---|---|
: |
field:value | Exact match operator (case insensitive) | state:"pending" returns records where the currency is exactly "PENDING" in a case-insensitive comparison |
(space) |
field1:value1 field2:value2 | The query returns only records that match both clauses | state:active slack.channel_name:general |
OR |
field:(value1 OR value2) | The query returns records that match either of the values (case insensitive) | state:(active OR pending) |
Query Fields
| param | description |
|---|---|
| state | the violation states to filter on |
| user_email | the emails of users updating the resource resulting in the violation |
| user_name | the usernames of users updating the resource resulting in the violation |
| integration_name | the integration to filter on |
| confidence | one or more likelihoods/confidences |
| policy_id | one or more policy IDs |
| detection_rule_id | one or more detection rule IDs |
| detector_id | one or more detector IDs |
| risk_label | the risk label to filter on |
| risk_source | the risk determination source to filter on |
| slack.channel_name | the slack channel names to filter on |
| slack.channel_id | the slack channel IDs to filter on |
| slack.workspace | the slack workspaces to filter on |
| confluence.parent_page_name | the names of the parent pages in confluence to filter on |
| confluence.space_name | the names of the spaces in confluence to filter on |
| gdrive.drive | the drive names in gdrive to filter on |
| jira.project_name | the jira project names to filter on |
| jira.ticket_number | the jira ticket numbers to filter on |
| salesforce.org_name | the salesforce organization names to filter on |
| salesforce.object | the salesforce object names to filter on |
| salesforce.record_id | the salesforce record IDs to filter on |
| github.author_email | the github author emails to filter on |
| github.branch | the github branches to filter on |
| github.commit | the github commit ids to filter on |
| github.org | the github organizations to filter on |
| github.repository | the github repositories to filter on |
| github.repository_owner | the github repository owners to filter on |
| teams.team_name | the m365 teams team names to filter on |
| teams.channel_name | the m365 teams channels to filter on |
| teams.channel_type | the m365 teams channel types to filter on |
| teams.team_sensitivity | the m365 teams sensitivities to filter on |
| teams.sender | the m365 teams senders to filter on |
| teams.msg_importance | the m365 teams importance to filter on |
| teams.msg_attachment | the m365 teams attachment names to filter on |
| teams.chat_id | the m365 teams chat ID to filter on |
| teams.chat_type | the m365 teams chat type to filter on |
| teams.chat_topic | the m365 teams chat topic to filter on |
| teams.chat_participant | the m365 teams chat participant's display name to filter on |
| onedrive.drive_owner | drive owner's display name to filter on |
| onedrive.drive_owner_email | drive owner's email to filter on |
| onedrive.file_name | the file name to filter on |
| onedrive.created_by | the m365 user, who created the file in the drive, display name to filter on |
| onedrive.created_by_email | the m365 users, who created the file in the drive, email to filter on |
| onedrive.modified_by | the m365 users, who last modified the file in the drive, display name to filter on |
| onedrive.modified_by_email | the m365 users, who last modified the file in the drive, email to filter on |
| zendesk.ticket_status | the zendesk ticket status to filter on |
| zendesk.ticket_title | the zendesk ticket titles to filter on |
| zendesk.ticket_group_assignee | the zendesk ticket assignee groups to filter on |
| zendesk.current_user_role | the zendesk ticket current assignee user's roles to filter on |
| notion.created_by | the names of the users creating a resource in notion to filter on |
| notion.last_edited_by | the names of the users editing a resource in notion to filter on |
| notion.page_title | the page names in notion to filter on |
| notion.workspace_name | the workspace names in notion to filter on |
| gmail.user_name | the names of the sender to filter on |
| gmail.from | the email of sender to filter on |
| gmail.to | the email or name of recipients to filter on |
| gmail.cc | the email or name of cc to filter on |
| gmail.bcc | the email or name of bcc to filter on |
| gmail.thread_id | the thread id of email to filter on |
| gmail.subject | the subject of email to filter on |
| gmail.attachment_name | the name of attachment to filter on |
| gmail.attachment_type | the type of attachment to filter on |
| last_actioned_by | the entity that performed the last action on the violation, can be one of NIGHTFALL, ADMIN or END_USER |
Successful response
Invalid request parameters
Authentication failure
Rate Limit Exceeded or Daily Quota Exceeded
Internal Nightfall Error
The UUID of the violation
Cursor for getting the next page of results
Number of findings to fetch in one page (max 1000)
1000Successful response
Invalid request parameters
Authentication failure
Violation does not exist
Rate Limit Exceeded or Daily Quota Exceeded
Internal Nightfall Error
The UUIDs of the violations to perform the action on
The action to perform on the violations
Successful response (processed immediately)
Accepted response (queued for processing)
Invalid request parameters
Authentication failure
Rate Limit Exceeded or Daily Quota Exceeded
Internal Nightfall Error
The UUID of the annotation to fetch
Successful response
Invalid request parameters
Authentication failure
Annotation does not exist
Rate Limit Exceeded or Daily Quota Exceeded
Internal Nightfall Error
The UUID of the finding to annotate
The annotation type
The comment to add to the annotation
Whether the annotation applies to all findings of this sensitive data (defaults to true)
trueSuccessful response
Invalid request parameters
Authentication failure
Finding already annotated
Rate Limit Exceeded or Daily Quota Exceeded
Internal Nightfall Error
The UUID of the finding to unannotate
Successful response (even if annotation does not exist)
Invalid request parameters
Authentication failure
Rate Limit Exceeded or Daily Quota Exceeded
Internal Nightfall Error
The UUID of the violation
Number of activity items to fetch in one page
50Unix timestamp in seconds, filters activity created > the value
Unix timestamp in seconds, filters activity created < the value
Whether to sort results in descending order (default false)
falseCursor for getting the next page of results
Successful response
Invalid request parameters
Authentication failure
Violation does not exist
Rate Limit Exceeded or Daily Quota Exceeded
Internal Nightfall Error
No content
{
"violations": [
{
"id": "text",
"integration": "SLACK",
"createdAt": 1,
"updatedAt": 1,
"possibleActions": [
"ACKNOWLEDGE"
],
"state": "ACTIVE",
"resourceLink": "text",
"metadata": {
"slackMetadata": {
"location": "text",
"locationType": "text",
"username": "text",
"userID": "text",
"messagePermalink": "text",
"locationMembers": [
"text"
],
"locationMemberCount": 1,
"channelID": "text",
"workspaceName": "text"
},
"confluenceMetadata": {
"itemName": "text",
"itemType": "text",
"isArchived": true,
"createdAt": 1,
"updatedAt": 1,
"labels": [
"text"
],
"spaceName": "text",
"spaceKey": "text",
"spaceNameLink": "text",
"parentPageName": "text",
"authorName": "text",
"authorEmail": "text",
"authorNameLink": "text",
"permalink": "text",
"confluenceID": "text",
"confluenceUserID": "text",
"itemVersion": 1,
"parentPageID": "text",
"parentVersion": 1
},
"gdriveMetadata": {
"fileID": "text",
"fileName": "text",
"fileType": "text",
"fileSize": "text",
"fileLink": "text",
"permissionSetting": "text",
"sharingExternalUsers": [
"text"
],
"sharingInternalUsers": [
"text"
],
"canViewersDownload": true,
"fileOwner": "text",
"isInTrash": true,
"createdAt": 1,
"updatedAt": 1,
"drive": "text",
"updatedBy": "text"
},
"jiraMetadata": {
"projectName": "text",
"ticketNumber": "text",
"projectType": "text",
"issueID": "text",
"projectLink": "text",
"ticketLink": "text",
"commentLink": "text",
"attachmentLink": "text"
},
"githubMetadata": {
"branchName": "text",
"organization": "text",
"repository": "text",
"authorEmail": "text",
"authorUsername": "text",
"createdAt": 1,
"isRepoPrivate": true,
"filePath": "text",
"githubPermalink": "text",
"repositoryOwner": "text",
"githubRepoLink": "text"
},
"salesforceMetadata": {
"orgName": "text",
"recordID": "text",
"objectName": "text",
"contentType": "text",
"userID": "text",
"userName": "text",
"updatedAt": 1,
"fields": [
"text"
],
"fileType": "text",
"attachmentLink": "text",
"attachmentName": "text",
"objectLink": "text"
},
"zendeskMetadata": {
"ticketStatus": "text",
"ticketTitle": "text",
"ticketRequestor": "text",
"ticketGroupAssignee": "text",
"ticketAgentAssignee": "text",
"currentUserRole": "text",
"ticketID": 1,
"ticketFollowers": [
"text"
],
"ticketTags": "text",
"createdAt": 1,
"UpdatedAt": 1,
"location": "text",
"subLocation": "text",
"ticketCommentID": 1,
"ticketGroupID": 1,
"ticketGroupLink": "text",
"ticketAgentID": 1,
"ticketAgentLink": "text",
"ticketEvent": "text",
"userRole": "text",
"attachmentName": "text",
"attachmentLink": "text"
},
"notionMetadata": {
"createdBy": "text",
"updatedBy": "text",
"workspaceName": "text",
"workspaceLink": "text",
"pageID": "text",
"pageTitle": "text",
"createdAt": 1,
"updatedAt": 1,
"privatePageLink": "text",
"publicPageLink": "text",
"sharedExternally": true,
"attachmentID": "text"
},
"browserMetadata": {
"location": "text",
"subLocation": "text",
"browserName": "text",
"userComment": "text"
},
"m365TeamsMetadata": {
"teamName": "text",
"tenantID": "text",
"tenantDomain": "text",
"teamID": "text",
"teamVisibility": "text",
"teamWebURL": "text",
"channelID": "text",
"channelName": "text",
"channelType": "text",
"channelWebURL": "text",
"messageID": "text",
"createdAt": 1,
"updatedAt": 1,
"chatMessageSender": "text",
"userID": "text",
"userPrincipalName": "text",
"attachments": [
{
"attachmentID": "text",
"attachmentName": "text",
"attachmentURL": "text"
}
],
"chatMessageImportance": "text",
"chatID": "text",
"chatType": "text",
"chatTopic": "text",
"chatParticipants": [
{
"userID": "text",
"email": "text",
"displayName": "text"
}
]
},
"m365OnedriveMetadata": {
"tenantID": "text",
"tenantDomain": "text",
"driveItemID": "text",
"driveItemName": "text",
"driveItemURL": "text",
"driveItemMimeType": "text",
"driveItemSize": 1,
"parentPath": "text",
"createdByID": "text",
"updatedByEmail": "text",
"updatedByID": "text",
"updatedByName": "text",
"createdAt": 1,
"updatedAt": 1,
"specialFolderName": "text",
"driveID": "text",
"driveOwnerName": "text",
"driveOwnerEmail": "text",
"driveOwnerID": "text"
},
"inlineEmailMetadata": {
"domain": "text",
"user_name": "text",
"from": "text",
"to": [
"text"
],
"cc": [
"text"
],
"bcc": [
"text"
],
"subject": "text",
"sent_at": 1,
"thread_id": "text",
"attachment_name": "text",
"attachment_type": "text"
}
},
"fileDetails": {
"fileName": "text",
"mimeType": "text",
"permalink": "text"
},
"policyUUIDs": [
"text"
],
"detectionRuleUUIDs": [
"text"
],
"detectorUUIDs": [
"text"
],
"risk": "UNSPECIFIED",
"riskSource": "NIGHTFALL",
"riskScore": 1,
"userInfo": {
"username": "text",
"userEmail": "text"
}
}
],
"nextPageToken": "text"
}{
"id": "text",
"integration": "SLACK",
"createdAt": 1,
"updatedAt": 1,
"possibleActions": [
"ACKNOWLEDGE"
],
"state": "ACTIVE",
"resourceLink": "text",
"metadata": {
"slackMetadata": {
"location": "text",
"locationType": "text",
"username": "text",
"userID": "text",
"messagePermalink": "text",
"locationMembers": [
"text"
],
"locationMemberCount": 1,
"channelID": "text",
"workspaceName": "text"
},
"confluenceMetadata": {
"itemName": "text",
"itemType": "text",
"isArchived": true,
"createdAt": 1,
"updatedAt": 1,
"labels": [
"text"
],
"spaceName": "text",
"spaceKey": "text",
"spaceNameLink": "text",
"parentPageName": "text",
"authorName": "text",
"authorEmail": "text",
"authorNameLink": "text",
"permalink": "text",
"confluenceID": "text",
"confluenceUserID": "text",
"itemVersion": 1,
"parentPageID": "text",
"parentVersion": 1
},
"gdriveMetadata": {
"fileID": "text",
"fileName": "text",
"fileType": "text",
"fileSize": "text",
"fileLink": "text",
"permissionSetting": "text",
"sharingExternalUsers": [
"text"
],
"sharingInternalUsers": [
"text"
],
"canViewersDownload": true,
"fileOwner": "text",
"isInTrash": true,
"createdAt": 1,
"updatedAt": 1,
"drive": "text",
"updatedBy": "text"
},
"jiraMetadata": {
"projectName": "text",
"ticketNumber": "text",
"projectType": "text",
"issueID": "text",
"projectLink": "text",
"ticketLink": "text",
"commentLink": "text",
"attachmentLink": "text"
},
"githubMetadata": {
"branchName": "text",
"organization": "text",
"repository": "text",
"authorEmail": "text",
"authorUsername": "text",
"createdAt": 1,
"isRepoPrivate": true,
"filePath": "text",
"githubPermalink": "text",
"repositoryOwner": "text",
"githubRepoLink": "text"
},
"salesforceMetadata": {
"orgName": "text",
"recordID": "text",
"objectName": "text",
"contentType": "text",
"userID": "text",
"userName": "text",
"updatedAt": 1,
"fields": [
"text"
],
"fileType": "text",
"attachmentLink": "text",
"attachmentName": "text",
"objectLink": "text"
},
"zendeskMetadata": {
"ticketStatus": "text",
"ticketTitle": "text",
"ticketRequestor": "text",
"ticketGroupAssignee": "text",
"ticketAgentAssignee": "text",
"currentUserRole": "text",
"ticketID": 1,
"ticketFollowers": [
"text"
],
"ticketTags": "text",
"createdAt": 1,
"UpdatedAt": 1,
"location": "text",
"subLocation": "text",
"ticketCommentID": 1,
"ticketGroupID": 1,
"ticketGroupLink": "text",
"ticketAgentID": 1,
"ticketAgentLink": "text",
"ticketEvent": "text",
"userRole": "text",
"attachmentName": "text",
"attachmentLink": "text"
},
"notionMetadata": {
"createdBy": "text",
"updatedBy": "text",
"workspaceName": "text",
"workspaceLink": "text",
"pageID": "text",
"pageTitle": "text",
"createdAt": 1,
"updatedAt": 1,
"privatePageLink": "text",
"publicPageLink": "text",
"sharedExternally": true,
"attachmentID": "text"
},
"browserMetadata": {
"location": "text",
"subLocation": "text",
"browserName": "text",
"userComment": "text"
},
"m365TeamsMetadata": {
"teamName": "text",
"tenantID": "text",
"tenantDomain": "text",
"teamID": "text",
"teamVisibility": "text",
"teamWebURL": "text",
"channelID": "text",
"channelName": "text",
"channelType": "text",
"channelWebURL": "text",
"messageID": "text",
"createdAt": 1,
"updatedAt": 1,
"chatMessageSender": "text",
"userID": "text",
"userPrincipalName": "text",
"attachments": [
{
"attachmentID": "text",
"attachmentName": "text",
"attachmentURL": "text"
}
],
"chatMessageImportance": "text",
"chatID": "text",
"chatType": "text",
"chatTopic": "text",
"chatParticipants": [
{
"userID": "text",
"email": "text",
"displayName": "text"
}
]
},
"m365OnedriveMetadata": {
"tenantID": "text",
"tenantDomain": "text",
"driveItemID": "text",
"driveItemName": "text",
"driveItemURL": "text",
"driveItemMimeType": "text",
"driveItemSize": 1,
"parentPath": "text",
"createdByID": "text",
"updatedByEmail": "text",
"updatedByID": "text",
"updatedByName": "text",
"createdAt": 1,
"updatedAt": 1,
"specialFolderName": "text",
"driveID": "text",
"driveOwnerName": "text",
"driveOwnerEmail": "text",
"driveOwnerID": "text"
},
"inlineEmailMetadata": {
"domain": "text",
"user_name": "text",
"from": "text",
"to": [
"text"
],
"cc": [
"text"
],
"bcc": [
"text"
],
"subject": "text",
"sent_at": 1,
"thread_id": "text",
"attachment_name": "text",
"attachment_type": "text"
}
},
"fileDetails": {
"fileName": "text",
"mimeType": "text",
"permalink": "text"
},
"policyUUIDs": [
"text"
],
"detectionRuleUUIDs": [
"text"
],
"detectorUUIDs": [
"text"
],
"risk": "UNSPECIFIED",
"riskSource": "NIGHTFALL",
"riskScore": 1,
"userInfo": {
"username": "text",
"userEmail": "text"
}
}{
"violations": [
{
"id": "text",
"integration": "SLACK",
"createdAt": 1,
"updatedAt": 1,
"possibleActions": [
"ACKNOWLEDGE"
],
"state": "ACTIVE",
"resourceLink": "text",
"metadata": {
"slackMetadata": {
"location": "text",
"locationType": "text",
"username": "text",
"userID": "text",
"messagePermalink": "text",
"locationMembers": [
"text"
],
"locationMemberCount": 1,
"channelID": "text",
"workspaceName": "text"
},
"confluenceMetadata": {
"itemName": "text",
"itemType": "text",
"isArchived": true,
"createdAt": 1,
"updatedAt": 1,
"labels": [
"text"
],
"spaceName": "text",
"spaceKey": "text",
"spaceNameLink": "text",
"parentPageName": "text",
"authorName": "text",
"authorEmail": "text",
"authorNameLink": "text",
"permalink": "text",
"confluenceID": "text",
"confluenceUserID": "text",
"itemVersion": 1,
"parentPageID": "text",
"parentVersion": 1
},
"gdriveMetadata": {
"fileID": "text",
"fileName": "text",
"fileType": "text",
"fileSize": "text",
"fileLink": "text",
"permissionSetting": "text",
"sharingExternalUsers": [
"text"
],
"sharingInternalUsers": [
"text"
],
"canViewersDownload": true,
"fileOwner": "text",
"isInTrash": true,
"createdAt": 1,
"updatedAt": 1,
"drive": "text",
"updatedBy": "text"
},
"jiraMetadata": {
"projectName": "text",
"ticketNumber": "text",
"projectType": "text",
"issueID": "text",
"projectLink": "text",
"ticketLink": "text",
"commentLink": "text",
"attachmentLink": "text"
},
"githubMetadata": {
"branchName": "text",
"organization": "text",
"repository": "text",
"authorEmail": "text",
"authorUsername": "text",
"createdAt": 1,
"isRepoPrivate": true,
"filePath": "text",
"githubPermalink": "text",
"repositoryOwner": "text",
"githubRepoLink": "text"
},
"salesforceMetadata": {
"orgName": "text",
"recordID": "text",
"objectName": "text",
"contentType": "text",
"userID": "text",
"userName": "text",
"updatedAt": 1,
"fields": [
"text"
],
"fileType": "text",
"attachmentLink": "text",
"attachmentName": "text",
"objectLink": "text"
},
"zendeskMetadata": {
"ticketStatus": "text",
"ticketTitle": "text",
"ticketRequestor": "text",
"ticketGroupAssignee": "text",
"ticketAgentAssignee": "text",
"currentUserRole": "text",
"ticketID": 1,
"ticketFollowers": [
"text"
],
"ticketTags": "text",
"createdAt": 1,
"UpdatedAt": 1,
"location": "text",
"subLocation": "text",
"ticketCommentID": 1,
"ticketGroupID": 1,
"ticketGroupLink": "text",
"ticketAgentID": 1,
"ticketAgentLink": "text",
"ticketEvent": "text",
"userRole": "text",
"attachmentName": "text",
"attachmentLink": "text"
},
"notionMetadata": {
"createdBy": "text",
"updatedBy": "text",
"workspaceName": "text",
"workspaceLink": "text",
"pageID": "text",
"pageTitle": "text",
"createdAt": 1,
"updatedAt": 1,
"privatePageLink": "text",
"publicPageLink": "text",
"sharedExternally": true,
"attachmentID": "text"
},
"browserMetadata": {
"location": "text",
"subLocation": "text",
"browserName": "text",
"userComment": "text"
},
"m365TeamsMetadata": {
"teamName": "text",
"tenantID": "text",
"tenantDomain": "text",
"teamID": "text",
"teamVisibility": "text",
"teamWebURL": "text",
"channelID": "text",
"channelName": "text",
"channelType": "text",
"channelWebURL": "text",
"messageID": "text",
"createdAt": 1,
"updatedAt": 1,
"chatMessageSender": "text",
"userID": "text",
"userPrincipalName": "text",
"attachments": [
{
"attachmentID": "text",
"attachmentName": "text",
"attachmentURL": "text"
}
],
"chatMessageImportance": "text",
"chatID": "text",
"chatType": "text",
"chatTopic": "text",
"chatParticipants": [
{
"userID": "text",
"email": "text",
"displayName": "text"
}
]
},
"m365OnedriveMetadata": {
"tenantID": "text",
"tenantDomain": "text",
"driveItemID": "text",
"driveItemName": "text",
"driveItemURL": "text",
"driveItemMimeType": "text",
"driveItemSize": 1,
"parentPath": "text",
"createdByID": "text",
"updatedByEmail": "text",
"updatedByID": "text",
"updatedByName": "text",
"createdAt": 1,
"updatedAt": 1,
"specialFolderName": "text",
"driveID": "text",
"driveOwnerName": "text",
"driveOwnerEmail": "text",
"driveOwnerID": "text"
},
"inlineEmailMetadata": {
"domain": "text",
"user_name": "text",
"from": "text",
"to": [
"text"
],
"cc": [
"text"
],
"bcc": [
"text"
],
"subject": "text",
"sent_at": 1,
"thread_id": "text",
"attachment_name": "text",
"attachment_type": "text"
}
},
"fileDetails": {
"fileName": "text",
"mimeType": "text",
"permalink": "text"
},
"policyUUIDs": [
"text"
],
"detectionRuleUUIDs": [
"text"
],
"detectorUUIDs": [
"text"
],
"risk": "UNSPECIFIED",
"riskSource": "NIGHTFALL",
"riskScore": 1,
"userInfo": {
"username": "text",
"userEmail": "text"
}
}
],
"nextPageToken": "text"
}{
"findings": [
{
"id": "text",
"detectorUUID": "text",
"subDetectorUUID": "text",
"confidence": "text",
"redactedSensitiveText": "text",
"redactedContext": {
"beforeContext": "text",
"afterContext": "text"
},
"redactedLocation": {
"byteRange": {
"start": 1,
"end": 1
},
"lineRange": {
"start": 1,
"end": 1
}
},
"metadata": {
"apiKeyMetaData": {
"status": "UNVERIFIED",
"kind": "UNSPECIFIED",
"description": "text"
}
},
"subLocation": "text",
"annotationUUID": "text"
}
],
"nextPageToken": "text"
}{
"submitted": [
"123e4567-e89b-12d3-a456-426614174000"
]
}{
"id": "123e4567-e89b-12d3-a456-426614174000",
"type": "DETECTOR_FALSE_POSITIVE",
"comment": "text",
"autoApply": true
}{
"id": "123e4567-e89b-12d3-a456-426614174000",
"type": "DETECTOR_FALSE_POSITIVE",
"comment": "text",
"autoApply": true
}{
"activities": [
{
"id": "123e4567-e89b-12d3-a456-426614174000",
"message": "text",
"timestamp": 1,
"type": "CREATION",
"data": {
"action": "ACKNOWLEDGE",
"userUUID": "123e4567-e89b-12d3-a456-426614174000",
"userName": "text",
"userEmail": "text",
"receiverEmail": "text",
"actionLogData": {
"applyLabelsActionLogData": {
"activityType": "LABELS_SUCCESSFULLY_APPLIED",
"labels": [
"text"
],
"labelUpdatesOnResource": {
"ANY_ADDITIONAL_PROPERTY": "text"
},
"failureReason": "text"
},
"setExpirationActionLogData": {
"expirationTime": 1
},
"revokeAccessActionLogData": {
"revokedEmails": [
"text"
],
"unRevokedEmails": [
"text"
]
},
"notifyEmailActionLogData": {
"receiverEmail": "text"
},
"genericActionLogData": {
"additionalContext": "text"
}
}
}
}
],
"nextPageToken": "text"
}GET /dlp/v1/violations HTTP/1.1
Host: api.nightfall.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
GET /dlp/v1/violations/{violationId} HTTP/1.1
Host: api.nightfall.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
GET /dlp/v1/violations/{violationId}/findings HTTP/1.1
Host: api.nightfall.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
POST /dlp/v1/violations/actions HTTP/1.1
Host: api.nightfall.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 82
{
"violationUUIDs": [
"123e4567-e89b-12d3-a456-426614174000"
],
"action": "ACKNOWLEDGE"
}GET /dlp/v1/annotations/{annotationId} HTTP/1.1
Host: api.nightfall.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
POST /dlp/v1/findings/{findingId}/annotate HTTP/1.1
Host: api.nightfall.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Content-Type: application/json
Accept: */*
Content-Length: 68
{
"type": "DETECTOR_FALSE_POSITIVE",
"comment": "text",
"autoApply": true
}POST /dlp/v1/findings/{findingId}/unannotate HTTP/1.1
Host: api.nightfall.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
GET /dlp/v1/violations/{violationId}/activity HTTP/1.1
Host: api.nightfall.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*
GET /dlp/v1/violations/search?query=text HTTP/1.1
Host: api.nightfall.ai
Authorization: Bearer YOUR_SECRET_TOKEN
Accept: */*