()
| 35 | } |
| 36 | |
| 37 | func GetEvidenceWithCCUrl() ([]byte, error) { |
| 38 | client := &http.Client{Timeout: 3 * time.Second} |
| 39 | |
| 40 | resp, err := client.Get(confidentialContainerEvidenceUrl) |
| 41 | if err != nil { |
| 42 | return nil, fmt.Errorf("http request failed: %w", err) |
| 43 | } |
| 44 | |
| 45 | defer resp.Body.Close() |
| 46 | |
| 47 | if resp.StatusCode != http.StatusOK { |
| 48 | return nil, fmt.Errorf("unexpected status code: %d", resp.StatusCode) |
| 49 | } |
| 50 | |
| 51 | body, err := io.ReadAll(resp.Body) |
| 52 | if err != nil { |
| 53 | return nil, fmt.Errorf("failed to read response body: %w", err) |
| 54 | } |
| 55 | |
| 56 | var buf bytes.Buffer |
| 57 | w := zlib.NewWriter(&buf) |
| 58 | _, err = w.Write(body) |
| 59 | w.Close() |
| 60 | if err != nil { |
| 61 | return nil, fmt.Errorf("failed to compress response body: %w", err) |
| 62 | } |
| 63 | |
| 64 | compressedBody := buf.Bytes() |
| 65 | |
| 66 | return compressedBody, nil |
| 67 | } |
| 68 | |
| 69 | func GetEvidenceWithAgentUuid() ([]byte, error) { |
| 70 | agentUniqueId, err := CalculateAgentUniqueId() |
no test coverage detected