Skip to content

cli: add a flag for disabling ambient OIDC detection #68

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

Merged
merged 2 commits into from
May 3, 2022
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,12 @@ Signing:
Usage: sigstore sign [OPTIONS] FILE [FILE ...]

Options:
--identity-token TEXT
--identity-token TEXT the OIDC identity token to use
--ctfe FILENAME
--help Show this message and exit.
--oidc-disable-ambient-providers
Disable ambient OIDC detection (e.g. on
GitHub Actions)
--help Show this message and exit.
```
<!-- @end-sigstore-sign-help@ -->

Expand Down
29 changes: 24 additions & 5 deletions sigstore/_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,26 +31,45 @@ def main():


@main.command("sign")
@click.option("identity_token", "--identity-token", type=click.STRING)
@click.option(
"identity_token",
"--identity-token",
type=click.STRING,
help="the OIDC identity token to use",
)
@click.option(
"ctfe_pem",
"--ctfe",
type=click.File("rb"),
default=resources.open_binary("sigstore._store", "ctfe.pub"),
)
@click.option(
"oidc_disable_ambient_providers",
"--oidc-disable-ambient-providers",
is_flag=True,
default=False,
help="Disable ambient OIDC detection (e.g. on GitHub Actions)",
)
@click.argument(
"files", metavar="FILE [FILE ...]", type=click.File("rb"), nargs=-1, required=True
"files",
metavar="FILE [FILE ...]",
type=click.File("rb"),
nargs=-1,
required=True,
)
def _sign(files, identity_token, ctfe_pem):
def _sign(files, identity_token, ctfe_pem, oidc_disable_ambient_providers):
# The order of precedence is as follows:
#
# 1) Explicitly supplied identity token
# 2) Ambient credential detected in the environment
# 2) Ambient credential detected in the environment, unless disabled
# 3) Interactive OAuth flow
if not identity_token:
if not identity_token and not oidc_disable_ambient_providers:
identity_token = detect_credential()
if not identity_token:
identity_token = get_identity_token()
if not identity_token:
click.echo("No identity token supplied or detected!", err=True)
raise click.Abort

ctfe_pem = ctfe_pem.read()
for file in files:
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy