Skip to content

Commit 0d8384f

Browse files
committed
Add support for AlertConfig
Callers may provide an alertConfig object as part of either a synchronous plaintext scan, or an asynchronous file scan to fan alerts out to any of { slack, email, and webhook}.
1 parent 4e7f525 commit 0d8384f

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

src/types/alerts.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
export namespace Alerts {
2+
export interface AlertConfig {
3+
slack?: SlackAlert;
4+
email?: EmailAlert;
5+
url?: WebhookAlert;
6+
}
7+
8+
export interface SlackAlert {
9+
target: string;
10+
}
11+
12+
export interface EmailAlert {
13+
address: string;
14+
}
15+
16+
export interface WebhookAlert {
17+
address: string;
18+
}
19+
}

src/types/scanFile.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Detector, NightfallError } from ".";
1+
import { Alerts, Detector, NightfallError } from ".";
22

33
export namespace ScanFile {
44
export interface ScanRequest {
@@ -10,6 +10,7 @@ export namespace ScanFile {
1010
detectionRuleUUIDs?: string[]
1111
detectionRules?: Detector.Rule[]
1212
webhookURL: string
13+
alertConfig?: Alerts.AlertConfig
1314
}
1415

1516
export interface InitializeResponse {

src/types/scanText.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
import { Detector } from ".";
1+
import { Alerts, Detector } from ".";
22

33
export namespace ScanText {
44
export interface RequestConfig {
55
detectionRuleUUIDs?: string[]
66
detectionRules?: Detector.Rule[]
77
contextBytes?: number
88
defaultRedactionConfig?: Detector.RedactionConfig
9+
alertConfig?: Alerts.AlertConfig
910
}
1011

1112
export interface Response {

0 commit comments

Comments
 (0)