Skip to content

Commit cbf8c1d

Browse files
Updated proto and related processing of this proto, to be more efficient:
1. Converted all integer type fields to uint32. 2. Converted all known value string to enum types. 3. Converted from JSON encoding to proto encoding of message in log record
1 parent 265f5d0 commit cbf8c1d

File tree

9 files changed

+675
-180
lines changed

9 files changed

+675
-180
lines changed

api/grpc/events/v1/security_violation.pb.go

Lines changed: 317 additions & 70 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/grpc/events/v1/security_violation.pb.validate.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

api/grpc/events/v1/security_violation.proto

Lines changed: 46 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,23 @@
11
// Copyright (c) F5, Inc.
22
//
3-
// This source code is licensed under the Apache License, Version 2.0 license found in the
4-
// LICENSE file in the root directory of this source tree.
3+
// This source code is licensed under the Apache License, Version 2.0 license
4+
// found in the LICENSE file in the root directory of this source tree.
55
syntax = "proto3";
66
package events.v1;
77

88
option go_package = "events/v1";
99

10-
// SecurityViolationEvent represents the structured NGINX App Protect security violation data
10+
// SecurityViolationEvent represents the structured NGINX App Protect
11+
// security violation data
1112
message SecurityViolationEvent {
1213
// Name of the security policy
1314
string policy_name = 1;
1415
// Unique support ID for the violation
1516
string support_id = 2;
1617
// Outcome of the request (e.g., REJECTED, PASSED)
17-
string outcome = 3;
18+
RequestOutcome request_outcome = 3;
1819
// Reason for the outcome
19-
string outcome_reason = 4;
20+
RequestOutcomeReason request_outcome_reason = 4;
2021
// Reason for blocking exception if applicable
2122
string blocking_exception_reason = 5;
2223
// HTTP method used
@@ -30,27 +31,27 @@ message SecurityViolationEvent {
3031
// Full request
3132
string request = 10;
3233
// Indicates if the request was truncated
33-
string is_truncated = 11;
34+
bool is_truncated = 11;
3435
// Status of the request
35-
string request_status = 12;
36+
RequestStatus request_status = 12;
3637
// HTTP response code
37-
string response_code = 13;
38+
uint32 response_code = 13;
3839
// Server address
3940
string server_addr = 14;
4041
// Virtual server name
4142
string vs_name = 15;
4243
// Remote address of the client
4344
string remote_addr = 16;
4445
// Destination port
45-
string destination_port = 17;
46+
uint32 destination_port = 17;
4647
// Server port
47-
string server_port = 18;
48+
uint32 server_port = 18;
4849
// List of violations
4950
string violations = 19;
5051
// List of sub-violations
5152
string sub_violations = 20;
5253
// Violation rating
53-
string violation_rating = 21;
54+
uint32 violation_rating = 21;
5455
// Signature set names
5556
string sig_set_names = 22;
5657
// Signature CVEs
@@ -62,7 +63,7 @@ message SecurityViolationEvent {
6263
// Client application version
6364
string client_application_version = 26;
6465
// Severity of the violation
65-
string severity = 27;
66+
Severity severity = 27;
6667
// Threat campaign names
6768
string threat_campaign_names = 28;
6869
// Bot anomalies detected
@@ -102,15 +103,15 @@ message ViolationData {
102103
// SignatureData represents signature data contained within each violation
103104
message SignatureData {
104105
// Signature ID
105-
string sig_data_id = 1;
106+
uint32 sig_data_id = 1;
106107
// Blocking mask
107108
string sig_data_blocking_mask = 2;
108109
// Buffer information
109110
string sig_data_buffer = 3;
110111
// Offset in the buffer
111-
string sig_data_offset = 4;
112+
uint32 sig_data_offset = 4;
112113
// Length of the signature match
113-
string sig_data_length = 5;
114+
uint32 sig_data_length = 5;
114115
}
115116

116117
// ContextData represents the context data of the violation
@@ -120,3 +121,33 @@ message ContextData {
120121
// Value of the context
121122
string context_data_value = 2;
122123
}
124+
125+
enum RequestStatus {
126+
REQUEST_STATUS_UNKNOWN = 0;
127+
REQUEST_STATUS_BLOCKED = 1;
128+
REQUEST_STATUS_ALERTED = 2;
129+
REQUEST_STATUS_PASSED = 3;
130+
}
131+
132+
enum RequestOutcome {
133+
REQUEST_OUTCOME_UNKNOWN = 0;
134+
REQUEST_OUTCOME_PASSED = 1;
135+
REQUEST_OUTCOME_REJECTED = 2;
136+
}
137+
138+
enum RequestOutcomeReason {
139+
SECURITY_WAF_UNKNOWN = 0;
140+
SECURITY_WAF_OK = 1;
141+
SECURITY_WAF_VIOLATION = 2;
142+
SECURITY_WAF_FLAGGED = 3;
143+
SECURITY_WAF_VIOLATION_TRANSPARENT=4;
144+
}
145+
146+
enum Severity {
147+
SEVERITY_UNKNOWN = 0;
148+
SEVERITY_INFORMATIONAL = 1;
149+
SEVERITY_LOW = 2;
150+
SEVERITY_MEDIUM = 3;
151+
SEVERITY_HIGH = 4;
152+
SEVERITY_CRITICAL = 5;
153+
}

docs/proto/protos.md

Lines changed: 79 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@
99
- [SignatureData](#events-v1-SignatureData)
1010
- [ViolationData](#events-v1-ViolationData)
1111

12+
- [RequestOutcome](#events-v1-RequestOutcome)
13+
- [RequestOutcomeReason](#events-v1-RequestOutcomeReason)
14+
- [RequestStatus](#events-v1-RequestStatus)
15+
- [Severity](#events-v1-Severity)
16+
1217
- [mpi/v1/common.proto](#mpi_v1_common-proto)
1318
- [AuthSettings](#mpi-v1-AuthSettings)
1419
- [CommandResponse](#mpi-v1-CommandResponse)
@@ -108,8 +113,8 @@
108113
## events/v1/security_violation.proto
109114
Copyright (c) F5, Inc.
110115

111-
This source code is licensed under the Apache License, Version 2.0 license found in the
112-
LICENSE file in the root directory of this source tree.
116+
This source code is licensed under the Apache License, Version 2.0 license
117+
found in the LICENSE file in the root directory of this source tree.
113118

114119

115120
<a name="events-v1-ContextData"></a>
@@ -131,38 +136,39 @@ ContextData represents the context data of the violation
131136
<a name="events-v1-SecurityViolationEvent"></a>
132137

133138
### SecurityViolationEvent
134-
SecurityViolationEvent represents the structured NGINX App Protect security violation data
139+
SecurityViolationEvent represents the structured NGINX App Protect
140+
security violation data
135141

136142

137143
| Field | Type | Label | Description |
138144
| ----- | ---- | ----- | ----------- |
139145
| policy_name | [string](#string) | | Name of the security policy |
140146
| support_id | [string](#string) | | Unique support ID for the violation |
141-
| outcome | [string](#string) | | Outcome of the request (e.g., REJECTED, PASSED) |
142-
| outcome_reason | [string](#string) | | Reason for the outcome |
147+
| request_outcome | [RequestOutcome](#events-v1-RequestOutcome) | | Outcome of the request (e.g., REJECTED, PASSED) |
148+
| request_outcome_reason | [RequestOutcomeReason](#events-v1-RequestOutcomeReason) | | Reason for the outcome |
143149
| blocking_exception_reason | [string](#string) | | Reason for blocking exception if applicable |
144150
| method | [string](#string) | | HTTP method used |
145151
| protocol | [string](#string) | | Protocol used (e.g., HTTP/1.1) |
146152
| xff_header_value | [string](#string) | | X-Forwarded-For header value |
147153
| uri | [string](#string) | | Request URI |
148154
| request | [string](#string) | | Full request |
149-
| is_truncated | [string](#string) | | Indicates if the request was truncated |
150-
| request_status | [string](#string) | | Status of the request |
151-
| response_code | [string](#string) | | HTTP response code |
155+
| is_truncated | [bool](#bool) | | Indicates if the request was truncated |
156+
| request_status | [RequestStatus](#events-v1-RequestStatus) | | Status of the request |
157+
| response_code | [uint32](#uint32) | | HTTP response code |
152158
| server_addr | [string](#string) | | Server address |
153159
| vs_name | [string](#string) | | Virtual server name |
154160
| remote_addr | [string](#string) | | Remote address of the client |
155-
| destination_port | [string](#string) | | Destination port |
156-
| server_port | [string](#string) | | Server port |
161+
| destination_port | [uint32](#uint32) | | Destination port |
162+
| server_port | [uint32](#uint32) | | Server port |
157163
| violations | [string](#string) | | List of violations |
158164
| sub_violations | [string](#string) | | List of sub-violations |
159-
| violation_rating | [string](#string) | | Violation rating |
165+
| violation_rating | [uint32](#uint32) | | Violation rating |
160166
| sig_set_names | [string](#string) | | Signature set names |
161167
| sig_cves | [string](#string) | | Signature CVEs |
162168
| client_class | [string](#string) | | Client class |
163169
| client_application | [string](#string) | | Client application |
164170
| client_application_version | [string](#string) | | Client application version |
165-
| severity | [string](#string) | | Severity of the violation |
171+
| severity | [Severity](#events-v1-Severity) | | Severity of the violation |
166172
| threat_campaign_names | [string](#string) | | Threat campaign names |
167173
| bot_anomalies | [string](#string) | | Bot anomalies detected |
168174
| bot_category | [string](#string) | | Bot category |
@@ -188,11 +194,11 @@ SignatureData represents signature data contained within each violation
188194

189195
| Field | Type | Label | Description |
190196
| ----- | ---- | ----- | ----------- |
191-
| sig_data_id | [string](#string) | | Signature ID |
197+
| sig_data_id | [uint32](#uint32) | | Signature ID |
192198
| sig_data_blocking_mask | [string](#string) | | Blocking mask |
193199
| sig_data_buffer | [string](#string) | | Buffer information |
194-
| sig_data_offset | [string](#string) | | Offset in the buffer |
195-
| sig_data_length | [string](#string) | | Length of the signature match |
200+
| sig_data_offset | [uint32](#uint32) | | Offset in the buffer |
201+
| sig_data_length | [uint32](#uint32) | | Length of the signature match |
196202

197203

198204

@@ -218,6 +224,64 @@ ViolationData represents individual violation details
218224

219225

220226

227+
228+
<a name="events-v1-RequestOutcome"></a>
229+
230+
### RequestOutcome
231+
232+
233+
| Name | Number | Description |
234+
| ---- | ------ | ----------- |
235+
| REQUEST_OUTCOME_UNKNOWN | 0 | |
236+
| REQUEST_OUTCOME_PASSED | 1 | |
237+
| REQUEST_OUTCOME_REJECTED | 2 | |
238+
239+
240+
241+
<a name="events-v1-RequestOutcomeReason"></a>
242+
243+
### RequestOutcomeReason
244+
245+
246+
| Name | Number | Description |
247+
| ---- | ------ | ----------- |
248+
| SECURITY_WAF_UNKNOWN | 0 | |
249+
| SECURITY_WAF_OK | 1 | |
250+
| SECURITY_WAF_VIOLATION | 2 | |
251+
| SECURITY_WAF_FLAGGED | 3 | |
252+
| SECURITY_WAF_VIOLATION_TRANSPARENT | 4 | |
253+
254+
255+
256+
<a name="events-v1-RequestStatus"></a>
257+
258+
### RequestStatus
259+
260+
261+
| Name | Number | Description |
262+
| ---- | ------ | ----------- |
263+
| REQUEST_STATUS_UNKNOWN | 0 | |
264+
| REQUEST_STATUS_BLOCKED | 1 | |
265+
| REQUEST_STATUS_ALERTED | 2 | |
266+
| REQUEST_STATUS_PASSED | 3 | |
267+
268+
269+
270+
<a name="events-v1-Severity"></a>
271+
272+
### Severity
273+
274+
275+
| Name | Number | Description |
276+
| ---- | ------ | ----------- |
277+
| SEVERITY_UNKNOWN | 0 | |
278+
| SEVERITY_INFORMATIONAL | 1 | |
279+
| SEVERITY_LOW | 2 | |
280+
| SEVERITY_MEDIUM | 3 | |
281+
| SEVERITY_HIGH | 4 | |
282+
| SEVERITY_CRITICAL | 5 | |
283+
284+
221285

222286

223287

0 commit comments

Comments
 (0)