Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show the federated IdP in the CLI instead of the Sigstore DEX instance #184

Merged
merged 1 commit into from
May 20, 2024
Merged
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
5 changes: 4 additions & 1 deletion model_signing/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,10 @@ def sign(self, inputfn: Path, signaturefn: Path,
oidc_token = self.get_identity_token()
if not oidc_token:
raise ValueError("No identity token supplied or detected!")
print(f"identity-provider: {oidc_token.issuer}",
# Calling the private attribute IdentityToken._federated issuer
# is a workaround for earlier versions of sigstore-python (<3.0.0)
# that do not support the federated_issuer property.
print(f"identity-provider: {oidc_token._federated_issuer}",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is federated issuer always set? If a non-Dex token is used, what is this value?

Copy link
Collaborator

Choose a reason for hiding this comment

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

@woodruffw please advise

Copy link
Collaborator

@laurentsimon laurentsimon May 17, 2024

Choose a reason for hiding this comment

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

@mayaCostantini this is the original issue + solution that @woodruffw told us should work sigstore/sigstore-python#970 (comment). So the right solution is probably .expected_certificate_subject instead of . _federated_issuer

Copy link
Member

Choose a reason for hiding this comment

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

With sigstore-python 3.0.0, federated_issuer should fall back to the "top-level" issuer if the Dex-specific federation claim isn't present. You can see that here:

https://github.com/sigstore/sigstore-python/blob/29c98ea7f58c3047b9b5e062af912f4523ff1514/sigstore/oidc.py#L208-L227

(Before 3.0.0, federated_issuer was called expected_certificate_subject, which was a misleading name. But they're the same API.)

file=sys.stderr)
print(f"identity: {oidc_token.identity}", file=sys.stderr)

Expand Down
Loading