Skip to content

Commit

Permalink
feat: added Description / updated regex
Browse files Browse the repository at this point in the history
  • Loading branch information
Dieter Bocklandt committed Mar 21, 2023
1 parent d648e0e commit a5e7cf3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion pkg/sync/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import (

const scannerName = "GATEKEEPER"

var policyRegex = regexp.MustCompile(`^(P\d{4}):`)
var policyRegex = regexp.MustCompile(`^(P\d{4}):\s+(.*)$`)

// Resource holds the resource-related values used to create a finding request
type Resource struct {
Expand Down Expand Up @@ -99,6 +99,7 @@ func (c *Client) createFindingRequest(constraint *Constraint, resource *Resource
Parent: c.source,
FindingId: ID,
Finding: &securitycenter.Finding{
Description: resource.Message,
State: securitycenter.Finding_ACTIVE,
ResourceName: resourceName,
Category: constraint.Kind,
Expand Down
1 change: 1 addition & 0 deletions pkg/sync/request_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ func TestClient_createFindingRequest(t *testing.T) {
Parent: "organizations/123/sources/456",
// FindingId: "d0cbf936dbd346c0b7a772eac241cbb",
Finding: &securitycenterpb.Finding{
Description: "violationMessage",
ResourceName: "https://apiserver:443/resourceSelfLink",
State: securitycenterpb.Finding_ACTIVE,
Category: "constraintKind",
Expand Down

0 comments on commit a5e7cf3

Please sign in to comment.