@driftsys/markspec 0.6.2 → 0.7.1

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 (76) hide show
  1. package/README.md +2 -3
  2. package/esm/compiler/constants.d.ts +1 -1
  3. package/esm/compiler/constants.d.ts.map +1 -1
  4. package/esm/compiler/constants.js +4 -14
  5. package/esm/config/markspec.d.ts +1 -0
  6. package/esm/config/markspec.d.ts.map +1 -1
  7. package/esm/config/markspec.js +5 -1
  8. package/esm/lock/resolve.d.ts.map +1 -1
  9. package/esm/lock/resolve.js +3 -11
  10. package/esm/lock/serializer.d.ts.map +1 -1
  11. package/esm/lock/serializer.js +2 -1
  12. package/esm/mod.d.ts +4 -4
  13. package/esm/mod.d.ts.map +1 -1
  14. package/esm/mod.js +3 -3
  15. package/esm/model/attributes.d.ts.map +1 -1
  16. package/esm/model/attributes.js +7 -0
  17. package/esm/model/mod.d.ts +3 -1
  18. package/esm/model/mod.d.ts.map +1 -1
  19. package/esm/model/mod.js +6 -14
  20. package/esm/model/relations.d.ts +35 -0
  21. package/esm/model/relations.d.ts.map +1 -0
  22. package/esm/model/relations.js +86 -0
  23. package/esm/model/type_hierarchy.d.ts +7 -0
  24. package/esm/model/type_hierarchy.d.ts.map +1 -1
  25. package/esm/model/type_hierarchy.js +35 -10
  26. package/esm/profile/manifest.d.ts +8 -0
  27. package/esm/profile/manifest.d.ts.map +1 -1
  28. package/esm/profile/manifest.js +9 -8
  29. package/esm/self_upgrade/manifest.d.ts +59 -2
  30. package/esm/self_upgrade/manifest.d.ts.map +1 -1
  31. package/esm/self_upgrade/manifest.js +81 -2
  32. package/esm/self_upgrade/mod.d.ts +1 -1
  33. package/esm/self_upgrade/mod.d.ts.map +1 -1
  34. package/esm/self_upgrade/mod.js +1 -1
  35. package/esm/validator/listing.d.ts.map +1 -1
  36. package/esm/validator/listing.js +9 -10
  37. package/esm/validator/trace_types.d.ts.map +1 -1
  38. package/esm/validator/trace_types.js +7 -29
  39. package/package.json +1 -1
  40. package/script/compiler/constants.d.ts +1 -1
  41. package/script/compiler/constants.d.ts.map +1 -1
  42. package/script/compiler/constants.js +4 -14
  43. package/script/config/markspec.d.ts +1 -0
  44. package/script/config/markspec.d.ts.map +1 -1
  45. package/script/config/markspec.js +7 -3
  46. package/script/lock/resolve.d.ts.map +1 -1
  47. package/script/lock/resolve.js +3 -11
  48. package/script/lock/serializer.d.ts.map +1 -1
  49. package/script/lock/serializer.js +2 -1
  50. package/script/mod.d.ts +4 -4
  51. package/script/mod.d.ts.map +1 -1
  52. package/script/mod.js +11 -4
  53. package/script/model/attributes.d.ts.map +1 -1
  54. package/script/model/attributes.js +7 -0
  55. package/script/model/mod.d.ts +3 -1
  56. package/script/model/mod.d.ts.map +1 -1
  57. package/script/model/mod.js +9 -14
  58. package/script/model/relations.d.ts +35 -0
  59. package/script/model/relations.d.ts.map +1 -0
  60. package/script/model/relations.js +89 -0
  61. package/script/model/type_hierarchy.d.ts +7 -0
  62. package/script/model/type_hierarchy.d.ts.map +1 -1
  63. package/script/model/type_hierarchy.js +36 -10
  64. package/script/profile/manifest.d.ts +8 -0
  65. package/script/profile/manifest.d.ts.map +1 -1
  66. package/script/profile/manifest.js +18 -16
  67. package/script/self_upgrade/manifest.d.ts +59 -2
  68. package/script/self_upgrade/manifest.d.ts.map +1 -1
  69. package/script/self_upgrade/manifest.js +84 -2
  70. package/script/self_upgrade/mod.d.ts +1 -1
  71. package/script/self_upgrade/mod.d.ts.map +1 -1
  72. package/script/self_upgrade/mod.js +5 -1
  73. package/script/validator/listing.d.ts.map +1 -1
  74. package/script/validator/listing.js +9 -10
  75. package/script/validator/trace_types.d.ts.map +1 -1
  76. package/script/validator/trace_types.js +6 -28
@@ -1 +1 @@
1
- {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../../src/self_upgrade/manifest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,MAAM,WAAW,aAAa;IAC5B,QAAQ,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A4BN;AAED,iEAAiE;AACjE,wBAAgB,aAAa,CAC3B,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,GACb,aAAa,CAKf;AAED,6EAA6E;AAC7E,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAIpD"}
@@ -3,18 +3,100 @@
3
3
  * @module core/self_upgrade/manifest
4
4
  *
5
5
  * Build the release tarball + SHA-256 URLs for a (version, target) pair,
6
- * and parse the single-line .sha256 files produced by sha256sum /
7
- * shasum -a 256 in the release workflow. Pure — no I/O.
6
+ * parse the single-line .sha256 files produced by sha256sum / shasum -a 256
7
+ * in the release workflow, and pin the release endpoints to the canonical
8
+ * GitHub origin. Pure — no I/O.
8
9
  *
9
10
  * The .sha256 line format is the standard one shared by GNU coreutils
10
11
  * sha256sum and BSD/macOS shasum: `<64-hex> <basename>` with a two-space
11
12
  * separator. We accept a trailing newline and lowercase the digest so
12
13
  * callers can compare strings directly.
14
+ *
15
+ * Release-endpoint pinning ({@linkcode resolveReleaseEndpoints} +
16
+ * {@linkcode assertTrustedReleaseUrl}) ensures a self-upgrade can only fetch
17
+ * from the canonical github.com origin in production — the env overrides are
18
+ * test-mode-only (issue #580).
13
19
  */
14
20
  Object.defineProperty(exports, "__esModule", { value: true });
21
+ exports.DEFAULT_RELEASES_DOWNLOAD_BASE = exports.DEFAULT_RELEASES_API = void 0;
22
+ exports.resolveReleaseEndpoints = resolveReleaseEndpoints;
23
+ exports.assertTrustedReleaseUrl = assertTrustedReleaseUrl;
15
24
  exports.releaseAssets = releaseAssets;
16
25
  exports.parseSha256Line = parseSha256Line;
26
+ /** Pinned GitHub releases API endpoint for the canonical markspec repo. */
27
+ exports.DEFAULT_RELEASES_API = "https://api.github.com/repos/driftsys/markspec/releases";
28
+ /** Pinned GitHub release-asset download base for the canonical markspec repo. */
29
+ exports.DEFAULT_RELEASES_DOWNLOAD_BASE = "https://github.com/driftsys/markspec/releases/download";
30
+ /**
31
+ * Hosts the self-upgrade fetches are permitted to contact in production.
32
+ * `objects.githubusercontent.com` is GitHub's release-asset CDN — a
33
+ * `releases/download` URL 302-redirects there, and `fetch` follows the
34
+ * redirect, so it must be on the allowlist even though we never build a
35
+ * URL pointing at it directly.
36
+ */
37
+ const TRUSTED_RELEASE_HOSTS = new Set([
38
+ "github.com",
39
+ "api.github.com",
40
+ "objects.githubusercontent.com",
41
+ ]);
17
42
  const SHA256_LINE_RE = /^([0-9a-fA-F]{64})\s+(\S.*?)\s*$/;
43
+ /**
44
+ * Resolve the releases-API and download-base URLs, honouring the
45
+ * `MARKSPEC_RELEASES_API` / `MARKSPEC_RELEASES_DOWNLOAD_BASE` overrides
46
+ * **only** under `MARKSPEC_TEST_MODE=1` (`input.testMode`). In production
47
+ * the pinned `DEFAULT_RELEASES_*` constants are always returned, so a stray
48
+ * or hostile env var in the user's shell cannot redirect a self-upgrade to
49
+ * an attacker-controlled origin (issue #580) — the same gating the
50
+ * `MARKSPEC_SELF_UPGRADE_BIN_PATH` override already uses. A missing override
51
+ * under test mode falls back to the pinned default for that endpoint.
52
+ */
53
+ function resolveReleaseEndpoints(input) {
54
+ const apiBase = input.testMode && input.apiOverride
55
+ ? input.apiOverride
56
+ : exports.DEFAULT_RELEASES_API;
57
+ const downloadBase = input.testMode && input.downloadOverride
58
+ ? input.downloadOverride
59
+ : exports.DEFAULT_RELEASES_DOWNLOAD_BASE;
60
+ return { apiBase, downloadBase };
61
+ }
62
+ /**
63
+ * Assert that a release-endpoint URL is safe to fetch from, throwing
64
+ * otherwise. Defence-in-depth for {@linkcode resolveReleaseEndpoints}: even
65
+ * if a future change reintroduces an unconditional override, no fetch can
66
+ * reach an insecure or non-GitHub origin.
67
+ *
68
+ * In production (`allowInsecure: false`) the URL MUST use `https:` and a
69
+ * host in the GitHub allowlist (`github.com`, `api.github.com`,
70
+ * `objects.githubusercontent.com`). Under test mode (`allowInsecure: true`)
71
+ * an `http(s)` URL to `localhost` / `127.0.0.1` / `[::1]` is additionally
72
+ * permitted so the e2e suite can point at a local mock server; every other
73
+ * host still falls through to the production https-+-allowlist check.
74
+ *
75
+ * @throws Error when the URL is malformed, uses a non-https scheme, or
76
+ * targets a host outside the allowlist.
77
+ */
78
+ function assertTrustedReleaseUrl(rawUrl, opts) {
79
+ let url;
80
+ try {
81
+ url = new URL(rawUrl);
82
+ }
83
+ catch {
84
+ throw new Error(`invalid release URL: ${JSON.stringify(rawUrl)}`);
85
+ }
86
+ if (opts.allowInsecure) {
87
+ const isLoopback = url.hostname === "localhost" ||
88
+ url.hostname === "127.0.0.1" || url.hostname === "[::1]";
89
+ if (isLoopback && (url.protocol === "http:" || url.protocol === "https:")) {
90
+ return;
91
+ }
92
+ }
93
+ if (url.protocol !== "https:") {
94
+ throw new Error(`refusing to self-upgrade over insecure transport: ${url.protocol}//${url.host} (only https: is permitted)`);
95
+ }
96
+ if (!TRUSTED_RELEASE_HOSTS.has(url.hostname)) {
97
+ throw new Error(`refusing to self-upgrade from untrusted host: ${url.host} (permitted: ${[...TRUSTED_RELEASE_HOSTS].join(", ")})`);
98
+ }
99
+ }
18
100
  /** Build the tarball + checksum URLs for a (version, target). */
19
101
  function releaseAssets(baseUrl, version, target) {
20
102
  const tag = version.startsWith("v") ? version : `v${version}`;
@@ -7,6 +7,6 @@
7
7
  */
8
8
  export { compareVersions, type Comparison } from "./compare.js";
9
9
  export { classifyInstallPath, type ClassifyResult, type InstallSource, } from "./pm_detect.js";
10
- export { parseSha256Line, type ReleaseAssets, releaseAssets, } from "./manifest.js";
10
+ export { assertTrustedReleaseUrl, DEFAULT_RELEASES_API, DEFAULT_RELEASES_DOWNLOAD_BASE, parseSha256Line, type ReleaseAssets, releaseAssets, type ReleaseEndpoints, type ResolveEndpointsInput, resolveReleaseEndpoints, } from "./manifest.js";
11
11
  export { type Arch, detectTarget, type Os, type Platform, platformFromBuild, type Target, } from "./target.js";
12
12
  //# sourceMappingURL=mod.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/self_upgrade/mod.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,eAAe,EAAE,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EACL,mBAAmB,EACnB,KAAK,cAAc,EACnB,KAAK,aAAa,GACnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,eAAe,EACf,KAAK,aAAa,EAClB,aAAa,GACd,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,KAAK,IAAI,EACT,YAAY,EACZ,KAAK,EAAE,EACP,KAAK,QAAQ,EACb,iBAAiB,EACjB,KAAK,MAAM,GACZ,MAAM,aAAa,CAAC"}
1
+ {"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../src/self_upgrade/mod.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,eAAe,EAAE,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,EACL,mBAAmB,EACnB,KAAK,cAAc,EACnB,KAAK,aAAa,GACnB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACpB,8BAA8B,EAC9B,eAAe,EACf,KAAK,aAAa,EAClB,aAAa,EACb,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAC1B,uBAAuB,GACxB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,KAAK,IAAI,EACT,YAAY,EACZ,KAAK,EAAE,EACP,KAAK,QAAQ,EACb,iBAAiB,EACjB,KAAK,MAAM,GACZ,MAAM,aAAa,CAAC"}
@@ -7,14 +7,18 @@
7
7
  * orchestrator and helpers that wire these into HTTP + filesystem.
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.platformFromBuild = exports.detectTarget = exports.releaseAssets = exports.parseSha256Line = exports.classifyInstallPath = exports.compareVersions = void 0;
10
+ exports.platformFromBuild = exports.detectTarget = exports.resolveReleaseEndpoints = exports.releaseAssets = exports.parseSha256Line = exports.DEFAULT_RELEASES_DOWNLOAD_BASE = exports.DEFAULT_RELEASES_API = exports.assertTrustedReleaseUrl = exports.classifyInstallPath = exports.compareVersions = void 0;
11
11
  var compare_js_1 = require("./compare.js");
12
12
  Object.defineProperty(exports, "compareVersions", { enumerable: true, get: function () { return compare_js_1.compareVersions; } });
13
13
  var pm_detect_js_1 = require("./pm_detect.js");
14
14
  Object.defineProperty(exports, "classifyInstallPath", { enumerable: true, get: function () { return pm_detect_js_1.classifyInstallPath; } });
15
15
  var manifest_js_1 = require("./manifest.js");
16
+ Object.defineProperty(exports, "assertTrustedReleaseUrl", { enumerable: true, get: function () { return manifest_js_1.assertTrustedReleaseUrl; } });
17
+ Object.defineProperty(exports, "DEFAULT_RELEASES_API", { enumerable: true, get: function () { return manifest_js_1.DEFAULT_RELEASES_API; } });
18
+ Object.defineProperty(exports, "DEFAULT_RELEASES_DOWNLOAD_BASE", { enumerable: true, get: function () { return manifest_js_1.DEFAULT_RELEASES_DOWNLOAD_BASE; } });
16
19
  Object.defineProperty(exports, "parseSha256Line", { enumerable: true, get: function () { return manifest_js_1.parseSha256Line; } });
17
20
  Object.defineProperty(exports, "releaseAssets", { enumerable: true, get: function () { return manifest_js_1.releaseAssets; } });
21
+ Object.defineProperty(exports, "resolveReleaseEndpoints", { enumerable: true, get: function () { return manifest_js_1.resolveReleaseEndpoints; } });
18
22
  var target_js_1 = require("./target.js");
19
23
  Object.defineProperty(exports, "detectTarget", { enumerable: true, get: function () { return target_js_1.detectTarget; } });
20
24
  Object.defineProperty(exports, "platformFromBuild", { enumerable: true, get: function () { return target_js_1.platformFromBuild; } });
@@ -1 +1 @@
1
- {"version":3,"file":"listing.d.ts","sourceRoot":"","sources":["../../src/validator/listing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,iBAAiB,C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ports, "__esModule", { value: true });
22
22
  exports.validateListingDocuments = validateListingDocuments;
23
23
  const path_1 = require("@std/path");
24
+ const mod_js_1 = require("../model/mod.js");
24
25
  const glossary_js_1 = require("../parser/glossary.js");
25
26
  const component_schemes_js_1 = require("./component_schemes.js");
26
27
  // ---------------------------------------------------------------------------
27
28
  // Component-family and Unit-family sets
28
29
  // ---------------------------------------------------------------------------
29
- /** Core Component-family type names per ADR-003 §Part 2 / spec §6.3. */
30
- const COMPONENT_FAMILY = new Set([
31
- "Component",
32
- "SoftwareComponent",
33
- "HardwareComponent",
34
- "SoftwareInterface",
35
- "HardwareInterface",
36
- ]);
30
+ /** Core Component-family type names per ADR-003 §Part 2 / spec §6.3.
31
+ *
32
+ * SoftwareInterface and HardwareInterface are NOT included here: they
33
+ * were re-parented from Component to Contract (interface-as-contract
34
+ * design). A components listing accepts only true structural components.
35
+ */
36
+ const COMPONENT_FAMILY = (0, mod_js_1.descendantsOf)("Component");
37
37
  /** Core Unit-family type names per ADR-003 §Part 2. */
38
38
  const UNIT_FAMILY = new Set([
39
39
  "Unit",
@@ -229,8 +229,7 @@ function validateComponentsEntry(entry, file, diagnostics) {
229
229
  severity: "error",
230
230
  message: `${file}:${entry.location.line}: entry '[${entry.displayId}]' ` +
231
231
  `has Type: ${typeVal} which is not in the Component family ` +
232
- `(Component/SoftwareComponent/HardwareComponent/` +
233
- `SoftwareInterface/HardwareInterface) — ` +
232
+ `(Component/SoftwareComponent/HardwareComponent) — ` +
234
233
  `only Component-family types are permitted in a components listing ` +
235
234
  `(spec §6.3)`,
236
235
  location: entry.location,
@@ -1 +1 @@
1
- {"version":3,"file":"trace_types.d.ts","sourceRoot":"","sources":["../../src/validator/trace_types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AA0GzD;;;;;;;;;GASG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,SAAS,KAAK,EAAE,GACxB,SAAS,UAAU,EAAE,CAuHvB"}
1
+ {"version":3,"file":"trace_types.d.ts","sourceRoot":"","sources":["../../src/validator/trace_types.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AAoFzD;;;;;;;;;GASG;AACH,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,SAAS,KAAK,EAAE,GACxB,SAAS,UAAU,EAAE,CAuHvB"}
@@ -16,34 +16,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
16
16
  exports.validateTraceTargetTypes = validateTraceTargetTypes;
17
17
  const mod_js_1 = require("../model/mod.js");
18
18
  const type_resolution_js_1 = require("./type_resolution.js");
19
- const TRACE_RULES = [
20
- // Specification family
21
- { attr: "Satisfies", allowedTargetTypes: ["Specification"] },
22
- { attr: "Derived-from", allowedTargetTypes: ["Specification"] },
23
- { attr: "Allocated-to", allowedTargetTypes: ["Component"] },
24
- // Test (extends Specification)
25
- { attr: "Verifies", allowedTargetTypes: ["Requirement", "Contract"] },
26
- { attr: "Tests", allowedTargetTypes: ["Component", "Unit"] },
27
- // Component / Unit
28
- { attr: "Realizes", allowedTargetTypes: ["Specification"] },
29
- {
30
- attr: "Provides",
31
- allowedTargetTypes: ["SoftwareInterface", "HardwareInterface"],
32
- },
33
- {
34
- attr: "Requires",
35
- allowedTargetTypes: ["SoftwareInterface", "HardwareInterface"],
36
- },
37
- { attr: "Depends-on", allowedTargetTypes: ["Component", "Unit"] },
38
- { attr: "Part-of", allowedTargetTypes: ["Component"] },
39
- // Risk
40
- { attr: "Mitigated-by", allowedTargetTypes: ["Specification"] },
41
- // Record
42
- { attr: "Affects", allowedTargetTypes: ["Component", "Unit"] },
43
- // `Caused-by` is polymorphic between Record (cause = Requirement/Risk/
44
- // Contract/Record) and Risk (cause = Component/Unit/Specification).
45
- // The simplest correct rule is the union — handled by the loop below.
46
- ];
19
+ const TRACE_RULES = mod_js_1.CORE_RELATIONS
20
+ .filter((r) => r.targetTypes)
21
+ .map((r) => ({ attr: r.attr, allowedTargetTypes: r.targetTypes }));
22
+ // `Caused-by` is polymorphic between Record (cause = Requirement/Risk/
23
+ // Contract/Record) and Risk (cause = Component/Unit/Specification).
24
+ // The simplest correct rule is the union — handled by POLYMORPHIC_CAUSED_BY below.
47
25
  /** Polymorphic relations where the source type's role widens the targets. */
48
26
  const POLYMORPHIC_CAUSED_BY = [
49
27
  {