-
Notifications
You must be signed in to change notification settings - Fork 7
Drop protobufs, bump sigstore version #144
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
Changes from 10 commits
fdf2edb
b79aa5f
0f76f0a
ffd5bb4
bcec5e9
206746e
f5b5435
fee1038
7ed7b17
48b077a
eeb7a7a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,7 @@ | |
) | ||
from pydantic import ValidationError | ||
from rfc3986 import exceptions, uri_reference, validators | ||
from sigstore.models import Bundle, InvalidBundle | ||
from sigstore.models import Bundle, ClientTrustConfig, InvalidBundle | ||
from sigstore.oidc import IdentityError, IdentityToken, Issuer | ||
from sigstore.sign import SigningContext | ||
from sigstore.verify import policy | ||
|
@@ -254,8 +254,11 @@ def get_identity_token(args: argparse.Namespace) -> IdentityToken: | |
if oidc_token is not None: | ||
return IdentityToken(oidc_token) | ||
|
||
# Fallback to interactive OAuth-2 Flow | ||
issuer: Issuer = Issuer.staging() if args.staging else Issuer.production() | ||
if args.staging: | ||
trust_config = ClientTrustConfig.staging() | ||
else: | ||
trust_config = ClientTrustConfig.production() | ||
issuer: Issuer = Issuer(trust_config.signing_config.get_oidc_url()) | ||
return issuer.identity_token() | ||
|
||
|
||
|
@@ -424,7 +427,11 @@ def _sign(args: argparse.Namespace) -> None: | |
except IdentityError as identity_error: | ||
_die(f"Failed to detect identity: {identity_error}") | ||
|
||
signing_ctx = SigningContext.staging() if args.staging else SigningContext.production() | ||
trust_config = ClientTrustConfig.staging() if args.staging else ClientTrustConfig.production() | ||
# Make sure we use rekor v1 until attestations are compatible with v2 | ||
trust_config.force_tlog_version = 1 | ||
Comment on lines
+430
to
+432
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not an issue for this PR, but I kind of wish we had a public API for this operation that wasn't setting an attribute/property directly 😅 -- I can see us perhaps wanting to remove this attribute at some point. |
||
|
||
signing_ctx = SigningContext.from_trust_config(trust_config) | ||
|
||
# Validates that every file we want to sign exist but none of their attestations | ||
_validate_files(args.files, should_exist=True) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,10 +6,20 @@ | |
|
||
@pytest.fixture(scope="session") | ||
def id_token() -> oidc.IdentityToken: | ||
if "EXTREMELY_DANGEROUS_PUBLIC_OIDC_BEACON" in os.environ: | ||
import requests | ||
|
||
resp = requests.get( | ||
"https://raw.githubusercontent.com/sigstore-conformance/extremely-dangerous-public-oidc-beacon/refs/heads/current-token/oidc-token.txt" | ||
) | ||
Comment on lines
+12
to
+14
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. copying from the other PR:
maybe this is not a show stopper here: we could do this and improve if it fails too often There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, not a blocker IMO. We can re-evaluate if the error rate ends up being annoying. |
||
resp.raise_for_status() | ||
id_token = resp.text.strip() | ||
return oidc.IdentityToken(id_token) | ||
|
||
if "CI" in os.environ: | ||
token = oidc.detect_credential() | ||
if token is None: | ||
pytest.fail("misconfigured CI: no ambient OIDC credential") | ||
return oidc.IdentityToken(token) | ||
else: | ||
return oidc.Issuer.staging().identity_token() | ||
|
||
pytest.fail("no OIDC token available for tests") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a ton for doing this @jku!