policy-reporter: Cant work with Workload Identity

To use GCS as our storage and push our reports to there, I need to provide JSON for target.gcs.credentials, however this is not the way Workload Identity works actually. In pkg-helper-gcp.go file,

`// NewGCSClient creates a new GCS.client to send Results to GCS Bucket func NewGCSClient(ctx context.Context, credentials, bucket string) GCPClient { cred, err := google.CredentialsFromJSON(ctx, []byte(credentials), storage.ScopeReadWrite) if err != nil { zap.L().Error(“error while creating GCS credentials”, zap.Error(err)) return nil }

client, err := storage.NewClient(ctx, option.WithCredentials(cred))
if err != nil {
	zap.L().Error("error while creating GCS client", zap.Error(err))
	return nil
}

return &gcsClient{
	bucket,
	client,
}

}`

Above function forces users to provide JSON credentials, otherwise logs are error GoogleCloudStorage.Credentials has not been declared

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 15 (8 by maintainers)

Most upvoted comments

there is no interval, it writes each event for new results as soon as a new result was detected

okay, will fix it and prepare another build

I’ll take a look on it