(c context.Context, r *pb.FindRequest)
| 18 | } |
| 19 | |
| 20 | func (s *SecretGRPCServer) FindSecretInfo(c context.Context, r *pb.FindRequest) (*pb.FindResult, error) { |
| 21 | yaraScanner, err := s.YaraRules.NewScanner() |
| 22 | if err != nil { |
| 23 | return &pb.FindResult{}, err |
| 24 | } |
| 25 | |
| 26 | go func() { |
| 27 | log.Info().Interface("request", r).Msg("request to scan") |
| 28 | |
| 29 | namespace := "" |
| 30 | container := "" |
| 31 | image := "" |
| 32 | path := "" |
| 33 | switch { |
| 34 | case r.GetContainer() != nil: |
| 35 | namespace = r.GetContainer().GetNamespace() |
| 36 | container = r.GetContainer().GetId() |
| 37 | case r.GetImage() != nil: |
| 38 | image = r.GetImage().GetName() |
| 39 | default: |
| 40 | path = r.GetPath() |
| 41 | } |
| 42 | |
| 43 | server.DoScan( |
| 44 | r.ScanId, |
| 45 | s.HostMountPath, |
| 46 | s.ExtractorConfig, |
| 47 | s.InactiveThreshold, |
| 48 | &s.ScanMap, |
| 49 | namespace, |
| 50 | path, |
| 51 | image, |
| 52 | container, |
| 53 | yaraScanner, |
| 54 | func(res out.IOCFound, scanID string) { |
| 55 | for i := range res.Matches { |
| 56 | jobs.WriteSingleScanData(output.SecretToSecretInfo(res, i), scanID) |
| 57 | } |
| 58 | }, |
| 59 | ) |
| 60 | }() |
| 61 | return &pb.FindResult{}, nil |
| 62 | } |
nothing calls this directly
no test coverage detected