Skip to content

Commit ac6a1d0

Browse files
authored
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}.
2 parents 4e7f525 + 601f67d commit ac6a1d0

File tree

4 files changed

+25
-3
lines changed

4 files changed

+25
-3
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 Config {
3+
slack?: Slack;
4+
email?: Email;
5+
url?: Webhook;
6+
}
7+
8+
export interface Slack {
9+
target: string;
10+
}
11+
12+
export interface Email {
13+
address: string;
14+
}
15+
16+
export interface Webhook {
17+
address: string;
18+
}
19+
}

src/types/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
export * from './alerts'
12
export * from './detectors'
23
export * from './global'
34
export * from './scanFile'

src/types/scanFile.ts

Lines changed: 3 additions & 2 deletions
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 {
@@ -9,7 +9,8 @@ export namespace ScanFile {
99
export interface ScanPolicy {
1010
detectionRuleUUIDs?: string[]
1111
detectionRules?: Detector.Rule[]
12-
webhookURL: string
12+
webhookURL?: string // Deprecated, use alertConfig instead
13+
alertConfig?: Alerts.Config
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.Config
910
}
1011

1112
export interface Response {

0 commit comments

Comments
 (0)