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

add staging to conformance #684

Merged
merged 1 commit into from
May 2, 2024
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
4 changes: 4 additions & 0 deletions .github/workflows/conformance.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@ on:
branches:
- '**'
pull_request:
# TODO: add cron

jobs:
conformance:
strategy:
max-parallel: 1
matrix:
java-version: [11, 17]
sigstore-env: [production, staging]
loosebazooka marked this conversation as resolved.
Show resolved Hide resolved
fail-fast: false

runs-on: ubuntu-latest
Expand All @@ -35,4 +38,5 @@ jobs:
- uses: sigstore/sigstore-conformance@ee4de0e602873beed74cf9e49d5332529fe69bf6 # v0.0.11
with:
entrypoint: ${{ github.workspace }}/bin/sigstore-cli
environment: ${{ matrix.sigstore-env }}
xfail: "test_verify_dsse_bundle_with_trust_root"
12 changes: 11 additions & 1 deletion sigstore-cli/src/main/java/dev/sigstore/cli/Sign.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,13 @@ public class Sign implements Callable<Integer> {
@ArgGroup(multiplicity = "1", exclusive = true)
SignatureFiles signatureFiles;

@Option(
names = {"--staging"},
description = "test against staging",
required = false,
defaultValue = "false")
Boolean staging;

@Option(
names = {"--identity-token"},
description = "the OIDC identity token to use",
Expand All @@ -49,7 +56,10 @@ public class Sign implements Callable<Integer> {

@Override
public Integer call() throws Exception {
var signerBuilder = KeylessSigner.builder().sigstorePublicDefaults();
var signerBuilder =
staging
? KeylessSigner.builder().sigstoreStagingDefaults()
: KeylessSigner.builder().sigstorePublicDefaults();
if (identityToken != null) {
// If we've explicitly provided an identity token, customize the signer to only use the token
// string OIDC client.
Expand Down
32 changes: 25 additions & 7 deletions sigstore-cli/src/main/java/dev/sigstore/cli/Verify.java
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,27 @@ public class Verify implements Callable<Integer> {
@ArgGroup(multiplicity = "0..1", exclusive = false)
Policy policy;

@Option(
names = {"--trusted-root"},
description = "an alternative to the TUF managed sigstore public good trusted root",
required = false)
Path trustedRoot;
@ArgGroup(multiplicity = "0..1", exclusive = true)
Target target;

/**
* Chose one trusted root provider target, (staging or prod or custom trusted_root), default is
* prod.
*/
static class Target {
@Option(
names = {"--staging"},
description = "test against staging",
required = false,
defaultValue = "false")
Boolean staging;

@Option(
names = {"--trusted-root"},
description = "an alternative to the TUF managed sigstore public good trusted root",
required = false)
Path trustedRoot;
}

static class Policy {
@Option(
Expand Down Expand Up @@ -101,9 +117,11 @@ public Integer call() throws Exception {
var verificationOptions = verificationOptionsBuilder.alwaysUseRemoteRekorEntry(false).build();

var verifier =
(trustedRoot == null)
target == null
? new KeylessVerifier.Builder().sigstorePublicDefaults().build()
: new KeylessVerifier.Builder().fromTrustedRoot(trustedRoot).build();
: target.staging
? new KeylessVerifier.Builder().sigstoreStagingDefaults().build()
: new KeylessVerifier.Builder().fromTrustedRoot(target.trustedRoot).build();
verifier.verify(
artifact,
KeylessVerificationRequest.builder()
Expand Down
Loading