Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,16 @@ All notable changes to `src-cli` are documented in this file.

## Unreleased

## 5.8.2

### Added

- Support HTTP(S), SOCKS5, and UNIX Domain Socket proxies via SRC_PROXY environment variable. [#1120](https://github.com/sourcegraph/src-cli/pull/1120)

### Fixed

- Fixed a compatibility issue that prevented `src sbom fetch` from fetching some SBOMs [#1119](https://github.com/sourcegraph/src-cli/pull/1119)

## 5.8.1

### Fixed
Expand Down
9 changes: 8 additions & 1 deletion cmd/src/sbom_fetch.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"bufio"
"bytes"
"encoding/base64"
"encoding/json"
"flag"
Expand Down Expand Up @@ -262,8 +263,14 @@ type attestation struct {
}

func extractSBOM(attestationBytes []byte) (string, error) {
// Ensure we only use the first line - occasionally Cosign includes multiple lines
lines := bytes.Split(attestationBytes, []byte("\n"))
if len(lines) == 0 {
return "", fmt.Errorf("attestation is empty")
}

var a attestation
if err := json.Unmarshal(attestationBytes, &a); err != nil {
if err := json.Unmarshal(lines[0], &a); err != nil {
return "", fmt.Errorf("failed to unmarshal attestation: %w", err)
}

Expand Down
2 changes: 1 addition & 1 deletion cmd/src/sbom_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ func getImageDigestDockerHub(image string, tag string) (string, error) {
return "", err
}
req.Header.Add("Authorization", fmt.Sprintf("Bearer %s", token))
req.Header.Add("Accept", "Accept: application/vnd.docker.distribution.manifest.v2+json, application/vnd.oci.image.manifest.v1+json")
req.Header.Add("Accept", "application/vnd.docker.distribution.manifest.v2+json, application/vnd.oci.image.manifest.v1+json")

// Make the HTTP request
resp, err := http.DefaultClient.Do(req)
Expand Down