Skip to content

Commit bc70a8f

Browse files
PR #1252 review suggestions fixed
* Only when there are no CT Logs (private deployment) we can skip SCT verification
1 parent 8de4432 commit bc70a8f

3 files changed

Lines changed: 16 additions & 11 deletions

File tree

sigstore-java/src/main/java/dev/sigstore/KeylessVerifier.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,9 +132,8 @@ public Builder trustedRootProvider(TrustedRootProvider trustedRootProvider) {
132132
private AlgorithmRegistry.HashAlgorithm findHashAlgorithm(Bundle bundle)
133133
throws KeylessVerificationException {
134134
try {
135-
// rekor 0.0.1 hashedrekord entries encode the hash algorithm in the entry itself. Others
136-
// (rekor 0.0.2, a bundle with no transparency-log entry) derive it from the signing
137-
// certificate's public key.
135+
// special case hashedrekord:0.0.1 and dsse:0.0.1 which may contain legacy public key to hash
136+
// algorithm mappings
138137
if (!bundle.getEntries().isEmpty()) {
139138
var rekorEntry = bundle.getEntries().get(0);
140139
var body = rekorEntry.getBodyDecoded();

sigstore-java/src/main/java/dev/sigstore/bundle/BundleReader.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ static Bundle readBundle(Reader jsonReader) throws BundleParseException {
5050

5151
bundleBuilder.mediaType(protoBundle.getMediaType());
5252

53-
// A bundle may skip tlog entries in private environments that don't require them.
5453
for (var bundleEntry : protoBundle.getVerificationMaterial().getTlogEntriesList()) {
5554
if (!bundleEntry.hasInclusionProof()) {
5655
// all consumed bundles must have an inclusion proof

sigstore-java/src/main/java/dev/sigstore/fulcio/client/FulcioVerifier.java

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,17 @@ private FulcioVerifier(
9696

9797
@VisibleForTesting
9898
void verifySct(CertPath fullCertPath) throws FulcioVerificationException {
99-
if (ctLogs.size() == 0) {
99+
verifySct(fullCertPath, CTLogOptions.builder().isEnabled(true).build());
100+
}
101+
102+
@VisibleForTesting
103+
void verifySct(CertPath fullCertPath, CTLogOptions ctLogOptions)
104+
throws FulcioVerificationException {
105+
if (ctLogs.isEmpty()) {
106+
// Only when there are no CT Logs (private deployment) we can skip SCT verification
107+
if (!ctLogOptions.isEnabled()) {
108+
return;
109+
}
100110
throw new FulcioVerificationException("No ct logs were provided to verifier");
101111
}
102112

@@ -155,16 +165,13 @@ public void verifySigningCertificate(CertPath signingCertificate)
155165
}
156166

157167
/**
158-
* Verify a signing certificate, applying the given certificate-transparency policy. When SCT
159-
* verification is disabled (ex: a private deployment without CT logs) the SCT check is skipped.
168+
* Verify a signing certificate, applying the given certificate-transparency policy (see {@link
169+
* #verifySct(CertPath, CTLogOptions)}).
160170
*/
161171
public void verifySigningCertificate(CertPath signingCertificate, CTLogOptions ctLogOptions)
162172
throws FulcioVerificationException, IOException {
163173
CertPath fullCertPath = validateCertPath(signingCertificate);
164-
if (!ctLogOptions.isEnabled()) {
165-
return;
166-
}
167-
verifySct(fullCertPath);
174+
verifySct(fullCertPath, ctLogOptions);
168175
}
169176

170177
public CertPath trimTrustedParent(CertPath signingCertificate)

0 commit comments

Comments
 (0)