@muggleai/works 5.34.0-staging.308 → 5.34.0-staging.310

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.
Files changed (47) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/dist/{chunk-C4L5SKOX.js → chunk-SMUHQITB.js} +27 -14
  3. package/dist/{chunk-L4ZDHFEJ.js → chunk-TVA5J73U.js} +294 -73
  4. package/dist/cli.js +2 -2
  5. package/dist/index.js +2 -2
  6. package/dist/plugin/.claude-plugin/plugin.json +1 -1
  7. package/dist/plugin/.codex-mcp.json +1 -1
  8. package/dist/plugin/.codex-plugin/plugin.json +1 -1
  9. package/dist/plugin/.cursor-plugin/plugin.json +1 -1
  10. package/dist/plugin/.mcp.json +1 -1
  11. package/dist/plugin/skills/_shared/dev-loop/fresh-session.md +1 -1
  12. package/dist/plugin/skills/_shared/dev-loop/run.md +2 -1
  13. package/dist/plugin/skills/_shared/test-case-design.md +8 -0
  14. package/dist/plugin/skills/do/e2e-acceptance.md +1 -1
  15. package/dist/plugin/skills/muggle-browser-task/SKILL.md +3 -0
  16. package/dist/plugin/skills/muggle-test/SKILL.md +1 -1
  17. package/dist/plugin/skills/muggle-test/execute-remote.md +1 -1
  18. package/dist/plugin/skills/muggle-test-feature-local/SKILL.md +1 -0
  19. package/dist/plugin/skills/muggle-test-import/SKILL.md +2 -0
  20. package/dist/plugin/skills/muggle-test-regenerate-missing/SKILL.md +1 -1
  21. package/dist/release-manifest.json +4 -4
  22. package/dist/{src-Z5YREWY6.js → src-5M2MYBRC.js} +1 -1
  23. package/package.json +1 -1
  24. package/plugin/.claude-plugin/plugin.json +1 -1
  25. package/plugin/.codex-mcp.json +1 -1
  26. package/plugin/.codex-plugin/plugin.json +1 -1
  27. package/plugin/.cursor-plugin/plugin.json +1 -1
  28. package/plugin/.mcp.json +1 -1
  29. package/plugin/skills/_shared/dev-loop/fresh-session.md +1 -1
  30. package/plugin/skills/_shared/dev-loop/run.md +2 -1
  31. package/plugin/skills/_shared/test-case-design.md +8 -0
  32. package/plugin/skills/do/e2e-acceptance.md +1 -1
  33. package/plugin/skills/muggle-browser-task/SKILL.md +3 -0
  34. package/plugin/skills/muggle-test/SKILL.md +1 -1
  35. package/plugin/skills/muggle-test/execute-remote.md +1 -1
  36. package/plugin/skills/muggle-test-feature-local/SKILL.md +1 -0
  37. package/plugin/skills/muggle-test-import/SKILL.md +2 -0
  38. package/plugin/skills/muggle-test-regenerate-missing/SKILL.md +1 -1
  39. package/scripts/postinstall.mjs +12 -13
  40. package/scripts/release-integrity/classifyTrustRootFailure.mjs +67 -0
  41. package/scripts/release-integrity/constants.mjs +55 -0
  42. package/scripts/release-integrity/enforceReleaseSignature.mjs +62 -0
  43. package/scripts/release-integrity/findBundleMismatch.mjs +58 -0
  44. package/scripts/release-integrity/index.d.mts +10 -1
  45. package/scripts/release-integrity/index.mjs +1 -0
  46. package/scripts/release-integrity/resolveIntegrityPolicy.mjs +11 -2
  47. package/scripts/release-integrity/verifyReleaseSignature.mjs +60 -8
@@ -4,6 +4,15 @@ export declare const SIGNER_CERTIFICATE_ISSUER: string;
4
4
 
5
5
  export declare function compareVersions(a: string, b: string): number;
6
6
 
7
+ export declare function enforceReleaseSignature(params: {
8
+ artifactPath: string;
9
+ bundleUrl: string;
10
+ signerIdentityUri: string;
11
+ expectedChecksum: string;
12
+ logInfo: (message: string) => void;
13
+ logWarning: (message: string) => void;
14
+ }): Promise<{ isSignatureVerified: boolean }>;
15
+
7
16
  export declare function resolveIntegrityPolicy(params: {
8
17
  version: string;
9
18
  signedFromVersion: string;
@@ -18,4 +27,4 @@ export declare function verifyReleaseSignature(params: {
18
27
  artifactPath: string;
19
28
  bundleUrl: string;
20
29
  signerIdentityUri: string;
21
- }): Promise<{ valid: boolean; reason: string }>;
30
+ }): Promise<{ valid: boolean; reason: string; isTrustRootUnreachable: boolean }>;
@@ -1,4 +1,5 @@
1
1
  export { SIGNATURE_BUNDLE_SUFFIX, SIGNATURE_FETCH_TIMEOUT_MS, SIGNER_CERTIFICATE_ISSUER } from "./constants.mjs";
2
2
  export { compareVersions } from "./compareVersions.mjs";
3
+ export { enforceReleaseSignature } from "./enforceReleaseSignature.mjs";
3
4
  export { resolveIntegrityPolicy } from "./resolveIntegrityPolicy.mjs";
4
5
  export { verifyReleaseSignature } from "./verifyReleaseSignature.mjs";
@@ -1,5 +1,15 @@
1
1
  import { compareVersions } from "./compareVersions.mjs";
2
2
 
3
+ /**
4
+ * Tell whether a checksum was actually configured.
5
+ *
6
+ * @param {string} expectedChecksum - Configured SHA256, empty when none.
7
+ * @returns {boolean} False for an empty or whitespace-only value.
8
+ */
9
+ export function hasExpectedChecksum(expectedChecksum) {
10
+ return Boolean(expectedChecksum && expectedChecksum.trim());
11
+ }
12
+
3
13
  /**
4
14
  * Decide which integrity evidence a download must produce before it is trusted.
5
15
  *
@@ -16,9 +26,8 @@ import { compareVersions } from "./compareVersions.mjs";
16
26
  */
17
27
  export function resolveIntegrityPolicy({ version, signedFromVersion, expectedChecksum }) {
18
28
  const requiresSignature = Boolean(signedFromVersion) && compareVersions(version, signedFromVersion) >= 0;
19
- const hasChecksum = Boolean(expectedChecksum && expectedChecksum.trim());
20
29
 
21
- if (!requiresSignature && !hasChecksum) {
30
+ if (!requiresSignature && !hasExpectedChecksum(expectedChecksum)) {
22
31
  return {
23
32
  requiresSignature: false,
24
33
  requiresChecksum: false,
@@ -1,7 +1,13 @@
1
1
  /* global AbortController */
2
2
  import { readFile } from "node:fs/promises";
3
- import { verify } from "sigstore";
4
- import { SIGNATURE_FETCH_TIMEOUT_MS, SIGNER_CERTIFICATE_ISSUER } from "./constants.mjs";
3
+ import { createVerifier } from "sigstore";
4
+ import { describeErrorChain, isTrustRootUnreachable } from "./classifyTrustRootFailure.mjs";
5
+ import {
6
+ SIGNATURE_FETCH_TIMEOUT_MS,
7
+ SIGNATURE_TRUST_ROOT_HOST,
8
+ SIGNER_CERTIFICATE_ISSUER,
9
+ } from "./constants.mjs";
10
+ import { findBundleMismatch } from "./findBundleMismatch.mjs";
5
11
 
6
12
  /**
7
13
  * Verify a downloaded release asset against the Sigstore bundle published beside it.
@@ -10,15 +16,23 @@ import { SIGNATURE_FETCH_TIMEOUT_MS, SIGNER_CERTIFICATE_ISSUER } from "./constan
10
16
  * source repository, so the signer identity is pinned exactly: a bundle that is
11
17
  * otherwise valid but was issued to any other workflow is rejected.
12
18
  *
19
+ * Loading the trust root and checking the bundle run as separate steps. Only the
20
+ * first can report the host unreachable, and it never sees the bundle, so a tampered
21
+ * bundle cannot be mistaken for a network failure.
22
+ *
13
23
  * @param {object} params - Verification parameters.
14
24
  * @param {string} params.artifactPath - Path to the downloaded asset.
15
25
  * @param {string} params.bundleUrl - URL of the asset's Sigstore bundle.
16
26
  * @param {string} params.signerIdentityUri - Certificate subject the signer must carry.
17
- * @returns {Promise<{valid: boolean, reason: string}>} Verification outcome, with the rejection cause when invalid.
27
+ * @returns {Promise<{valid: boolean, reason: string, isTrustRootUnreachable: boolean}>} Verification outcome. `valid` is false whenever the signature was not proven; `isTrustRootUnreachable` marks the one case where it could not be checked at all.
18
28
  */
19
29
  export async function verifyReleaseSignature({ artifactPath, bundleUrl, signerIdentityUri }) {
20
30
  if (!signerIdentityUri) {
21
- return { valid: false, reason: "no signer identity is configured to verify against" };
31
+ return {
32
+ valid: false,
33
+ reason: "no signer identity is configured to verify against",
34
+ isTrustRootUnreachable: false,
35
+ };
22
36
  }
23
37
 
24
38
  const controller = new AbortController();
@@ -30,22 +44,60 @@ export async function verifyReleaseSignature({ artifactPath, bundleUrl, signerId
30
44
  return {
31
45
  valid: false,
32
46
  reason: `signature bundle unavailable (HTTP ${response.status}) at ${bundleUrl}`,
47
+ isTrustRootUnreachable: false,
33
48
  };
34
49
  }
35
50
  bundle = await response.json();
36
51
  } catch (error) {
37
- return { valid: false, reason: `could not fetch signature bundle: ${error.message}` };
52
+ return {
53
+ valid: false,
54
+ reason: `could not fetch signature bundle: ${error.message}`,
55
+ isTrustRootUnreachable: false,
56
+ };
38
57
  } finally {
39
58
  clearTimeout(timer);
40
59
  }
41
60
 
61
+ let artifactBytes;
62
+ try {
63
+ artifactBytes = await readFile(artifactPath);
64
+ } catch (error) {
65
+ return { valid: false, reason: error.message, isTrustRootUnreachable: false };
66
+ }
67
+
68
+ let bundleVerifier;
42
69
  try {
43
- await verify(bundle, await readFile(artifactPath), {
70
+ bundleVerifier = await createVerifier({
44
71
  certificateIssuer: SIGNER_CERTIFICATE_ISSUER,
45
72
  certificateIdentityURI: signerIdentityUri,
46
73
  });
47
- return { valid: true, reason: "" };
48
74
  } catch (error) {
49
- return { valid: false, reason: error.message };
75
+ const failureDescription = describeErrorChain(error);
76
+
77
+ if (!isTrustRootUnreachable(error)) {
78
+ return {
79
+ valid: false,
80
+ reason: `could not load the trust root from ${SIGNATURE_TRUST_ROOT_HOST}: ${failureDescription}`,
81
+ isTrustRootUnreachable: false,
82
+ };
83
+ }
84
+
85
+ const bundleMismatch = findBundleMismatch({
86
+ bundle: bundle,
87
+ artifactBytes: artifactBytes,
88
+ signerIdentityUri: signerIdentityUri,
89
+ });
90
+ return {
91
+ valid: false,
92
+ reason: bundleMismatch || failureDescription,
93
+ isTrustRootUnreachable: !bundleMismatch,
94
+ };
95
+ }
96
+
97
+ try {
98
+ bundleVerifier.verify(bundle, artifactBytes);
99
+ return { valid: true, reason: "", isTrustRootUnreachable: false };
100
+ } catch (error) {
101
+ return { valid: false, reason: error.message, isTrustRootUnreachable: false };
50
102
  }
51
103
  }