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

sigstore: fix detect_credential signature #641

Merged
merged 2 commits into from
May 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ All versions prior to 0.9.0 are untracked.
bundle, rather than falling back to deprecated individual targets
([#626](https://github.com/sigstore/sigstore-python/pull/626))

### Fixed

* Removed an unnecessary and backwards-incompatible parameter from the
`sigstore.oidc.detect_credential` API
([#641](https://github.com/sigstore/sigstore-python/pull/641))

## [1.1.2]

### Fixed
Expand Down
3 changes: 1 addition & 2 deletions sigstore/_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
from sigstore._internal.ctfe import CTKeyring
from sigstore._internal.fulcio.client import DEFAULT_FULCIO_URL, FulcioClient
from sigstore._internal.keyring import Keyring
from sigstore._internal.oidc import DEFAULT_AUDIENCE
from sigstore._internal.rekor.client import (
DEFAULT_REKOR_URL,
RekorClient,
Expand Down Expand Up @@ -960,7 +959,7 @@ def _verify_github(args: argparse.Namespace) -> None:
def _get_identity_token(args: argparse.Namespace) -> Optional[str]:
token = None
if not args.oidc_disable_ambient_providers:
token = detect_credential(DEFAULT_AUDIENCE)
token = detect_credential()

if not token:
if args.staging:
Expand Down
5 changes: 3 additions & 2 deletions sigstore/oidc.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import requests
from pydantic import BaseModel, StrictStr

from sigstore._internal.oidc import DEFAULT_AUDIENCE
from sigstore.errors import Error, NetworkError

DEFAULT_OAUTH_ISSUER_URL = "https://oauth2.sigstore.dev/auth"
Expand Down Expand Up @@ -233,9 +234,9 @@ def diagnostics(self) -> str:
"""


def detect_credential(audience: str) -> Optional[str]:
def detect_credential() -> Optional[str]:
"""Calls `id.detect_credential`, but wraps exceptions with our own exception type."""
try:
return cast(Optional[str], id.detect_credential(audience))
return cast(Optional[str], id.detect_credential(DEFAULT_AUDIENCE))
except id.IdentityError as exc:
IdentityError.raise_from_id(exc)