Include attachments in create-evidence output#58
Merged
Conversation
Surface attachment metadata returned by the evidence service in both JSON (full record incl. download_path) and table (name/sha256/type) formats of `jf evd create --format ...`, so callers can confirm which attachment was linked. The `CreateResponseAttachment` struct mirrors the evidence service `AttachmentView` schema 1:1, so the response body unmarshals directly without any client-side transformation. Co-authored-by: Cursor <cursoragent@cursor.com>
Contributor
selalererjfrog
approved these changes
May 11, 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.

Summary
Attachments []CreateResponseAttachmentfield tomodel.CreateResponse, mirroring the evidence serviceAttachmentViewschema (name,sha256,type,download_path) so the create response body unmarshals directly.attachment.<field>for one attachment,attachments[i].<field>for multiple). Empty fields are skipped, matching the existing field rendering convention.download_pathis intentionally JSON-only: it's a long opaque string that distorts the table layout without offering eyeball value; scripted callers that need it should use--format json.download_path), table output (single/empty-fields/multiple attachments),download_pathis asserted to NOT leak into the table, anduploadEvidencefaithfully passes through server-returned attachments.What it looks like
--format table(single attachment):--format json(truncated):{ ..., "attachments": [ { "name": "slsa-provenance-1774941162594-c092e7b4.json", "sha256": "7dbd94658f313ccfc811e28ad40408c48666dc9a19233d0a278140557d9a573f", "type": "application/json", "download_path": "my-repo/.evidence/76ce53.../7dbd94.../slsa-provenance-...json" } ] }Test plan
go build ./...cleango vet ./...clean on affected packagesgo test ./evidence/model/... ./evidence/create/... ./evidence/cli/command/... -count=1— 348 passedjf evd create --attach-artifactory-path ... --format jsonagainst a current evidence service; confirmattachments[]is populated withname/sha256/type/download_path--format table; confirm threeattachment.*rows appear anddownload_pathis absentjf evd createwithout any--attach-*flag; confirm output is unchanged from current behavior (noattachmentskey in JSON, no attachment rows in table)