Skip to content

Commit 4a77201

Browse files
sds: add sds_result protobuf definition and bazel target
1 parent abbed87 commit 4a77201

2 files changed

Lines changed: 200 additions & 0 deletions

File tree

pkg/proto/datadog/sds/BUILD.bazel

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Compiled with prost-build (cargo) by the datasecurity Rust check; not built or
2+
# consumed by Bazel. Disable proto generation inherited from ../BUILD.bazel.
3+
# gazelle:proto disable
4+
5+
exports_files(["sds_result.proto"])
Lines changed: 195 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,195 @@
1+
syntax = "proto3";
2+
3+
package datadog.sds;
4+
5+
import "google/protobuf/timestamp.proto";
6+
7+
option go_package = "pkg/proto/pbgo/sds"; // golang
8+
9+
message ScanStats {
10+
int64 scan_duration_ms = 1;
11+
int64 total_files_found = 2;
12+
int64 files_scanned = 3;
13+
int64 files_skipped_unsupported_type = 4;
14+
int64 files_partially_scanned_size_limit = 5;
15+
int64 total_data_scanned_bytes = 6;
16+
map<string, int64> skipped_files_by_type = 7; // file_extension -> count
17+
}
18+
19+
message ScannerMetadata {
20+
optional string version = 1;
21+
optional string region = 2;
22+
}
23+
24+
message ScanningSource {
25+
message Agentless {
26+
string version = 1;
27+
string region = 2;
28+
}
29+
30+
message DatadogCrawler {
31+
string service_name = 1;
32+
}
33+
34+
message Agent {
35+
string hostname = 1;
36+
string version = 2;
37+
}
38+
39+
oneof source {
40+
Agentless agentless = 1;
41+
DatadogCrawler datadog_crawler = 2;
42+
Agent agent = 3;
43+
}
44+
}
45+
46+
message SdsResultPayload {
47+
enum ScanSource {
48+
option deprecated = true;
49+
UNKNOWN = 0;
50+
AGENTLESS = 1;
51+
}
52+
message Resource {
53+
string type = 1;
54+
string name = 2;
55+
}
56+
57+
message ScanLocation {
58+
// Beginning deprecated fields
59+
// Use ScanLocation instead
60+
oneof ScanLocationType {
61+
string path = 1 [deprecated = true];
62+
string database = 2 [deprecated = true];
63+
}
64+
int64 size_in_bytes = 3 [deprecated = true];
65+
int64 last_modified_timestamp = 4 [deprecated = true];
66+
string table = 5 [deprecated = true];
67+
// End deprecated fields
68+
69+
oneof ScanLocation {
70+
S3File s3File = 6;
71+
RdsTable rdsTable = 7;
72+
SnowflakeTable snowflakeTable = 8;
73+
PostgresTable postgresTable = 9;
74+
}
75+
}
76+
77+
message RdsTable {
78+
string instance_arn = 1;
79+
string snapshot_arn = 2;
80+
int64 snapshot_timestamp = 3;
81+
string database_name = 4;
82+
string table_name = 5;
83+
optional int64 table_row_count = 6;
84+
optional int64 scanned_row_count = 7;
85+
86+
}
87+
88+
message SnowflakeTable {
89+
string account_name = 1;
90+
string database_name = 2;
91+
string schema_name = 3;
92+
string table_name = 4;
93+
int64 last_modified_timestamp = 5;
94+
int64 table_row_count = 6;
95+
int64 scanned_row_count = 7;
96+
repeated ScannedColumn scanned_columns = 8;
97+
98+
message ScannedColumn {
99+
string name = 1;
100+
string data_type = 2;
101+
}
102+
}
103+
104+
message PostgresTable {
105+
string database_cluster_name = 1;
106+
string database_instance_name = 2;
107+
string database_host_name = 3;
108+
string database_name = 4;
109+
string schema_name = 5;
110+
string table_name = 6;
111+
int64 table_row_count = 7;
112+
int64 scanned_row_count = 8;
113+
repeated ScannedColumn scanned_columns = 9;
114+
115+
message ScannedColumn {
116+
string name = 1;
117+
string data_type = 2;
118+
}
119+
}
120+
121+
message S3File {
122+
string path = 1;
123+
int64 last_modified_timestamp = 2;
124+
int64 compressed_size_in_bytes = 3;
125+
int64 uncompressed_size_in_bytes = 4;
126+
}
127+
128+
message RuleInfo {
129+
string id = 1;
130+
string name = 2;
131+
string priority = 3;
132+
repeated string tags = 4;
133+
repeated string labels = 5;
134+
}
135+
136+
message ScanMatch {
137+
string rule_id = 1;
138+
int64 start_index = 2;
139+
int64 end_index = 3;
140+
string sample = 4;
141+
optional string path = 5;
142+
optional int64 line = 6;
143+
optional int64 column = 7;
144+
optional int64 start_line = 8;
145+
optional int64 end_line = 9;
146+
optional int64 row = 10;
147+
optional int64 start_index_in_line = 11;
148+
optional int64 end_index_in_line = 12;
149+
optional string match_status = 13;
150+
}
151+
152+
message TableMatch {
153+
string rule_id = 1;
154+
string column_name = 2;
155+
int64 count_matched_rows = 3;
156+
int64 count_total_rows = 4 [deprecated = true]; // rely on ScanLocation.RdsTable.table_row_count
157+
}
158+
159+
message ScanMetadata {
160+
ScanTaskMetadata scan_task_metadata = 1;
161+
162+
message ScanTaskMetadata {
163+
enum Status {
164+
STATUS_UNKNOWN = 0;
165+
SUCCESS = 1;
166+
ERROR = 2;
167+
}
168+
169+
string task_id = 1;
170+
string sub_task_id = 2;
171+
google.protobuf.Timestamp started_at = 3;
172+
google.protobuf.Timestamp ended_at = 4;
173+
Status status = 5;
174+
optional string failure_reason = 6; // set only when status is ERROR
175+
}
176+
}
177+
178+
message ScanResult {
179+
repeated ScanMatch matches = 1;
180+
ScanLocation location = 2;
181+
int64 duration = 3;
182+
repeated TableMatch table_matches = 4;
183+
optional ScanMetadata scan_metadata = 5;
184+
}
185+
186+
ScanSource scan_source = 1 [deprecated = true];
187+
int64 timestamp = 2;
188+
Resource resource = 3;
189+
repeated ScanResult scan_results = 4;
190+
optional ScanStats scan_stats = 5;
191+
optional ScannerMetadata scanner_metadata = 6;
192+
map<string, RuleInfo> rules = 7 [deprecated = true]; // rely on ruleIds instead
193+
ScanningSource scanning_source = 8;
194+
repeated string rule_ids = 9;
195+
}

0 commit comments

Comments
 (0)