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

collect timestamps from bundle #931

Merged
merged 1 commit into from
Jan 4, 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
5 changes: 5 additions & 0 deletions .changeset/plenty-glasses-chew.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@sigstore/verify": patch
---

Read RFC3161 timestamps during verification
35 changes: 32 additions & 3 deletions packages/verify/src/__tests__/__fixtures__/bundles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,14 @@ export const V1 = {
'eyJhcGlWZXJzaW9uIjoiMC4wLjEiLCJraW5kIjoiaGFzaGVkcmVrb3JkIiwic3BlYyI6eyJkYXRhIjp7Imhhc2giOnsiYWxnb3JpdGhtIjoic2hhMjU2IiwidmFsdWUiOiI2OGU2NTZiMjUxZTY3ZTgzNThiZWY4NDgzYWIwZDUxYzY2MTlmM2U3YTFhOWYwZTc1ODM4ZDQxZmYzNjhmNzI4In19LCJzaWduYXR1cmUiOnsiY29udGVudCI6Ik1FUUNJSHM1YVV1bHExSHBSK2Z3bVNLcExrL29Bd3E1TzlDRE5GSGhaQUtmRzVHbUFpQndjVm5mMm9ienNDR1ZsZjBBSXZidkhyMjFOWHQ3dHBMQmw0K0JyaDZPS0E9PSIsInB1YmxpY0tleSI6eyJjb250ZW50IjoiTFMwdExTMUNSVWRKVGlCRFJWSlVTVVpKUTBGVVJTMHRMUzB0Q2sxSlNVTnZSRU5EUVdsaFowRjNTVUpCWjBsVlpYWmhaU3R1VEZFNGJXYzJUM2xQUWpRelRVdEtNVEJHTWtORmQwTm5XVWxMYjFwSmVtb3dSVUYzVFhjS1RucEZWazFDVFVkQk1WVkZRMmh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RVEJhUm5Gek9UbFJaMUk1YlVGMFJrMVhkRmR5VDJwdFZVTTBOM3BuWVc5dmJFdEpiMHhJTDA5M1pFMDkifV19LCJoYXNoIjp7ImFsZ29yaXRobSI6InNoYTI1NiIsInZhbHVlIjoiZGNiNDkyNTljODY2MDdjMzQ2MzVkYWJiNDQzMWYwNjVlOWE3YTczNDcwNGNiNzNmMGFhMGY2YWFhMzg5NmEwNCJ9LCJwYXlsb2FkSGFzaCI6eyJhbGdvcml0aG0iOiJzaGEyNTYiLCJ2YWx1ZSI6IjY4ZTY1NmIyNTFlNjdlODM1OGJlZjg0ODNhYjBkNTFjNjYxOWYzZTdhMWE5ZjBlNzU4MzhkNDFmZjM2OGY3MjgifX19fQ==',
},
],
timestampVerificationData: { rfc3161Timestamps: [] },
timestampVerificationData: {
rfc3161Timestamps: [
{
signedTimestamp:
'MIICHTADAgEAMIICFAYJKoZIhvcNAQcCoIICBTCCAgECAQMxDzANBglghkgBZQMEAgEFADB0BgsqhkiG9w0BCRABBKBlBGMwYQIBAQYJKwYBBAGDvzACMC8wCwYJYIZIAWUDBAIBBCDUifDVKumA2DgoehAwX6fdYI7i60hzAHN44jApqXJ1KAIE3q2+7xgPMjAyMjExMDgyMjU4MDdaMAMCAQECBEmWAtKgADGCAXEwggFtAgEBMCswJjEMMAoGA1UEAxMDdHNhMRYwFAYDVQQKEw1zaWdzdG9yZS5tb2NrAgECMA0GCWCGSAFlAwQCAQUAoIHVMBoGCSqGSIb3DQEJAzENBgsqhkiG9w0BCRABBDAcBgkqhkiG9w0BCQUxDxcNMjIxMTA4MjI1ODA3WjAvBgkqhkiG9w0BCQQxIgQgaorJUUcVGFzCqZxtwDluzJLOMbgkBlNG2NIUIC2juOAwaAYLKoZIhvcNAQkQAi8xWTBXMFUwUwQg7xanBUbnZqL3LxnHaWKqwHet5zHHqi3CPzwetDjqMeswLzAqpCgwJjEMMAoGA1UEAxMDdHNhMRYwFAYDVQQKEw1zaWdzdG9yZS5tb2NrAgECMA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5zHHqi3CPzwetDjqMeswLzAqpCgwJjEMMAoGA1UEAxMDdHNhMRYwFAYDVQQKEw1zaWdzdG9yZS5tb2NrAgECMAoGCCqGSM49BAMCBEcwRQIhAMxoI/p4CfwuOM2hXf/WiIeqPPAqwD7SBxjAktNFQ0HFAiAyctHzpTfky8zDDp1TH5HvlNY5p1ObZi+k4h0dwIQpNw==',
},
],
},
},
dsseEnvelope: {
payload: 'aGVsbG8sIHdvcmxkIQ==',
Expand Down
26 changes: 25 additions & 1 deletion packages/verify/src/__tests__/__fixtures__/trust.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,31 @@ const trustedRootJSON = {
},
},
],
timestampAuthorities: [],
timestampAuthorities: [
{
subject: {
organization: '',
commonName: '',
},
uri: 'http://localhost:8080',
certChain: {
certificates: [
{
rawBytes:
'MIIBuzCCAWGgAwIBAgIBAjAKBggqhkjOPQQDAzAmMQwwCgYDVQQDEwN0c2ExFjAUBgNVBAoTDXNpZ3N0b3JlLm1vY2swHhcNMjIwMTAxMDAwMDAwWhcNMjQwMTAxMDAwMDAwWjAuMRQwEgYDVQQDEwt0c2Egc2lnbmluZzEWMBQGA1UEChMNc2lnc3RvcmUubW9jazBZMBMGByqGSM49AgEGCCqGSM49AwEHA0IABGCOIXjk6za2Ttu3pRRPMp363TzIpLbUZG3vrySkOdBum38EN1soS6UcMMKIXpQwJvMUcyeep2LCGt1R4r1b6ZijeDB2MAwGA1UdEwEB/wQCMAAwDgYDVR0PAQH/BAQDAgeAMBYGA1UdJQEB/wQMMAoGCCsGAQUFBwMIMB0GA1UdDgQWBBQ/FFxk7FUxt/oE8lDZEF0s7kasuDAfBgNVHSMEGDAWgBQ/FFxk7FUxt/oE8lDZEF0s7kasuDAKBggqhkjOPQQDAwNIADBFAiEArRcIu8babXmdnuGaW6qlH/kEg4GFvbme1VT0tc3o1I4CIHpMdIm3GVBdc2ac0NmQRo3EDXJIdsFdcAAKbG0vFEwZ',
},
{
rawBytes:
'MIIBnTCCAUSgAwIBAgIBATAKBggqhkjOPQQDAzAmMQwwCgYDVQQDEwN0c2ExFjAUBgNVBAoTDXNpZ3N0b3JlLm1vY2swHhcNMjIwMTAxMDAwMDAwWhcNMjQwMTAxMDAwMDAwWjAmMQwwCgYDVQQDEwN0c2ExFjAUBgNVBAoTDXNpZ3N0b3JlLm1vY2swWTATBgcqhkjOPQIBBggqhkjOPQMBBwNCAARgjiF45Os2tk7bt6UUTzKd+t08yKS21GRt768kpDnQbpt/BDdbKEulHDDCiF6UMCbzFHMnnqdiwhrdUeK9W+mYo2MwYTAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUPxRcZOxVMbf6BPJQ2RBdLO5GrLgwHwYDVR0jBBgwFoAUPxRcZOxVMbf6BPJQ2RBdLO5GrLgwCgYIKoZIzj0EAwMDRwAwRAIgeIGv1zfVElTGrpX6rofi6blEa70mVQXyoKxkXf49+E8CIBtsrSwDbmGUMhjAF5kxaLThEsBCZHRKi+BKcZ4sJlBE',
},
],
},
validFor: {
start: undefined,
end: undefined,
},
},
],
};

export const trustedRoot = TrustedRoot.fromJSON(trustedRootJSON);
23 changes: 22 additions & 1 deletion packages/verify/src/__tests__/bundle/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,27 @@ describe('toSignedEntity', () => {
describe('when the bundle is a dsseEnvelope', () => {
const bundle = bundleFromJSON(bundles.V1.DSSE.WITH_SIGNING_CERT.TLOG_DSSE);

it('returns a SignedEntity', () => {
const entity = toSignedEntity(bundle);

expect(entity).toBeDefined();

assert(entity.key.$case === 'certificate');
expect(entity.key.certificate).toBeInstanceOf(X509Certificate);

expect(entity.signature).toBeDefined();
expect(entity.tlogEntries).toHaveLength(1);
expect(entity.timestamps).toHaveLength(2);
});
});

describe('when the bundle has no RFC3161 timestamps', () => {
const bundle = bundleFromJSON(bundles.V1.DSSE.WITH_SIGNING_CERT.TLOG_DSSE);

beforeEach(() => {
bundle.verificationMaterial.timestampVerificationData = undefined;
});

it('returns a SignedEntity', () => {
const entity = toSignedEntity(bundle);

Expand Down Expand Up @@ -50,7 +71,7 @@ describe('toSignedEntity', () => {

expect(entity.signature).toBeDefined();
expect(entity.tlogEntries).toHaveLength(1);
expect(entity.timestamps).toHaveLength(1);
expect(entity.timestamps).toHaveLength(2);
});
});
});
2 changes: 1 addition & 1 deletion packages/verify/src/__tests__/trust/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ describe('toTrustMaterial', () => {
const result = toTrustMaterial(trustedRoot);
expect(result).toBeDefined();
expect(result.certificateAuthorities).toHaveLength(2);
expect(result.timestampAuthorities).toHaveLength(0);
expect(result.timestampAuthorities).toHaveLength(1);
expect(result.tlogs).toHaveLength(1);
expect(result.ctlogs).toHaveLength(2);

Expand Down
33 changes: 23 additions & 10 deletions packages/verify/src/bundle/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,32 +13,45 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
import { Bundle, TransparencyLogEntry } from '@sigstore/bundle';
import { X509Certificate } from '@sigstore/core';
import { Bundle } from '@sigstore/bundle';
import { RFC3161Timestamp, X509Certificate } from '@sigstore/core';
import { DSSESignatureContent } from './dsse';
import { MessageSignatureContent } from './message';

import type {
SignatureContent,
SignedEntity,
Timestamp,
VerificationKey,
} from '../shared.types';

export function toSignedEntity(
bundle: Bundle,
artifact?: Buffer
): SignedEntity {
const { tlogEntries, timestampVerificationData } =
bundle.verificationMaterial;
const timestamps: Timestamp[] = [];

for (const entry of tlogEntries) {
timestamps.push({
$case: 'transparency-log',
tlogEntry: entry,
});
}

for (const ts of timestampVerificationData?.rfc3161Timestamps ?? []) {
timestamps.push({
$case: 'timestamp-authority',
timestamp: RFC3161Timestamp.parse(ts.signedTimestamp),
});
}

return {
signature: signatureContent(bundle, artifact),
key: key(bundle),
tlogEntries: bundle.verificationMaterial.tlogEntries,
// TODO: Also include TSA timestamps
timestamps: bundle.verificationMaterial.tlogEntries.map(
(entry: TransparencyLogEntry) => ({
$case: 'transparency-log',
tlogEntry: entry,
})
),
tlogEntries,
timestamps,
};
}

Expand Down
5 changes: 1 addition & 4 deletions packages/verify/src/shared.types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/
import type { TransparencyLogEntry } from '@sigstore/bundle';
import type { X509Certificate, crypto } from '@sigstore/core';
import type { RFC3161Timestamp, X509Certificate, crypto } from '@sigstore/core';

export type CertificateExtensionName = 'issuer';
export type CertificateExtensions = {
Expand All @@ -33,9 +33,6 @@ export type Signer = {
identity?: CertificateIdentity;
};

// TODO: Implement this!
export type RFC3161Timestamp = object;

export type Timestamp =
| {
$case: 'timestamp-authority';
Expand Down
Loading