Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

fix: export audit logs additional binding (#13300)

p0nyc64f47963896
diff --git a/frontend/src/types/proto/v1/audit_log_service.ts b/frontend/src/types/proto/v1/audit_log_service.ts
index 2f15b51b55..1d5796019a 100644
--- a/frontend/src/types/proto/v1/audit_log_service.ts
+++ b/frontend/src/types/proto/v1/audit_log_service.ts
@@ -1075,12 +1075,15 @@ export const AuditLogServiceDefinition = {
800016: [new Uint8Array([1])],
578365826: [
new Uint8Array([
- 69,
+ 72,
58,
1,
42,
90,
- 22,
+ 25,
+ 58,
+ 1,
+ 42,
34,
20,
47,
diff --git a/proto/gen/grpc-doc/openapi.yaml b/proto/gen/grpc-doc/openapi.yaml
index 64212e231c..22c543889a 100644
--- a/proto/gen/grpc-doc/openapi.yaml
+++ b/proto/gen/grpc-doc/openapi.yaml
@@ -174,44 +174,12 @@ paths:
tags:
- AuditLogService
operationId: AuditLogService_ExportAuditLogs
- parameters:
- - name: parent
- in: query
- schema:
- type: string
- - name: filter
- in: query
- description: |-
- The filter of the log. It should be a valid CEL expression.
- For example:
- - filter = "method == '/bytebase.v1.SQLService/Query'"
- - filter = "method == '/bytebase.v1.SQLService/Query' && severity == 'ERROR'"
- - filter = "method == '/bytebase.v1.SQLService/Query' && severity == 'ERROR' && user == 'users/[email protected]'"
- - filter = "method == '/bytebase.v1.SQLService/Query' && severity == 'ERROR' && create_time <= '2021-01-01T00:00:00Z' && create_time >= '2020-01-01T00:00:00Z'"
- schema:
- type: string
- - name: orderBy
- in: query
- description: |-
- The order by of the log.
- Only support order by create_time.
- For example:
- - order_by = "create_time asc"
- - order_by = "create_time desc"
- schema:
- type: string
- - name: format
- in: query
- description: The export format.
- schema:
- enum:
- - FORMAT_UNSPECIFIED
- - CSV
- - JSON
- - SQL
- - XLSX
- type: string
- format: enum
+ requestBody:
+ content:
+ application/json:
+ schema:
+ $ref: '#/components/schemas/ExportAuditLogsRequest'
+ required: true
responses:
"200":
description: OK
diff --git a/proto/gen/grpc-doc/v1/index.html b/proto/gen/grpc-doc/v1/index.html
index cc279a9a4f..7612473421 100644
--- a/proto/gen/grpc-doc/v1/index.html
+++ b/proto/gen/grpc-doc/v1/index.html
@@ -4838,7 +4838,7 @@ to retrieve the next page of log entities. </p></td>
<td>ExportAuditLogs</td>
<td>POST</td>
<td>/v1/auditLogs:export</td>
- <td></td>
+ <td>*</td>
</tr>
diff --git a/proto/generated-go/v1/audit_log_service.pb.go b/proto/generated-go/v1/audit_log_service.pb.go
index f336eb6d40..7a76f346f2 100644
--- a/proto/generated-go/v1/audit_log_service.pb.go
+++ b/proto/generated-go/v1/audit_log_service.pb.go
@@ -723,7 +723,7 @@ var file_v1_audit_log_service_proto_rawDesc = []byte{
0x70, 0x6c, 0x69, 0x65, 0x64, 0x5f, 0x75, 0x73, 0x65, 0x72, 0x5f, 0x61, 0x67, 0x65, 0x6e, 0x74,
0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x17, 0x63, 0x61, 0x6c, 0x6c, 0x65, 0x72, 0x53, 0x75,
0x70, 0x70, 0x6c, 0x69, 0x65, 0x64, 0x55, 0x73, 0x65, 0x72, 0x41, 0x67, 0x65, 0x6e, 0x74, 0x32,
- 0x9c, 0x03, 0x0a, 0x0f, 0x41, 0x75, 0x64, 0x69, 0x74, 0x4c, 0x6f, 0x67, 0x53, 0x65, 0x72, 0x76,
+ 0x9f, 0x03, 0x0a, 0x0f, 0x41, 0x75, 0x64, 0x69, 0x74, 0x4c, 0x6f, 0x67, 0x53, 0x65, 0x72, 0x76,
0x69, 0x63, 0x65, 0x12, 0xc1, 0x01, 0x0a, 0x0f, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x41, 0x75,
0x64, 0x69, 0x74, 0x4c, 0x6f, 0x67, 0x73, 0x12, 0x23, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61,
0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x41, 0x75, 0x64, 0x69,
@@ -736,21 +736,21 @@ var file_v1_audit_log_service_proto_rawDesc = []byte{
0x69, 0x74, 0x4c, 0x6f, 0x67, 0x73, 0x3a, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x22, 0x28, 0x2f,
0x76, 0x31, 0x2f, 0x7b, 0x70, 0x61, 0x72, 0x65, 0x6e, 0x74, 0x3d, 0x70, 0x72, 0x6f, 0x6a, 0x65,
0x63, 0x74, 0x73, 0x2f, 0x2a, 0x7d, 0x2f, 0x61, 0x75, 0x64, 0x69, 0x74, 0x4c, 0x6f, 0x67, 0x73,
- 0x3a, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x12, 0xc4, 0x01, 0x0a, 0x0f, 0x45, 0x78, 0x70, 0x6f,
+ 0x3a, 0x73, 0x65, 0x61, 0x72, 0x63, 0x68, 0x12, 0xc7, 0x01, 0x0a, 0x0f, 0x45, 0x78, 0x70, 0x6f,
0x72, 0x74, 0x41, 0x75, 0x64, 0x69, 0x74, 0x4c, 0x6f, 0x67, 0x73, 0x12, 0x23, 0x2e, 0x62, 0x79,
0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x45, 0x78, 0x70, 0x6f, 0x72, 0x74,
0x41, 0x75, 0x64, 0x69, 0x74, 0x4c, 0x6f, 0x67, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
0x1a, 0x24, 0x2e, 0x62, 0x79, 0x74, 0x65, 0x62, 0x61, 0x73, 0x65, 0x2e, 0x76, 0x31, 0x2e, 0x45,
0x78, 0x70, 0x6f, 0x72, 0x74, 0x41, 0x75, 0x64, 0x69, 0x74, 0x4c, 0x6f, 0x67, 0x73, 0x52, 0x65,
- 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x66, 0x8a, 0xea, 0x30, 0x13, 0x62, 0x62, 0x2e, 0x61,
+ 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x69, 0x8a, 0xea, 0x30, 0x13, 0x62, 0x62, 0x2e, 0x61,
0x75, 0x64, 0x69, 0x74, 0x4c, 0x6f, 0x67, 0x73, 0x2e, 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x90,
- 0xea, 0x30, 0x01, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x45, 0x3a, 0x01, 0x2a, 0x5a, 0x16, 0x22, 0x14,
- 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x75, 0x64, 0x69, 0x74, 0x4c, 0x6f, 0x67, 0x73, 0x3a, 0x65, 0x78,
- 0x70, 0x6f, 0x72, 0x74, 0x22, 0x28, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x70, 0x61, 0x72, 0x65, 0x6e,
- 0x74, 0x3d, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x2f, 0x2a, 0x7d, 0x2f, 0x61, 0x75,
- 0x64, 0x69, 0x74, 0x4c, 0x6f, 0x67, 0x73, 0x3a, 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x42, 0x11,
- 0x5a, 0x0f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2d, 0x67, 0x6f, 0x2f, 0x76,
- 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+ 0xea, 0x30, 0x01, 0x82, 0xd3, 0xe4, 0x93, 0x02, 0x48, 0x3a, 0x01, 0x2a, 0x5a, 0x19, 0x3a, 0x01,
+ 0x2a, 0x22, 0x14, 0x2f, 0x76, 0x31, 0x2f, 0x61, 0x75, 0x64, 0x69, 0x74, 0x4c, 0x6f, 0x67, 0x73,
+ 0x3a, 0x65, 0x78, 0x70, 0x6f, 0x72, 0x74, 0x22, 0x28, 0x2f, 0x76, 0x31, 0x2f, 0x7b, 0x70, 0x61,
+ 0x72, 0x65, 0x6e, 0x74, 0x3d, 0x70, 0x72, 0x6f, 0x6a, 0x65, 0x63, 0x74, 0x73, 0x2f, 0x2a, 0x7d,
+ 0x2f, 0x61, 0x75, 0x64, 0x69, 0x74, 0x4c, 0x6f, 0x67, 0x73, 0x3a, 0x65, 0x78, 0x70, 0x6f, 0x72,
+ 0x74, 0x42, 0x11, 0x5a, 0x0f, 0x67, 0x65, 0x6e, 0x65, 0x72, 0x61, 0x74, 0x65, 0x64, 0x2d, 0x67,
+ 0x6f, 0x2f, 0x76, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
diff --git a/proto/generated-go/v1/audit_log_service.pb.gw.go b/proto/generated-go/v1/audit_log_service.pb.gw.go
index 528dc48de9..b67a3486f1 100644
--- a/proto/generated-go/v1/audit_log_service.pb.gw.go
+++ b/proto/generated-go/v1/audit_log_service.pb.gw.go
@@ -197,18 +197,11 @@ func local_request_AuditLogService_ExportAuditLogs_0(ctx context.Context, marsha
}
-var (
- filter_AuditLogService_ExportAuditLogs_1 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
-)
-
func request_AuditLogService_ExportAuditLogs_1(ctx context.Context, marshaler runtime.Marshaler, client AuditLogServiceClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
var protoReq ExportAuditLogsRequest
var metadata runtime.ServerMetadata
- if err := req.ParseForm(); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_AuditLogService_ExportAuditLogs_1); err != nil {
+ if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
@@ -221,10 +214,7 @@ func local_request_AuditLogService_ExportAuditLogs_1(ctx context.Context, marsha
var protoReq ExportAuditLogsRequest
var metadata runtime.ServerMetadata
- if err := req.ParseForm(); err != nil {
- return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
- }
- if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_AuditLogService_ExportAuditLogs_1); err != nil {
+ if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil && err != io.EOF {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
}
diff --git a/proto/v1/audit_log_service.proto b/proto/v1/audit_log_service.proto
index 3f8afadf63..bf8338cbd1 100644
--- a/proto/v1/audit_log_service.proto
+++ b/proto/v1/audit_log_service.proto
@@ -26,8 +26,11 @@ service AuditLogService {
rpc ExportAuditLogs(ExportAuditLogsRequest) returns (ExportAuditLogsResponse) {
option (google.api.http) = {
post: "/v1/{parent=projects/*}/auditLogs:export"
- additional_bindings: {post: "/v1/auditLogs:export"}
body: "*"
+ additional_bindings: {
+ post: "/v1/auditLogs:export"
+ body: "*"
+ }
};
option (bytebase.v1.permission) = "bb.auditLogs.export";
option (bytebase.v1.auth_method) = IAM;