Skip to content

fix(attestation): drop trailing @ in agentIdentity.binary when version empty#93

Merged
manzil-infinity180 merged 2 commits into
devfrom
fix/attestation-binary-trailing-at-92
May 9, 2026
Merged

fix(attestation): drop trailing @ in agentIdentity.binary when version empty#93
manzil-infinity180 merged 2 commits into
devfrom
fix/attestation-binary-trailing-at-92

Conversation

@manzil-infinity180
Copy link
Copy Markdown
Contributor

@manzil-infinity180 manzil-infinity180 commented May 5, 2026

Closes #92.

Attestation predicate emitted "name@" with a trailing @ when Binary.Version was empty (the kernel-attested peer-cred path leaves Version empty intentionally — Digest is the authoritative version). Now mirrors the conditional already in internal/identity/agent.go.

run-mcp-spire (main) $ TMP_SOCK=$(mktemp -u)
run-mcp-spire (main) $ socat UNIX-LISTEN:"$TMP_SOCK" /dev/null &
[1] 18290
run-mcp-spire (main) $ SOCAT_PID=$!
run-mcp-spire (main) $ sleep 1
run-mcp-spire (main) $ /usr/sbin/lsof -p $SOCAT_PID -Fn | head -25
p18290
fcwd
n/Users/rahulxf/work-dir/aflock-example/peer-cred-pr88/workspace/run-mcp-spire
ftxt
n/opt/homebrew/Cellar/socat/1.8.1.0/bin/socat1
ftxt
n/opt/homebrew/Cellar/openssl@3/3.6.0/lib/libssl.3.dylib
ftxt
n/usr/lib/dyld
ftxt
n/opt/homebrew/Cellar/openssl@3/3.6.0/lib/libcrypto.3.dylib
f0
n/dev/ttys004
f1
n/dev/ttys004
f2
n/dev/ttys004
f3
n->0x17d7056f3df9db4c
f4
n->0xd027271815ff2af0
f5
n/var/folders/4h/5y3zgd4915j20mq_xjbv3bvc0000gn/T/tmp.UtGJceaYft
Screenshot 2026-05-06 at 12 43 27 AM
  Before PR #93 (today):                                                                                                                                                             
  "agentIdentity": {                                                                                           
    "binary": "socat1@",name + "@" + empty version = trailing dangling @                                                                                                 
    "binaryHash": "aba6184a..."                                                                                                                                                    
  }                                                                                                                                                                                  
                                                                                                  
  After PR #93 merges:                                                                                                                                                               
  "agentIdentity": {                                                                              
    "binary": "socat1",             just the name, no @
    "binaryHash": "aba6184a..."                         
  }                                          

…n empty

CreateActionAttestation formatted the binary field as "%s@%s"
(Name, Version), so peer-cred-attested attestations — where Version is
intentionally empty — emitted strings like "socat1@" with a trailing @.

Now only appends "@<version>" when Version is non-empty, matching the
canonical-string code in internal/identity/agent.go.

Signed-off-by: Rahul Vishwakarma <rahulvs2809@gmail.com>
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes the attestation predicate formatting for agentIdentity.binary to avoid emitting a trailing @ when the discovered binary version is empty (notably in the kernel-attested peer-cred identity path).

Changes:

  • Update CreateActionAttestation to only append @<version> when Binary.Version is non-empty.
  • Add a regression test ensuring agentIdentity.binary does not end with @ when the version is empty.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
internal/attestation/signer.go Adjusts agentIdentity.binary string construction to avoid trailing @ when version is empty.
internal/attestation/signer_test.go Adds a regression test covering the empty-version binary formatting behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread internal/attestation/signer.go Outdated
Symmetric edge case to the empty-Version dangling @: if Name is missing
but Version was defaulted, the predicate would emit a leading "@0.0.0".
Now require both halves to be non-empty before joining.

Signed-off-by: Rahul Vishwakarma <rahulvs2809@gmail.com>
@manzil-infinity180 manzil-infinity180 requested a review from Copilot May 6, 2026 17:41
@manzil-infinity180 manzil-infinity180 changed the base branch from main to dev May 9, 2026 10:32
@manzil-infinity180 manzil-infinity180 merged commit a0aecab into dev May 9, 2026
10 checks passed
@manzil-infinity180 manzil-infinity180 deleted the fix/attestation-binary-trailing-at-92 branch May 9, 2026 10:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug(attestation): trailing @ in agentIdentity.binary when version empty (kernel-attested path)

2 participants