Skip to content

Commit

Permalink
Fix bug w/ threshold verification options (#616)
Browse files Browse the repository at this point in the history
Signed-off-by: Brian DeHamer <bdehamer@github.com>
  • Loading branch information
bdehamer committed Jul 17, 2023
1 parent a88a986 commit 6abe9ec
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
5 changes: 5 additions & 0 deletions .changeset/dull-cougars-prove.md
@@ -0,0 +1,5 @@
---
'sigstore': patch
---

Fix bug when setting `tlogThreshold`/`ctLogThreshold` verification options to 0
12 changes: 6 additions & 6 deletions packages/client/src/__tests__/config.test.ts
Expand Up @@ -107,17 +107,17 @@ describe('artifactVerificationOptions', () => {
'1.2.3.4': 'value1',
'5.6.7.8': 'value2',
},
ctLogThreshold: 2,
tlogThreshold: 3,
ctLogThreshold: 0,
tlogThreshold: 0,
};

it('returns the expected options', () => {
const result = artifactVerificationOptions(options);
expect(result.ctlogOptions.disable).toBe(false);
expect(result.ctlogOptions.threshold).toBe(2);
expect(result.ctlogOptions.disable).toBe(true);
expect(result.ctlogOptions.threshold).toBe(0);
expect(result.ctlogOptions.detachedSct).toBe(false);
expect(result.tlogOptions.disable).toBe(false);
expect(result.tlogOptions.threshold).toBe(3);
expect(result.tlogOptions.disable).toBe(true);
expect(result.tlogOptions.threshold).toBe(0);
expect(result.tlogOptions.performOnlineVerification).toBe(false);
expect(result.signers).toBeDefined();

Expand Down
8 changes: 4 additions & 4 deletions packages/client/src/config.ts
Expand Up @@ -157,13 +157,13 @@ export function artifactVerificationOptions(
// Construct the artifact verification options w/ defaults
return {
ctlogOptions: {
disable: false,
threshold: options.ctLogThreshold || 1,
disable: options.ctLogThreshold === 0,
threshold: options.ctLogThreshold ?? 1,
detachedSct: false,
},
tlogOptions: {
disable: false,
threshold: options.tlogThreshold || 1,
disable: options.tlogThreshold === 0,
threshold: options.tlogThreshold ?? 1,
performOnlineVerification: false,
},
signers,
Expand Down

0 comments on commit 6abe9ec

Please sign in to comment.