Skip to content

Print signing identity and issuer to stderr after signing#821

Open
arpitjain099 wants to merge 2 commits into
sigstore:mainfrom
arpitjain099:feat/print-signing-identity
Open

Print signing identity and issuer to stderr after signing#821
arpitjain099 wants to merge 2 commits into
sigstore:mainfrom
arpitjain099:feat/print-signing-identity

Conversation

@arpitjain099

Copy link
Copy Markdown

Summary

After a successful sign, gitsign now prints the certificate-identity and certificate-oidc-issuer that were actually used, plus a ready-to-run gitsign verify command. This makes it obvious which values to pass to the verify flags.

This is the narrower half of #693 (report-after-signing). It does not add a separate "inspect a commit" subcommand.

Fixes #693

Why

In v2, gitsign verify requires --certificate-identity and --certificate-oidc-issuer, but it is not obvious which values to use. As the issue notes, the GitHub issuer is https://github.com/login/oauth (not https://github.com), and the identity is the user's private email rather than the privacy-sparing address. Surfacing both right after signing removes that guesswork.

Output goes to stderr, not stdout

@adityasaky raised the concern about tools that parse gitsign's stdout after signing. To avoid breaking those, the new message is written to TTYOut, which is a TTY when one is available and falls back to stderr otherwise, and never to s.Out. s.Out (stdout) still carries only the signature bytes, so machine parsers consuming gitsign's stdout are unaffected. This is the same stream the existing "tlog entry created with index" status line already uses.

Example (stderr):

gitsign: signed with identity "foo@example.com" (issuer "https://github.com/login/oauth")
gitsign: to verify, run: gitsign verify --certificate-identity "foo@example.com" --certificate-oidc-issuer "https://github.com/login/oauth"

How identity and issuer are extracted

A small helper, internal.NewSigningIdentity(cert), reads:

  • the identity from the certificate subject alternative names via cryptoutils.GetSubjectAlternateNames (joining multiple SANs so nothing is silently dropped), and
  • the issuer from the Fulcio OIDC issuer extension via cosign.CertExtensions{Cert: cert}.GetIssuer().

These are the same sources gitsign verify already reads back when it prints "Good signature from ...", so what is reported at sign time matches what verify expects.

Tests

internal/utils_test.go adds table-driven unit tests for the extraction (email SAN, URI SAN, multiple SANs joined, and the empty cert) and for the formatted guidance string. go test ./internal/... passes; go vet and gofmt are clean.

@wlynch wlynch left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the commit! One small comment.

Comment thread internal/utils.go Outdated
// String formats the signing identity as guidance for the verify command,
// pointing the user at the exact flag values to pass.
func (s SigningIdentity) String() string {
return fmt.Sprintf("gitsign: signed with identity %q (issuer %q)\ngitsign: to verify, run: gitsign verify --certificate-identity %q --certificate-oidc-issuer %q",

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

First line looks good, but the second feels somewhat verbose. I'd drop this or put it behind a flag so it's not shown by default.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Bumping this gently since it's been a while. I dropped the second line back in June (4755721), so the output is now just the identity and issuer, which I think is what you were after.

No rush at all, but let me know if you'd like anything else changed here. Happy to rebase onto main too if that helps, the branch is a few commits behind now.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Rebased onto main just now (98340df), so it's up to date and conflict-free. go build ./... and go test ./internal/... are both green on the rebased branch, including with the sigstore-go 1.2.0 bump that landed in the meantime.

Ready whenever you or another maintainer has a chance to take a look.

@arpitjain099

Copy link
Copy Markdown
Author

Dropped the second line (the full gitsign verify ... command) as suggested - it now prints just the identity and issuer. Thanks @wlynch!

After a successful sign, gitsign now reports the certificate-identity and
certificate-oidc-issuer recorded in the Fulcio certificate, along with a
ready-to-run gitsign verify command. This addresses the common confusion
where a user does not know which values to pass to the verify flags (for
example that the GitHub issuer is https://github.com/login/oauth, and that
the identity is the private email, not the privacy-sparing address).

The message is written to TTYOut (a TTY, or stderr when no TTY is present)
and never to stdout, so tools that parse gitsign's stdout signature output
are unaffected.

The identity is taken from the certificate subject alternative names and
the issuer from the Fulcio OIDC issuer extension, the same sources the
verify command reads back. Extraction is factored into internal.
NewSigningIdentity with unit tests.

Fixes sigstore#693

Signed-off-by: Arpit Jain <arpitjain099@gmail.com>
Per review, the second line (the full 'gitsign verify --certificate-identity ...' command) is verbose to show on every signing. Keep just the identity and issuer line; users who want the verify command can derive it from those values.

Signed-off-by: Arpit Jain <arpitjain099@gmail.com>
@arpitjain099
arpitjain099 force-pushed the feat/print-signing-identity branch from 4755721 to 98340df Compare July 20, 2026 14:41
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.

When signing, gitsign should show the certificate-oidc-issuer & certificate-identity used after signing complete

2 participants