feat: add user-agent header#10
Merged
Merged
Conversation
# Conflicts: # .github/workflows/build.yaml # internal/bifrost/api_test.go
There was a problem hiding this comment.
Pull request overview
This PR adds a User-Agent header to SBOM upload HTTP requests, intending to identify the CLI as bifrost-cli/<version> where the version is derived from Git metadata and/or release inputs.
Changes:
- Thread the CLI version from
CLI(...)→NewSBOMUploadTask(...)→NewAPI(...)and setUser-Agenton upload requests. - Update tests to assert the new
User-Agentheader is present. - Adjust build plumbing (Makefile + GitHub Actions) to pass version/commit information into the build.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| Makefile | Makes VERSION/GIT_COMMIT overridable and embeds them via -ldflags for runtime version reporting. |
| internal/bifrost/sbom_upload.go | Passes the CLI version into API construction for request header population. |
| internal/bifrost/cli.go | Updates SBOM upload task construction to include the CLI version. |
| internal/bifrost/cli_test.go | Adds assertion that the CLI-driven upload includes User-Agent. |
| internal/bifrost/api.go | Adds userAgent handling and sets User-Agent on the upload request. |
| internal/bifrost/api_test.go | Adds User-Agent assertions and updates most NewAPI call sites for the new signature. |
| .github/workflows/build.yaml | Updates version derivation and propagates version/commit through environment into make build-all. |
Comments suppressed due to low confidence (1)
internal/bifrost/api.go:45
NewAPInow requires an extraversionargument, but there is still at least one call site using the old signature (e.g.internal/bifrost/api_test.go:85inTestAPI_UploadSBOM_EscapesServiceAndVersionPathSegments), which will cause compilation failures. Update the remaining call(s) to pass a version string (or "" to omit the/versionsuffix in the User-Agent).
func NewAPI(serverURL string, token string, retryAttempts int, retryDelay time.Duration, gitBranch string, gitCommitSHA string, gitOrigin string, version string) API {
if retryAttempts < 0 {
retryAttempts = 0
}
if retryDelay < 0 {
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
konrader
approved these changes
Jul 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds a
User-Agentheader to the SBOM upload request. TheUser-Agentisbifrost-cli/<version>, where the version is the latest version tag plus the current commit, number of commits off from the release and-dirtyif built with uncomited changes. A clean examplebifrost-cli/v0.1.4and a "dirty" examplebifrsot-cli/v0.1.4-4-g82f64fd-dirty