@countinghouse/ch-local 0.0.0-stage → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +202 -0
- package/README.md +361 -2
- package/bin/ch-local.js +472 -0
- package/clients/claude-code/.claude-plugin/plugin.json +6 -0
- package/clients/claude-code/.mcp.json +11 -0
- package/clients/claude-code/bin/launch.js +235 -0
- package/clients/claude-code/bin/win-acl.js +420 -0
- package/clients/claude-code/skills/ci-failure-triage/SKILL.md +21 -0
- package/clients/claude-code/skills/countinghouse-module/SKILL.md +177 -0
- package/clients/claude-code/skills/countinghouse-setup/SKILL.md +74 -0
- package/lib/allowlist.js +65 -0
- package/lib/aside.js +16 -0
- package/lib/atomic.js +45 -0
- package/lib/auto-apply.js +245 -0
- package/lib/auto-upgrade.js +98 -0
- package/lib/availability.js +307 -0
- package/lib/ceiling.js +280 -0
- package/lib/clean-text.js +20 -0
- package/lib/cli-change.js +38 -0
- package/lib/client-conditions-fixtures.js +143 -0
- package/lib/client-conditions.js +656 -0
- package/lib/clients.js +179 -0
- package/lib/command-line.js +202 -0
- package/lib/conditions-command.js +116 -0
- package/lib/control.js +134 -0
- package/lib/credential-store.js +414 -0
- package/lib/credentials-command.js +344 -0
- package/lib/daemon-requests.js +137 -0
- package/lib/daemon.js +888 -0
- package/lib/describe-module.js +137 -0
- package/lib/description-check.js +175 -0
- package/lib/failed-json.js +43 -0
- package/lib/gc.js +274 -0
- package/lib/github-token.js +57 -0
- package/lib/handoff-io.js +73 -0
- package/lib/held-back.js +116 -0
- package/lib/hidden-input.js +64 -0
- package/lib/history.js +49 -0
- package/lib/home.js +372 -0
- package/lib/in-place.js +1036 -0
- package/lib/install-plan.js +142 -0
- package/lib/install.js +846 -0
- package/lib/installed-description.js +153 -0
- package/lib/integrity.js +7 -0
- package/lib/lock.js +456 -0
- package/lib/lockfile-rules.js +98 -0
- package/lib/machine.js +20 -0
- package/lib/module-credentials.js +403 -0
- package/lib/module-record.js +298 -0
- package/lib/module-roles.js +44 -0
- package/lib/module-seams.js +26 -0
- package/lib/module-store.js +202 -0
- package/lib/module-values.js +334 -0
- package/lib/names.js +31 -0
- package/lib/next-steps.js +8 -0
- package/lib/node-check.js +56 -0
- package/lib/npm-fetch.js +123 -0
- package/lib/npm-release.js +99 -0
- package/lib/npm-upgrade.js +146 -0
- package/lib/npm.js +41 -0
- package/lib/outside-edits.js +162 -0
- package/lib/own-applied.js +175 -0
- package/lib/own-command.js +380 -0
- package/lib/own-file.js +120 -0
- package/lib/own-record.js +96 -0
- package/lib/own-tree.js +336 -0
- package/lib/pack-table.js +290 -0
- package/lib/packs-command.js +570 -0
- package/lib/packs.js +219 -0
- package/lib/pins.js +64 -0
- package/lib/pipe-probe.js +82 -0
- package/lib/plain-read.js +63 -0
- package/lib/private-file.js +90 -0
- package/lib/private-write.js +33 -0
- package/lib/provenance.js +234 -0
- package/lib/record.js +82 -0
- package/lib/registry.js +22 -0
- package/lib/release-pins.js +350 -0
- package/lib/release-pins.json +4225 -0
- package/lib/release-tags.js +12 -0
- package/lib/release.js +36 -0
- package/lib/restart-command.js +161 -0
- package/lib/rollback.js +227 -0
- package/lib/run-liveness.js +15 -0
- package/lib/runtime-log.js +287 -0
- package/lib/sandbox-support.js +17 -0
- package/lib/semver-order.js +40 -0
- package/lib/session-socket.js +69 -0
- package/lib/session-table.js +238 -0
- package/lib/session.js +281 -0
- package/lib/settings-command.js +82 -0
- package/lib/settings.js +564 -0
- package/lib/shim-binary.js +152 -0
- package/lib/shim-config.js +159 -0
- package/lib/shim-install.js +365 -0
- package/lib/sigstore/README.md +44 -0
- package/lib/sigstore/npm-keys.json +18 -0
- package/lib/sigstore/trusted-root.json +126 -0
- package/lib/snippets.js +76 -0
- package/lib/start.js +721 -0
- package/lib/store-files.js +48 -0
- package/lib/store-paths.js +33 -0
- package/lib/swap-preload.js +38 -0
- package/lib/tar.js +220 -0
- package/lib/uninstall.js +314 -0
- package/lib/unpack.js +41 -0
- package/lib/upgrade-stamp.js +63 -0
- package/lib/upgrade.js +281 -0
- package/lib/watch.js +40 -0
- package/lib/win-acl.js +420 -0
- package/node_modules/@sigstore/bundle/LICENSE +202 -0
- package/node_modules/@sigstore/bundle/README.md +19 -0
- package/node_modules/@sigstore/bundle/dist/build.d.ts +18 -0
- package/node_modules/@sigstore/bundle/dist/build.js +100 -0
- package/node_modules/@sigstore/bundle/dist/bundle.d.ts +74 -0
- package/node_modules/@sigstore/bundle/dist/bundle.js +24 -0
- package/node_modules/@sigstore/bundle/dist/error.d.ts +4 -0
- package/node_modules/@sigstore/bundle/dist/error.js +25 -0
- package/node_modules/@sigstore/bundle/dist/index.d.ts +8 -0
- package/node_modules/@sigstore/bundle/dist/index.js +43 -0
- package/node_modules/@sigstore/bundle/dist/serialized.d.ts +74 -0
- package/node_modules/@sigstore/bundle/dist/serialized.js +49 -0
- package/node_modules/@sigstore/bundle/dist/utility.d.ts +14 -0
- package/node_modules/@sigstore/bundle/dist/utility.js +2 -0
- package/node_modules/@sigstore/bundle/dist/validate.d.ts +7 -0
- package/node_modules/@sigstore/bundle/dist/validate.js +199 -0
- package/node_modules/@sigstore/bundle/package.json +35 -0
- package/node_modules/@sigstore/core/LICENSE +202 -0
- package/node_modules/@sigstore/core/README.md +10 -0
- package/node_modules/@sigstore/core/dist/asn1/error.d.ts +4 -0
- package/node_modules/@sigstore/core/dist/asn1/error.js +24 -0
- package/node_modules/@sigstore/core/dist/asn1/index.d.ts +1 -0
- package/node_modules/@sigstore/core/dist/asn1/index.js +20 -0
- package/node_modules/@sigstore/core/dist/asn1/length.d.ts +3 -0
- package/node_modules/@sigstore/core/dist/asn1/length.js +62 -0
- package/node_modules/@sigstore/core/dist/asn1/obj.d.ts +14 -0
- package/node_modules/@sigstore/core/dist/asn1/obj.js +155 -0
- package/node_modules/@sigstore/core/dist/asn1/parse.d.ts +6 -0
- package/node_modules/@sigstore/core/dist/asn1/parse.js +124 -0
- package/node_modules/@sigstore/core/dist/asn1/tag.d.ts +16 -0
- package/node_modules/@sigstore/core/dist/asn1/tag.js +89 -0
- package/node_modules/@sigstore/core/dist/crypto.d.ts +6 -0
- package/node_modules/@sigstore/core/dist/crypto.js +69 -0
- package/node_modules/@sigstore/core/dist/dsse.d.ts +1 -0
- package/node_modules/@sigstore/core/dist/dsse.js +29 -0
- package/node_modules/@sigstore/core/dist/encoding.d.ts +2 -0
- package/node_modules/@sigstore/core/dist/encoding.js +27 -0
- package/node_modules/@sigstore/core/dist/index.d.ts +9 -0
- package/node_modules/@sigstore/core/dist/index.js +66 -0
- package/node_modules/@sigstore/core/dist/json.d.ts +1 -0
- package/node_modules/@sigstore/core/dist/json.js +60 -0
- package/node_modules/@sigstore/core/dist/oid.d.ts +3 -0
- package/node_modules/@sigstore/core/dist/oid.js +20 -0
- package/node_modules/@sigstore/core/dist/pem.d.ts +2 -0
- package/node_modules/@sigstore/core/dist/pem.js +43 -0
- package/node_modules/@sigstore/core/dist/rfc3161/error.d.ts +2 -0
- package/node_modules/@sigstore/core/dist/rfc3161/error.js +21 -0
- package/node_modules/@sigstore/core/dist/rfc3161/index.d.ts +1 -0
- package/node_modules/@sigstore/core/dist/rfc3161/index.js +20 -0
- package/node_modules/@sigstore/core/dist/rfc3161/timestamp.d.ts +36 -0
- package/node_modules/@sigstore/core/dist/rfc3161/timestamp.js +212 -0
- package/node_modules/@sigstore/core/dist/rfc3161/tstinfo.d.ts +12 -0
- package/node_modules/@sigstore/core/dist/rfc3161/tstinfo.js +72 -0
- package/node_modules/@sigstore/core/dist/stream.d.ts +21 -0
- package/node_modules/@sigstore/core/dist/stream.js +117 -0
- package/node_modules/@sigstore/core/dist/x509/cert.d.ts +43 -0
- package/node_modules/@sigstore/core/dist/x509/cert.js +245 -0
- package/node_modules/@sigstore/core/dist/x509/ext.d.ts +41 -0
- package/node_modules/@sigstore/core/dist/x509/ext.js +146 -0
- package/node_modules/@sigstore/core/dist/x509/index.d.ts +2 -0
- package/node_modules/@sigstore/core/dist/x509/index.js +23 -0
- package/node_modules/@sigstore/core/dist/x509/sct.d.ts +25 -0
- package/node_modules/@sigstore/core/dist/x509/sct.js +158 -0
- package/node_modules/@sigstore/core/package.json +31 -0
- package/node_modules/@sigstore/protobuf-specs/LICENSE +202 -0
- package/node_modules/@sigstore/protobuf-specs/README.md +5 -0
- package/node_modules/@sigstore/protobuf-specs/dist/__generated__/envelope.d.ts +44 -0
- package/node_modules/@sigstore/protobuf-specs/dist/__generated__/envelope.js +59 -0
- package/node_modules/@sigstore/protobuf-specs/dist/__generated__/events.d.ts +64 -0
- package/node_modules/@sigstore/protobuf-specs/dist/__generated__/events.js +174 -0
- package/node_modules/@sigstore/protobuf-specs/dist/__generated__/google/api/field_behavior.d.ts +74 -0
- package/node_modules/@sigstore/protobuf-specs/dist/__generated__/google/api/field_behavior.js +141 -0
- package/node_modules/@sigstore/protobuf-specs/dist/__generated__/google/protobuf/any.d.ts +74 -0
- package/node_modules/@sigstore/protobuf-specs/dist/__generated__/google/protobuf/any.js +35 -0
- package/node_modules/@sigstore/protobuf-specs/dist/__generated__/google/protobuf/descriptor.d.ts +1309 -0
- package/node_modules/@sigstore/protobuf-specs/dist/__generated__/google/protobuf/descriptor.js +2191 -0
- package/node_modules/@sigstore/protobuf-specs/dist/__generated__/google/protobuf/timestamp.d.ts +113 -0
- package/node_modules/@sigstore/protobuf-specs/dist/__generated__/google/protobuf/timestamp.js +29 -0
- package/node_modules/@sigstore/protobuf-specs/dist/__generated__/rekor/v2/dsse.d.ts +23 -0
- package/node_modules/@sigstore/protobuf-specs/dist/__generated__/rekor/v2/dsse.js +55 -0
- package/node_modules/@sigstore/protobuf-specs/dist/__generated__/rekor/v2/entry.d.ts +43 -0
- package/node_modules/@sigstore/protobuf-specs/dist/__generated__/rekor/v2/entry.js +81 -0
- package/node_modules/@sigstore/protobuf-specs/dist/__generated__/rekor/v2/hashedrekord.d.ts +22 -0
- package/node_modules/@sigstore/protobuf-specs/dist/__generated__/rekor/v2/hashedrekord.js +56 -0
- package/node_modules/@sigstore/protobuf-specs/dist/__generated__/rekor/v2/verifier.d.ts +35 -0
- package/node_modules/@sigstore/protobuf-specs/dist/__generated__/rekor/v2/verifier.js +74 -0
- package/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_bundle.d.ts +146 -0
- package/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_bundle.js +103 -0
- package/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_common.d.ts +304 -0
- package/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_common.js +612 -0
- package/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_monitor.d.ts +33 -0
- package/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_monitor.js +55 -0
- package/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_rekor.d.ts +144 -0
- package/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_rekor.js +137 -0
- package/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_trustroot.d.ts +386 -0
- package/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_trustroot.js +284 -0
- package/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_verification.d.ts +191 -0
- package/node_modules/@sigstore/protobuf-specs/dist/__generated__/sigstore_verification.js +281 -0
- package/node_modules/@sigstore/protobuf-specs/dist/index.d.ts +6 -0
- package/node_modules/@sigstore/protobuf-specs/dist/index.js +37 -0
- package/node_modules/@sigstore/protobuf-specs/dist/rekor/v2/index.d.ts +4 -0
- package/node_modules/@sigstore/protobuf-specs/dist/rekor/v2/index.js +35 -0
- package/node_modules/@sigstore/protobuf-specs/package.json +35 -0
- package/node_modules/@sigstore/verify/README.md +9 -0
- package/node_modules/@sigstore/verify/dist/bundle/dsse.d.ts +12 -0
- package/node_modules/@sigstore/verify/dist/bundle/dsse.js +44 -0
- package/node_modules/@sigstore/verify/dist/bundle/index.d.ts +4 -0
- package/node_modules/@sigstore/verify/dist/bundle/index.js +59 -0
- package/node_modules/@sigstore/verify/dist/bundle/message.d.ts +13 -0
- package/node_modules/@sigstore/verify/dist/bundle/message.js +54 -0
- package/node_modules/@sigstore/verify/dist/error.d.ts +16 -0
- package/node_modules/@sigstore/verify/dist/error.js +34 -0
- package/node_modules/@sigstore/verify/dist/index.d.ts +6 -0
- package/node_modules/@sigstore/verify/dist/index.js +28 -0
- package/node_modules/@sigstore/verify/dist/key/certificate.d.ts +21 -0
- package/node_modules/@sigstore/verify/dist/key/certificate.js +216 -0
- package/node_modules/@sigstore/verify/dist/key/index.d.ts +10 -0
- package/node_modules/@sigstore/verify/dist/key/index.js +75 -0
- package/node_modules/@sigstore/verify/dist/key/sct.d.ts +4 -0
- package/node_modules/@sigstore/verify/dist/key/sct.js +78 -0
- package/node_modules/@sigstore/verify/dist/policy.d.ts +5 -0
- package/node_modules/@sigstore/verify/dist/policy.js +50 -0
- package/node_modules/@sigstore/verify/dist/shared.types.d.ts +50 -0
- package/node_modules/@sigstore/verify/dist/shared.types.js +2 -0
- package/node_modules/@sigstore/verify/dist/timestamp/index.d.ts +11 -0
- package/node_modules/@sigstore/verify/dist/timestamp/index.js +24 -0
- package/node_modules/@sigstore/verify/dist/timestamp/tsa.d.ts +3 -0
- package/node_modules/@sigstore/verify/dist/timestamp/tsa.js +63 -0
- package/node_modules/@sigstore/verify/dist/tlog/checkpoint.d.ts +11 -0
- package/node_modules/@sigstore/verify/dist/tlog/checkpoint.js +154 -0
- package/node_modules/@sigstore/verify/dist/tlog/dsse.d.ts +6 -0
- package/node_modules/@sigstore/verify/dist/tlog/dsse.js +106 -0
- package/node_modules/@sigstore/verify/dist/tlog/hashedrekord.d.ts +6 -0
- package/node_modules/@sigstore/verify/dist/tlog/hashedrekord.js +94 -0
- package/node_modules/@sigstore/verify/dist/tlog/index.d.ts +5 -0
- package/node_modules/@sigstore/verify/dist/tlog/index.js +92 -0
- package/node_modules/@sigstore/verify/dist/tlog/intoto.d.ts +3 -0
- package/node_modules/@sigstore/verify/dist/tlog/intoto.js +62 -0
- package/node_modules/@sigstore/verify/dist/tlog/merkle.d.ts +3 -0
- package/node_modules/@sigstore/verify/dist/tlog/merkle.js +104 -0
- package/node_modules/@sigstore/verify/dist/tlog/set.d.ts +3 -0
- package/node_modules/@sigstore/verify/dist/tlog/set.js +60 -0
- package/node_modules/@sigstore/verify/dist/trust/filter.d.ts +8 -0
- package/node_modules/@sigstore/verify/dist/trust/filter.js +23 -0
- package/node_modules/@sigstore/verify/dist/trust/index.d.ts +5 -0
- package/node_modules/@sigstore/verify/dist/trust/index.js +90 -0
- package/node_modules/@sigstore/verify/dist/trust/trust.types.d.ts +29 -0
- package/node_modules/@sigstore/verify/dist/trust/trust.types.js +2 -0
- package/node_modules/@sigstore/verify/dist/verifier.d.ts +31 -0
- package/node_modules/@sigstore/verify/dist/verifier.js +160 -0
- package/node_modules/@sigstore/verify/package.json +36 -0
- package/package.json +37 -4
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.verifyTLogSET = verifyTLogSET;
|
|
4
|
+
/*
|
|
5
|
+
Copyright 2023 The Sigstore Authors.
|
|
6
|
+
|
|
7
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
you may not use this file except in compliance with the License.
|
|
9
|
+
You may obtain a copy of the License at
|
|
10
|
+
|
|
11
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
|
|
13
|
+
Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
See the License for the specific language governing permissions and
|
|
17
|
+
limitations under the License.
|
|
18
|
+
*/
|
|
19
|
+
const core_1 = require("@sigstore/core");
|
|
20
|
+
const error_1 = require("../error");
|
|
21
|
+
const trust_1 = require("../trust");
|
|
22
|
+
// Verifies the SET for the given entry against the list of trusted
|
|
23
|
+
// transparency logs. Returns true if the SET can be verified against at least
|
|
24
|
+
// one of the trusted logs; otherwise, returns false.
|
|
25
|
+
function verifyTLogSET(entry, tlogs) {
|
|
26
|
+
// Filter the list of tlog instances to only those which might be able to
|
|
27
|
+
// verify the SET
|
|
28
|
+
const validTLogs = (0, trust_1.filterTLogAuthorities)(tlogs, {
|
|
29
|
+
logID: entry.logId.keyId,
|
|
30
|
+
targetDate: new Date(Number(entry.integratedTime) * 1000),
|
|
31
|
+
});
|
|
32
|
+
// Check to see if we can verify the SET against any of the valid tlogs
|
|
33
|
+
const verified = validTLogs.some((tlog) => {
|
|
34
|
+
// Re-create the original Rekor verification payload
|
|
35
|
+
const payload = toVerificationPayload(entry);
|
|
36
|
+
// Canonicalize the payload and turn into a buffer for verification
|
|
37
|
+
const data = Buffer.from(core_1.json.canonicalize(payload), 'utf8');
|
|
38
|
+
// Extract the SET from the tlog entry
|
|
39
|
+
const signature = entry.inclusionPromise.signedEntryTimestamp;
|
|
40
|
+
return core_1.crypto.verify(data, tlog.publicKey, signature);
|
|
41
|
+
});
|
|
42
|
+
if (!verified) {
|
|
43
|
+
throw new error_1.VerificationError({
|
|
44
|
+
code: 'TLOG_INCLUSION_PROMISE_ERROR',
|
|
45
|
+
message: 'inclusion promise could not be verified',
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
// Returns a properly formatted "VerificationPayload" for one of the
|
|
50
|
+
// transaction log entires in the given bundle which can be used for SET
|
|
51
|
+
// verification.
|
|
52
|
+
function toVerificationPayload(entry) {
|
|
53
|
+
const { integratedTime, logIndex, logId, canonicalizedBody } = entry;
|
|
54
|
+
return {
|
|
55
|
+
body: canonicalizedBody.toString('base64'),
|
|
56
|
+
integratedTime: Number(integratedTime),
|
|
57
|
+
logIndex: Number(logIndex),
|
|
58
|
+
logID: logId.keyId.toString('hex'),
|
|
59
|
+
};
|
|
60
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CertAuthority, TLogAuthority } from './trust.types';
|
|
2
|
+
export declare function filterCertAuthorities(certAuthorities: CertAuthority[], timestamp: Date): CertAuthority[];
|
|
3
|
+
type TLogAuthorityFilterCriteria = {
|
|
4
|
+
targetDate: Date;
|
|
5
|
+
logID?: Buffer;
|
|
6
|
+
};
|
|
7
|
+
export declare function filterTLogAuthorities(tlogAuthorities: TLogAuthority[], criteria: TLogAuthorityFilterCriteria): TLogAuthority[];
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.filterCertAuthorities = filterCertAuthorities;
|
|
4
|
+
exports.filterTLogAuthorities = filterTLogAuthorities;
|
|
5
|
+
function filterCertAuthorities(certAuthorities, timestamp) {
|
|
6
|
+
return certAuthorities.filter((ca) => {
|
|
7
|
+
return ca.validFor.start <= timestamp && ca.validFor.end >= timestamp;
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
// Filter the list of tlog instances to only those which match the given log
|
|
11
|
+
// ID and have public keys which are valid for the given integrated time.
|
|
12
|
+
function filterTLogAuthorities(tlogAuthorities, criteria) {
|
|
13
|
+
return tlogAuthorities.filter((tlog) => {
|
|
14
|
+
// If we're filtering by log ID and the log IDs don't match, we can't use
|
|
15
|
+
// this tlog
|
|
16
|
+
if (criteria.logID && !tlog.logID.equals(criteria.logID)) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
// Check that the integrated time is within the validFor range
|
|
20
|
+
return (tlog.validFor.start <= criteria.targetDate &&
|
|
21
|
+
criteria.targetDate <= tlog.validFor.end);
|
|
22
|
+
});
|
|
23
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type PublicKey, type TrustedRoot } from '@sigstore/protobuf-specs';
|
|
2
|
+
import type { KeyFinderFunc, TrustMaterial } from './trust.types';
|
|
3
|
+
export { filterCertAuthorities, filterTLogAuthorities } from './filter';
|
|
4
|
+
export type { CertAuthority, KeyFinderFunc, TLogAuthority, TrustMaterial, } from './trust.types';
|
|
5
|
+
export declare function toTrustMaterial(root: TrustedRoot, keys?: Record<string, PublicKey> | KeyFinderFunc): TrustMaterial;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.filterTLogAuthorities = exports.filterCertAuthorities = void 0;
|
|
4
|
+
exports.toTrustMaterial = toTrustMaterial;
|
|
5
|
+
/*
|
|
6
|
+
Copyright 2023 The Sigstore Authors.
|
|
7
|
+
|
|
8
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
9
|
+
you may not use this file except in compliance with the License.
|
|
10
|
+
You may obtain a copy of the License at
|
|
11
|
+
|
|
12
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
13
|
+
|
|
14
|
+
Unless required by applicable law or agreed to in writing, software
|
|
15
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
16
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17
|
+
See the License for the specific language governing permissions and
|
|
18
|
+
limitations under the License.
|
|
19
|
+
*/
|
|
20
|
+
const core_1 = require("@sigstore/core");
|
|
21
|
+
const protobuf_specs_1 = require("@sigstore/protobuf-specs");
|
|
22
|
+
const error_1 = require("../error");
|
|
23
|
+
const BEGINNING_OF_TIME = new Date(0);
|
|
24
|
+
const END_OF_TIME = new Date(8640000000000000);
|
|
25
|
+
var filter_1 = require("./filter");
|
|
26
|
+
Object.defineProperty(exports, "filterCertAuthorities", { enumerable: true, get: function () { return filter_1.filterCertAuthorities; } });
|
|
27
|
+
Object.defineProperty(exports, "filterTLogAuthorities", { enumerable: true, get: function () { return filter_1.filterTLogAuthorities; } });
|
|
28
|
+
function toTrustMaterial(root, keys) {
|
|
29
|
+
const keyFinder = typeof keys === 'function' ? keys : keyLocator(keys);
|
|
30
|
+
return {
|
|
31
|
+
certificateAuthorities: root.certificateAuthorities.map(createCertAuthority),
|
|
32
|
+
timestampAuthorities: root.timestampAuthorities.map(createCertAuthority),
|
|
33
|
+
tlogs: root.tlogs.map(createTLogAuthority),
|
|
34
|
+
ctlogs: root.ctlogs.map(createTLogAuthority),
|
|
35
|
+
publicKey: keyFinder,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
function createTLogAuthority(tlogInstance) {
|
|
39
|
+
const keyDetails = tlogInstance.publicKey.keyDetails;
|
|
40
|
+
const keyType = keyDetails === protobuf_specs_1.PublicKeyDetails.PKCS1_RSA_PKCS1V5 ||
|
|
41
|
+
keyDetails === protobuf_specs_1.PublicKeyDetails.PKIX_RSA_PKCS1V5 ||
|
|
42
|
+
keyDetails === protobuf_specs_1.PublicKeyDetails.PKIX_RSA_PKCS1V15_2048_SHA256 ||
|
|
43
|
+
keyDetails === protobuf_specs_1.PublicKeyDetails.PKIX_RSA_PKCS1V15_3072_SHA256 ||
|
|
44
|
+
keyDetails === protobuf_specs_1.PublicKeyDetails.PKIX_RSA_PKCS1V15_4096_SHA256
|
|
45
|
+
? 'pkcs1'
|
|
46
|
+
: 'spki';
|
|
47
|
+
/* istanbul ignore next */
|
|
48
|
+
return {
|
|
49
|
+
baseURL: tlogInstance.baseUrl,
|
|
50
|
+
logID: tlogInstance.checkpointKeyId
|
|
51
|
+
? tlogInstance.checkpointKeyId.keyId
|
|
52
|
+
: tlogInstance.logId.keyId,
|
|
53
|
+
publicKey: core_1.crypto.createPublicKey(tlogInstance.publicKey.rawBytes, keyType),
|
|
54
|
+
validFor: {
|
|
55
|
+
start: tlogInstance.publicKey.validFor?.start || BEGINNING_OF_TIME,
|
|
56
|
+
end: tlogInstance.publicKey.validFor?.end || END_OF_TIME,
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
function createCertAuthority(ca) {
|
|
61
|
+
/* istanbul ignore next */
|
|
62
|
+
return {
|
|
63
|
+
certChain: ca.certChain.certificates.map((cert) => {
|
|
64
|
+
return core_1.X509Certificate.parse(Buffer.from(cert.rawBytes));
|
|
65
|
+
}),
|
|
66
|
+
validFor: {
|
|
67
|
+
start: ca.validFor?.start || BEGINNING_OF_TIME,
|
|
68
|
+
end: ca.validFor?.end || END_OF_TIME,
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
function keyLocator(keys) {
|
|
73
|
+
return (hint) => {
|
|
74
|
+
const key = (keys || {})[hint];
|
|
75
|
+
if (!key) {
|
|
76
|
+
throw new error_1.VerificationError({
|
|
77
|
+
code: 'PUBLIC_KEY_ERROR',
|
|
78
|
+
message: `key not found: ${hint}`,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
return {
|
|
82
|
+
publicKey: core_1.crypto.createPublicKey(key.rawBytes),
|
|
83
|
+
validFor: (date) => {
|
|
84
|
+
/* istanbul ignore next */
|
|
85
|
+
return ((key.validFor?.start || BEGINNING_OF_TIME) <= date &&
|
|
86
|
+
(key.validFor?.end || END_OF_TIME) >= date);
|
|
87
|
+
},
|
|
88
|
+
};
|
|
89
|
+
};
|
|
90
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { X509Certificate, crypto } from '@sigstore/core';
|
|
2
|
+
export type TLogAuthority = {
|
|
3
|
+
logID: Buffer;
|
|
4
|
+
baseURL: string;
|
|
5
|
+
publicKey: crypto.KeyObject;
|
|
6
|
+
validFor: {
|
|
7
|
+
start: Date;
|
|
8
|
+
end: Date;
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export type CertAuthority = {
|
|
12
|
+
certChain: X509Certificate[];
|
|
13
|
+
validFor: {
|
|
14
|
+
start: Date;
|
|
15
|
+
end: Date;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
export type TimeConstrainedKey = {
|
|
19
|
+
publicKey: crypto.KeyObject;
|
|
20
|
+
validFor(date: Date): boolean;
|
|
21
|
+
};
|
|
22
|
+
export type KeyFinderFunc = (hint: string) => TimeConstrainedKey;
|
|
23
|
+
export type TrustMaterial = {
|
|
24
|
+
certificateAuthorities: CertAuthority[];
|
|
25
|
+
timestampAuthorities: CertAuthority[];
|
|
26
|
+
tlogs: TLogAuthority[];
|
|
27
|
+
ctlogs: TLogAuthority[];
|
|
28
|
+
publicKey: KeyFinderFunc;
|
|
29
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { SignedEntity, Signer, VerificationPolicy } from './shared.types';
|
|
2
|
+
import type { TrustMaterial } from './trust';
|
|
3
|
+
/**
|
|
4
|
+
* Configuration options for the verifier.
|
|
5
|
+
*
|
|
6
|
+
* @public
|
|
7
|
+
*/
|
|
8
|
+
export interface VerifierOptions {
|
|
9
|
+
/** Minimum number of transparency log entries required for verification */
|
|
10
|
+
tlogThreshold?: number;
|
|
11
|
+
/** Minimum number of certificate transparency log entries required */
|
|
12
|
+
ctlogThreshold?: number;
|
|
13
|
+
/**
|
|
14
|
+
* Minimum number of timestamp authority timestamps required for verification
|
|
15
|
+
* @deprecated Use timestampThreshold instead
|
|
16
|
+
*/
|
|
17
|
+
tsaThreshold?: number;
|
|
18
|
+
/** Minimum number of timestamps required for verification */
|
|
19
|
+
timestampThreshold?: number;
|
|
20
|
+
}
|
|
21
|
+
export declare class Verifier {
|
|
22
|
+
private trustMaterial;
|
|
23
|
+
private options;
|
|
24
|
+
constructor(trustMaterial: TrustMaterial, options?: VerifierOptions);
|
|
25
|
+
verify(entity: SignedEntity, policy?: VerificationPolicy): Signer;
|
|
26
|
+
private verifyTimestamps;
|
|
27
|
+
private verifySigningKey;
|
|
28
|
+
private verifyTLogs;
|
|
29
|
+
private verifySignature;
|
|
30
|
+
private verifyPolicy;
|
|
31
|
+
}
|
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Verifier = void 0;
|
|
4
|
+
/*
|
|
5
|
+
Copyright 2023 The Sigstore Authors.
|
|
6
|
+
|
|
7
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
you may not use this file except in compliance with the License.
|
|
9
|
+
You may obtain a copy of the License at
|
|
10
|
+
|
|
11
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
|
|
13
|
+
Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
See the License for the specific language governing permissions and
|
|
17
|
+
limitations under the License.
|
|
18
|
+
*/
|
|
19
|
+
const util_1 = require("util");
|
|
20
|
+
const error_1 = require("./error");
|
|
21
|
+
const key_1 = require("./key");
|
|
22
|
+
const policy_1 = require("./policy");
|
|
23
|
+
const timestamp_1 = require("./timestamp");
|
|
24
|
+
const tlog_1 = require("./tlog");
|
|
25
|
+
class Verifier {
|
|
26
|
+
trustMaterial;
|
|
27
|
+
options;
|
|
28
|
+
constructor(trustMaterial, options = {}) {
|
|
29
|
+
this.trustMaterial = trustMaterial;
|
|
30
|
+
this.options = {
|
|
31
|
+
ctlogThreshold: options.ctlogThreshold ?? 1,
|
|
32
|
+
tlogThreshold: options.tlogThreshold ?? 1,
|
|
33
|
+
timestampThreshold: options.timestampThreshold ?? options.tsaThreshold ?? 1,
|
|
34
|
+
tsaThreshold: 0,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
verify(entity, policy) {
|
|
38
|
+
const timestamps = this.verifyTimestamps(entity);
|
|
39
|
+
const signer = this.verifySigningKey(entity, timestamps);
|
|
40
|
+
this.verifyTLogs(entity);
|
|
41
|
+
this.verifySignature(entity, signer);
|
|
42
|
+
if (policy) {
|
|
43
|
+
this.verifyPolicy(policy, signer.identity || {});
|
|
44
|
+
}
|
|
45
|
+
return signer;
|
|
46
|
+
}
|
|
47
|
+
// Checks that all of the timestamps in the entity are valid and returns them
|
|
48
|
+
verifyTimestamps(entity) {
|
|
49
|
+
const timestamps = [];
|
|
50
|
+
for (const timestamp of entity.timestamps) {
|
|
51
|
+
switch (timestamp.$case) {
|
|
52
|
+
case 'timestamp-authority':
|
|
53
|
+
timestamps.push((0, timestamp_1.getTSATimestamp)(timestamp.timestamp, entity.signature.signature, this.trustMaterial.timestampAuthorities));
|
|
54
|
+
break;
|
|
55
|
+
case 'transparency-log': {
|
|
56
|
+
const result = (0, timestamp_1.getTLogTimestamp)(timestamp.tlogEntry);
|
|
57
|
+
/* istanbul ignore else */
|
|
58
|
+
if (result) {
|
|
59
|
+
timestamps.push(result);
|
|
60
|
+
}
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
// Check for duplicate timestamps
|
|
66
|
+
if (containsDupes(timestamps)) {
|
|
67
|
+
throw new error_1.VerificationError({
|
|
68
|
+
code: 'TIMESTAMP_ERROR',
|
|
69
|
+
message: 'duplicate timestamp',
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
if (timestamps.length < this.options.timestampThreshold) {
|
|
73
|
+
throw new error_1.VerificationError({
|
|
74
|
+
code: 'TIMESTAMP_ERROR',
|
|
75
|
+
message: `expected ${this.options.timestampThreshold} timestamps, got ${timestamps.length}`,
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
return timestamps.map((t) => t.timestamp);
|
|
79
|
+
}
|
|
80
|
+
// Checks that the signing key is valid for all of the the supplied timestamps
|
|
81
|
+
// and returns the signer.
|
|
82
|
+
verifySigningKey({ key }, timestamps) {
|
|
83
|
+
switch (key.$case) {
|
|
84
|
+
case 'public-key': {
|
|
85
|
+
return (0, key_1.verifyPublicKey)(key.hint, timestamps, this.trustMaterial);
|
|
86
|
+
}
|
|
87
|
+
case 'certificate': {
|
|
88
|
+
const result = (0, key_1.verifyCertificate)(key.certificate, timestamps, this.trustMaterial);
|
|
89
|
+
/* istanbul ignore next - no fixture */
|
|
90
|
+
if (containsDupes(result.scts)) {
|
|
91
|
+
throw new error_1.VerificationError({
|
|
92
|
+
code: 'CERTIFICATE_ERROR',
|
|
93
|
+
message: 'duplicate SCT',
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
if (result.scts.length < this.options.ctlogThreshold) {
|
|
97
|
+
throw new error_1.VerificationError({
|
|
98
|
+
code: 'CERTIFICATE_ERROR',
|
|
99
|
+
message: `expected ${this.options.ctlogThreshold} SCTs, got ${result.scts.length}`,
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
return result.signer;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
// Checks that the tlog entries are valid for the supplied content
|
|
107
|
+
verifyTLogs({ signature: content, tlogEntries }) {
|
|
108
|
+
let tlogCount = 0;
|
|
109
|
+
tlogEntries.forEach((entry) => {
|
|
110
|
+
tlogCount++;
|
|
111
|
+
(0, tlog_1.verifyTLogInclusion)(entry, this.trustMaterial.tlogs);
|
|
112
|
+
(0, tlog_1.verifyTLogBody)(entry, content);
|
|
113
|
+
});
|
|
114
|
+
if (tlogCount < this.options.tlogThreshold) {
|
|
115
|
+
throw new error_1.VerificationError({
|
|
116
|
+
code: 'TLOG_ERROR',
|
|
117
|
+
message: `expected ${this.options.tlogThreshold} tlog entries, got ${tlogCount}`,
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
// Checks that the signature is valid for the supplied content
|
|
122
|
+
verifySignature(entity, signer) {
|
|
123
|
+
if (!entity.signature.verifySignature(signer.key)) {
|
|
124
|
+
throw new error_1.VerificationError({
|
|
125
|
+
code: 'SIGNATURE_ERROR',
|
|
126
|
+
message: 'signature verification failed',
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
verifyPolicy(policy, identity) {
|
|
131
|
+
// Check the subject alternative name of the signer matches the policy
|
|
132
|
+
/* istanbul ignore else */
|
|
133
|
+
if (policy.subjectAlternativeName) {
|
|
134
|
+
(0, policy_1.verifySubjectAlternativeName)(policy.subjectAlternativeName, identity.subjectAlternativeName);
|
|
135
|
+
}
|
|
136
|
+
// Check that the extensions of the signer match the policy
|
|
137
|
+
/* istanbul ignore else */
|
|
138
|
+
if (policy.extensions) {
|
|
139
|
+
(0, policy_1.verifyExtensions)(policy.extensions, identity.extensions);
|
|
140
|
+
}
|
|
141
|
+
// Check that the OIDs of the signer match the policy
|
|
142
|
+
/* istanbul ignore if */
|
|
143
|
+
if (policy.oids) {
|
|
144
|
+
(0, policy_1.verifyOIDs)(policy.oids, identity.oids);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
exports.Verifier = Verifier;
|
|
149
|
+
// Checks for duplicate items in the array. Objects are compared using
|
|
150
|
+
// deep equality.
|
|
151
|
+
function containsDupes(arr) {
|
|
152
|
+
for (let i = 0; i < arr.length; i++) {
|
|
153
|
+
for (let j = i + 1; j < arr.length; j++) {
|
|
154
|
+
if ((0, util_1.isDeepStrictEqual)(arr[i], arr[j])) {
|
|
155
|
+
return true;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
return false;
|
|
160
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@sigstore/verify",
|
|
3
|
+
"version": "3.1.1",
|
|
4
|
+
"description": "Verification of Sigstore signatures",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"clean": "shx rm -rf dist *.tsbuildinfo",
|
|
9
|
+
"build": "tsc --build",
|
|
10
|
+
"test": "jest"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"dist"
|
|
14
|
+
],
|
|
15
|
+
"author": "bdehamer@github.com",
|
|
16
|
+
"license": "Apache-2.0",
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/sigstore/sigstore-js.git"
|
|
20
|
+
},
|
|
21
|
+
"bugs": {
|
|
22
|
+
"url": "https://github.com/sigstore/sigstore-js/issues"
|
|
23
|
+
},
|
|
24
|
+
"homepage": "https://github.com/sigstore/sigstore-js/tree/main/packages/verify#readme",
|
|
25
|
+
"publishConfig": {
|
|
26
|
+
"provenance": true
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"@sigstore/protobuf-specs": "^0.5.0",
|
|
30
|
+
"@sigstore/bundle": "^4.0.0",
|
|
31
|
+
"@sigstore/core": "^3.2.1"
|
|
32
|
+
},
|
|
33
|
+
"engines": {
|
|
34
|
+
"node": "^20.17.0 || >=22.9.0"
|
|
35
|
+
}
|
|
36
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,39 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@countinghouse/ch-local",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "The countinghouse client-pack launcher: installs pinned packs into ~/.countinghouse, starts the runtime over stdio for Claude Code, Cursor, VS Code and Codex, prints each client's config entry, upgrades on request and never silently.",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/mchen6/ch-local.git"
|
|
9
|
+
},
|
|
10
|
+
"publishConfig": {
|
|
11
|
+
"access": "public"
|
|
12
|
+
},
|
|
13
|
+
"engines": {
|
|
14
|
+
"node": ">=22.16"
|
|
15
|
+
},
|
|
16
|
+
"bin": {
|
|
17
|
+
"ch-local": "bin/ch-local.js"
|
|
18
|
+
},
|
|
19
|
+
"files": [
|
|
20
|
+
"bin/",
|
|
21
|
+
"lib/",
|
|
22
|
+
"clients/"
|
|
23
|
+
],
|
|
24
|
+
"scripts": {
|
|
25
|
+
"test": "node scripts/test.js"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@sigstore/bundle": "4.0.0",
|
|
29
|
+
"@sigstore/core": "3.2.1",
|
|
30
|
+
"@sigstore/protobuf-specs": "0.5.2",
|
|
31
|
+
"@sigstore/verify": "3.1.1"
|
|
32
|
+
},
|
|
33
|
+
"bundleDependencies": [
|
|
34
|
+
"@sigstore/bundle",
|
|
35
|
+
"@sigstore/core",
|
|
36
|
+
"@sigstore/protobuf-specs",
|
|
37
|
+
"@sigstore/verify"
|
|
38
|
+
]
|
|
39
|
+
}
|