reactive-md 0.6.0 → 0.6.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.
- package/CHANGELOG-ch.md +203 -194
- package/CHANGELOG.md +203 -194
- package/CONTRIBUTING-ch.md +67 -67
- package/CONTRIBUTING.md +69 -69
- package/README-ch.md +157 -157
- package/README-en.md +184 -184
- package/README.md +184 -184
- package/SECURITY-ch.md +81 -81
- package/SECURITY.md +81 -81
- package/THIRD_PARTY_NOTICES.md +313 -209
- package/bin/reactive-md.mjs +39 -39
- package/cli/args.mjs +181 -181
- package/cli/assets.mjs +390 -390
- package/cli/build.mjs +268 -268
- package/cli/document.mjs +130 -130
- package/cli/errors.mjs +61 -61
- package/cli/fs-utils.mjs +133 -133
- package/cli/glob.mjs +203 -203
- package/cli/help.mjs +138 -138
- package/cli/lint.mjs +177 -177
- package/cli/main.mjs +55 -55
- package/cli/migrate.mjs +368 -368
- package/cli/package.mjs +210 -210
- package/dist-library/{authoring-DSC0VsNK.js → authoring-BEVyth5X.js} +1 -1
- package/dist-library/compiler-Cm3ppMxG.js +46044 -0
- package/dist-library/{react-Dk94rcOp.js → react-Bh7_oxZp.js} +20110 -20113
- package/dist-library/reactive-md-authoring.js +2 -2
- package/dist-library/reactive-md-print.css +284 -284
- package/dist-library/reactive-md-react-unstyled.js +1 -1
- package/dist-library/reactive-md-react.js +1 -1
- package/dist-library/reactive-md.css +1 -1
- package/dist-library/reactive-md.js +3 -3
- package/dist-library/{runtime-D8KbnCd0.js → runtime-DlFYQ4s_.js} +1 -1
- package/dist-library/types/local/math-display.d.ts +22 -23
- package/dist-library/types/local/math-view.d.ts +6 -7
- package/dist-standalone/reactive-md-standalone.css +1 -1
- package/dist-standalone/reactive-md-standalone.js +318 -62
- package/docs/compatibility/compatibility-ch.md +121 -119
- package/docs/compatibility/compatibility-en.md +121 -119
- package/docs/compatibility/source-versioning-ch.md +159 -159
- package/docs/compatibility/source-versioning-en.md +159 -159
- package/docs/development/component-development-ch.md +210 -210
- package/docs/development/component-development-en.md +210 -210
- package/docs/development/component-protocol-ch.md +747 -747
- package/docs/development/component-protocol-en.md +747 -747
- package/docs/development/performance-ch.md +76 -76
- package/docs/development/performance-en.md +76 -76
- package/docs/development/releasing-ch.md +108 -108
- package/docs/development/releasing-en.md +108 -108
- package/docs/integration/author-tools-ch.md +62 -62
- package/docs/integration/author-tools-en.md +62 -62
- package/docs/integration/shareable-export-ch.md +209 -209
- package/docs/integration/shareable-export-en.md +211 -211
- package/docs/reference/computations-formatting-ch.md +87 -87
- package/docs/reference/computations-formatting-en.md +87 -87
- package/docs/reference/constraints-collections-ch.md +84 -84
- package/docs/reference/constraints-collections-en.md +84 -84
- package/docs/reference/diagnostics-counting-ch.md +104 -104
- package/docs/reference/diagnostics-counting-en.md +104 -104
- package/docs/reference/local-components-v2-ch.md +138 -138
- package/docs/reference/local-components-v2-en.md +104 -104
- package/docs/reference/local-interaction-syntax-ch.md +515 -511
- package/docs/reference/local-interaction-syntax-en.md +511 -507
- package/docs/reference/theme-protocol-ch.md +107 -107
- package/docs/reference/theme-protocol-en.md +107 -107
- package/docs/releases/release-0.4.0-ch.md +89 -89
- package/docs/releases/release-0.4.0-en.md +89 -89
- package/docs/releases/release-0.4.1-ch.md +23 -23
- package/docs/releases/release-0.4.1-en.md +23 -23
- package/docs/releases/release-0.6.1-ch.md +27 -0
- package/docs/releases/release-0.6.1-en.md +27 -0
- package/examples/conformance/README.md +53 -53
- package/examples/conformance/component-protocol-1.json +482 -482
- package/examples/conformance/component-protocol-1.schema.json +76 -76
- package/examples/conformance/local-draft-1.json +50 -50
- package/examples/conformance/local-draft-2.json +212 -212
- package/examples/integration/README.md +47 -47
- package/examples/integration/core/index.mjs +32 -32
- package/examples/integration/worker/index.html +19 -19
- package/examples/integration/worker/main.js +61 -61
- package/examples/integration/worker/package.json +13 -13
- package/examples/integration/worker/worker.js +3 -3
- package/examples/local/README.md +74 -74
- package/examples/local/charts.reactive.md +73 -73
- package/examples/local/recipes/invoice-zh.reactive.md +36 -36
- package/examples/local/recipes/invoice.reactive.md +36 -36
- package/examples/local/recipes/workshop-zh.reactive.md +33 -33
- package/examples/local/recipes/workshop.reactive.md +33 -33
- package/examples/local/showcase/README.md +25 -25
- package/examples/local/showcase/explore.reactive.md +102 -102
- package/examples/local/showcase/flow.reactive.md +86 -86
- package/examples/local/showcase/forms.reactive.md +126 -126
- package/examples/local/showcase/functions.reactive.md +119 -119
- package/examples/local/showcase/layout.reactive.md +100 -100
- package/examples/local/showcase/statistics.reactive.md +108 -108
- package/examples/local/showcase/tasks.reactive.md +89 -89
- package/examples/local/showcase/zh/explore.reactive.md +102 -102
- package/examples/local/showcase/zh/flow.reactive.md +86 -86
- package/examples/local/showcase/zh/forms.reactive.md +126 -126
- package/examples/local/showcase/zh/functions.reactive.md +119 -119
- package/examples/local/showcase/zh/layout.reactive.md +100 -100
- package/examples/local/showcase/zh/statistics.reactive.md +108 -108
- package/examples/local/showcase/zh/tasks.reactive.md +89 -89
- package/package.json +152 -152
- package/dist-library/compiler-CRD88BMt.js +0 -24964
package/SECURITY.md
CHANGED
|
@@ -1,81 +1,81 @@
|
|
|
1
|
-
# Security policy
|
|
2
|
-
|
|
3
|
-
Reactive MD renders local interactive documents written by authors. When document content is untrusted input, the renderer, expressions and math evaluation all stay within the boundaries below. The host remains responsible for authorization, network policy and server-side data.
|
|
4
|
-
|
|
5
|
-
## Supported versions
|
|
6
|
-
|
|
7
|
-
Current maintenance covers the latest 0.x preview. Security fixes may ship in minor releases and are described in the [changelog](CHANGELOG.md) with impact and migration steps.
|
|
8
|
-
|
|
9
|
-
## Threat boundary
|
|
10
|
-
|
|
11
|
-
The guarantees below are covered by compiler, runtime and renderer tests; capabilities not listed here are not promised.
|
|
12
|
-
|
|
13
|
-
### Document content
|
|
14
|
-
|
|
15
|
-
- With the three HTML capability options off, author scripts, event attributes and CSS remain inert. P0 HTML is rebuilt as typed nodes and React elements. See [HTML compatibility and the temporary routing policy](docs/reference/html-compatibility-en.md).
|
|
16
|
-
- Enabling `enableCss`, `enableJavaScript` or `enableExtendedHtml` routes the entire source to native HTML inside a sandboxed iframe without `allow-same-origin`. The other flags still constrain author source. Arbitrary enabled JavaScript can create DOM elements and styles dynamically; individual source flags are not runtime DOM permissions. CSP and sandbox restrictions continue to govern network access, forms and navigation.
|
|
17
|
-
- The default React renderer
|
|
18
|
-
- Expressions use their own parser and AST evaluator, with no `eval` or `new Function`, and no support for assignment, method calls, property access, prototype paths or imports. Expressions can only read parameters declared by the document and built-in functions.
|
|
19
|
-
-
|
|
20
|
-
- Expressions, templates, tables and charts do not make network requests; chart data must be written in the document.
|
|
21
|
-
|
|
22
|
-
### URLs and networking
|
|
23
|
-
|
|
24
|
-
- All images are rejected by default, including relative paths and protocol-relative addresses, so loading the document itself triggers no image requests.
|
|
25
|
-
- Images load only when the host passes `urlPolicy` and the policy returns `true`. Images with a protocol still have that protocol checked first: only `http:` and `https:` are allowed. Relative addresses are decided by the policy. Addresses such as `javascript:` or dangerous `data:` URLs are rejected even if the policy allows them.
|
|
26
|
-
- Links allow relative addresses and `http:`, `https:`, `mailto:` and `tel:` by default; external HTTP links open in a new tab with `noopener noreferrer`. Dangerous protocols are always rejected.
|
|
27
|
-
- If the policy throws, the address is rejected. Images that are allowed to load use `referrerPolicy="no-referrer"`; same-origin images may still carry cookies, so image allowlists should avoid business APIs.
|
|
28
|
-
- A trusted `imageResolver` runs only after the image URL passes protocol checks and `urlPolicy`. It maps an accepted URL to host-controlled output; exported files use only verified `data:image/png|jpeg|gif|webp;base64` values, and links never reach it.
|
|
29
|
-
- `urlPolicy` is a URL allowlist, not server-side authorization. The host still needs to configure CSP, network egress, an image proxy or a sandboxed iframe (when authors are fully untrusted).
|
|
30
|
-
|
|
31
|
-
### Resource limits
|
|
32
|
-
|
|
33
|
-
`src/local/limits.ts` defines shared limits used by compilation, the runtime and visualizations:
|
|
34
|
-
|
|
35
|
-
| Limit | Value |
|
|
36
|
-
| --- | --- |
|
|
37
|
-
| Source per document | 1,000,000 characters |
|
|
38
|
-
| Syntax nodes created cumulatively during parsing | 10,000 by default, configured per call by the host |
|
|
39
|
-
| A single string value or template | 100,000 characters |
|
|
40
|
-
| A single array | 10,000 items |
|
|
41
|
-
| Total string length within an array | 100,000 characters |
|
|
42
|
-
| Email address | 254 characters, validated in linear time |
|
|
43
|
-
| Number of diagnostics | 100 |
|
|
44
|
-
| Text of a single diagnostic | 2,000 characters |
|
|
45
|
-
| Curves per plot component | 16 |
|
|
46
|
-
| Curve sample points requested by the whole document | 20,000 |
|
|
47
|
-
| Shared computation steps for plotting | 2,000,000 |
|
|
48
|
-
|
|
49
|
-
Writes over a limit are rejected and the runtime keeps the last valid state; compile-time overruns return diagnostics. Plotting and math evaluation also have their own depth, token and node budgets. Budgets bound the work for a single document; they do not replace host control over request size, concurrency and timeouts.
|
|
50
|
-
|
|
51
|
-
Hosts can adjust the syntax node budget for a single compilation with `compileLocal(source, { limits: { maxSyntaxNodes } })`; the value must be a positive safe integer. Document content cannot change this setting. When omitted, the default budget of 10,000 applies; raising the node budget does not change the source length, array, expression or plotting limits. The count covers every `LocalNode` created during parsing, including intermediate nodes that are not kept in the final tree.
|
|
52
|
-
|
|
53
|
-
### State and isolation
|
|
54
|
-
|
|
55
|
-
- Parameter state exists only in the memory of the current document instance. Each `LocalReactiveDocument` or `LocalDocumentView` instance is independent; disposal clears subscriptions, expression caches and timers.
|
|
56
|
-
- `createLocalRuntime` validates initial values and constraints on shared controls; `set` relies on the controls registered in the document, ignores forged node metadata from the caller, and commits atomically only when every shared control accepts the write.
|
|
57
|
-
- `snapshot()` returns a stable frozen snapshot, including frozen arrays; `get()` and `evaluate()` return array copies. State updates are committed through validated `set()` calls.
|
|
58
|
-
- `disabled` and `if` are display states only, not permission control. Business permissions and value validation must be enforced by the host when submitting to the server.
|
|
59
|
-
|
|
60
|
-
### Shareable HTML export
|
|
61
|
-
|
|
62
|
-
- `reactive-md-state/v1` stores only public binding names and serializable values. It excludes `@` internal bindings, revisions, node IDs, AST data, UI state and timers. Source digest, syntax, parameter set and every value are validated before import; unknown or conflicting keys reject the whole file.
|
|
63
|
-
- Default ReactiveMD interactive exports embed a fixed standalone runtime and a CSP with no network connections, frames, objects, base injection or form submission. Native HTML exports additionally permit the sandboxed `srcdoc` frame that holds the document; its own CSP governs author CSS and scripts. JSON, source, titles and notices are escaped for their HTML/script context.
|
|
64
|
-
- The CLI inlines only relative raster files that resolve inside the document directory or an explicit asset root. It rejects remote images, URL schemes, absolute paths, traversal, symlink escapes, SVG, forged formats and oversized assets. The demo export dialog disables HTML export when images are present.
|
|
65
|
-
- Static HTML contains no runtime script or auto-mount payload. Static-first hydration is covered only in the single-file Chromium/Edge path; it is not a general hydration or sandboxing guarantee. Use a sandboxed iframe for fully untrusted authors.
|
|
66
|
-
- Exporting current parameters is an explicit host/reader action. Treat the generated state file and HTML as potentially sensitive; choose initial values unless current values are intentionally meant to be shared.
|
|
67
|
-
|
|
68
|
-
## Host responsibilities
|
|
69
|
-
|
|
70
|
-
- Decide who may write, submit and share documents; limit request size, concurrency and execution time for untrusted authors. Compiling a 1,000,000-character document is still real CPU work.
|
|
71
|
-
- Configure `urlPolicy` for images and links; maintain CSP, network egress control and image allowlists.
|
|
72
|
-
- Revalidate form values, permissions and business constraints on the server; do not trust `disabled`, conditional visibility or client state inside the document.
|
|
73
|
-
- When persistence is needed, store the original `.reactive.md` source securely; runtime state and `LocalDocument` should not be treated as a persistence format.
|
|
74
|
-
- Before statically rendering untrusted documents on the server, assess the resource limits of the rendering process. General SSR hydration remains unverified; only the single-file static-first path has Chromium/Edge coverage. Hydration is not a security boundary.
|
|
75
|
-
- Report vulnerabilities in third-party dependencies upstream as well; this package is responsible only for its own integration code.
|
|
76
|
-
|
|
77
|
-
## Reporting vulnerabilities
|
|
78
|
-
|
|
79
|
-
The repository has GitHub private vulnerability reporting enabled. Submit affected versions, a minimal reproduction, expected impact and remediation suggestions through [Report a vulnerability](https://github.com/yao1145/ReactiveMD/security/advisories/new).
|
|
80
|
-
|
|
81
|
-
Use the private channel to report vulnerability details; remove exploit code, credentials, user data and information about affected deployments from public issues and PRs.
|
|
1
|
+
# Security policy
|
|
2
|
+
|
|
3
|
+
Reactive MD renders local interactive documents written by authors. When document content is untrusted input, the renderer, expressions and math evaluation all stay within the boundaries below. The host remains responsible for authorization, network policy and server-side data.
|
|
4
|
+
|
|
5
|
+
## Supported versions
|
|
6
|
+
|
|
7
|
+
Current maintenance covers the latest 0.x preview. Security fixes may ship in minor releases and are described in the [changelog](CHANGELOG.md) with impact and migration steps.
|
|
8
|
+
|
|
9
|
+
## Threat boundary
|
|
10
|
+
|
|
11
|
+
The guarantees below are covered by compiler, runtime and renderer tests; capabilities not listed here are not promised.
|
|
12
|
+
|
|
13
|
+
### Document content
|
|
14
|
+
|
|
15
|
+
- With the three HTML capability options off, author scripts, event attributes and CSS remain inert. P0 HTML is rebuilt as typed nodes and React elements. See [HTML compatibility and the temporary routing policy](docs/reference/html-compatibility-en.md).
|
|
16
|
+
- Enabling `enableCss`, `enableJavaScript` or `enableExtendedHtml` routes the entire source to native HTML inside a sandboxed iframe without `allow-same-origin`. The other flags still constrain author source. Arbitrary enabled JavaScript can create DOM elements and styles dynamically; individual source flags are not runtime DOM permissions. CSP and sandbox restrictions continue to govern network access, forms and navigation.
|
|
17
|
+
- The default React renderer injects only HTML generated by the configured KaTeX typesetter. Author source and error messages are escaped as text. Native HTML uses a parsed and filtered iframe `srcdoc`, separate from the host DOM.
|
|
18
|
+
- Expressions use their own parser and AST evaluator, with no `eval` or `new Function`, and no support for assignment, method calls, property access, prototype paths or imports. Expressions can only read parameters declared by the document and built-in functions.
|
|
19
|
+
- KaTeX typesets formulas as HTML with accessible MathML. Input, expansion and user-specified dimensions are bounded; author-defined macros, files, network and HTML entry points are disabled. Invalid or unsupported formulas fall back to bounded source text. Plot evaluation uses its separate budget-limited parser.
|
|
20
|
+
- Expressions, templates, tables and charts do not make network requests; chart data must be written in the document.
|
|
21
|
+
|
|
22
|
+
### URLs and networking
|
|
23
|
+
|
|
24
|
+
- All images are rejected by default, including relative paths and protocol-relative addresses, so loading the document itself triggers no image requests.
|
|
25
|
+
- Images load only when the host passes `urlPolicy` and the policy returns `true`. Images with a protocol still have that protocol checked first: only `http:` and `https:` are allowed. Relative addresses are decided by the policy. Addresses such as `javascript:` or dangerous `data:` URLs are rejected even if the policy allows them.
|
|
26
|
+
- Links allow relative addresses and `http:`, `https:`, `mailto:` and `tel:` by default; external HTTP links open in a new tab with `noopener noreferrer`. Dangerous protocols are always rejected.
|
|
27
|
+
- If the policy throws, the address is rejected. Images that are allowed to load use `referrerPolicy="no-referrer"`; same-origin images may still carry cookies, so image allowlists should avoid business APIs.
|
|
28
|
+
- A trusted `imageResolver` runs only after the image URL passes protocol checks and `urlPolicy`. It maps an accepted URL to host-controlled output; exported files use only verified `data:image/png|jpeg|gif|webp;base64` values, and links never reach it.
|
|
29
|
+
- `urlPolicy` is a URL allowlist, not server-side authorization. The host still needs to configure CSP, network egress, an image proxy or a sandboxed iframe (when authors are fully untrusted).
|
|
30
|
+
|
|
31
|
+
### Resource limits
|
|
32
|
+
|
|
33
|
+
`src/local/limits.ts` defines shared limits used by compilation, the runtime and visualizations:
|
|
34
|
+
|
|
35
|
+
| Limit | Value |
|
|
36
|
+
| --- | --- |
|
|
37
|
+
| Source per document | 1,000,000 characters |
|
|
38
|
+
| Syntax nodes created cumulatively during parsing | 10,000 by default, configured per call by the host |
|
|
39
|
+
| A single string value or template | 100,000 characters |
|
|
40
|
+
| A single array | 10,000 items |
|
|
41
|
+
| Total string length within an array | 100,000 characters |
|
|
42
|
+
| Email address | 254 characters, validated in linear time |
|
|
43
|
+
| Number of diagnostics | 100 |
|
|
44
|
+
| Text of a single diagnostic | 2,000 characters |
|
|
45
|
+
| Curves per plot component | 16 |
|
|
46
|
+
| Curve sample points requested by the whole document | 20,000 |
|
|
47
|
+
| Shared computation steps for plotting | 2,000,000 |
|
|
48
|
+
|
|
49
|
+
Writes over a limit are rejected and the runtime keeps the last valid state; compile-time overruns return diagnostics. Plotting and math evaluation also have their own depth, token and node budgets. Budgets bound the work for a single document; they do not replace host control over request size, concurrency and timeouts.
|
|
50
|
+
|
|
51
|
+
Hosts can adjust the syntax node budget for a single compilation with `compileLocal(source, { limits: { maxSyntaxNodes } })`; the value must be a positive safe integer. Document content cannot change this setting. When omitted, the default budget of 10,000 applies; raising the node budget does not change the source length, array, expression or plotting limits. The count covers every `LocalNode` created during parsing, including intermediate nodes that are not kept in the final tree.
|
|
52
|
+
|
|
53
|
+
### State and isolation
|
|
54
|
+
|
|
55
|
+
- Parameter state exists only in the memory of the current document instance. Each `LocalReactiveDocument` or `LocalDocumentView` instance is independent; disposal clears subscriptions, expression caches and timers.
|
|
56
|
+
- `createLocalRuntime` validates initial values and constraints on shared controls; `set` relies on the controls registered in the document, ignores forged node metadata from the caller, and commits atomically only when every shared control accepts the write.
|
|
57
|
+
- `snapshot()` returns a stable frozen snapshot, including frozen arrays; `get()` and `evaluate()` return array copies. State updates are committed through validated `set()` calls.
|
|
58
|
+
- `disabled` and `if` are display states only, not permission control. Business permissions and value validation must be enforced by the host when submitting to the server.
|
|
59
|
+
|
|
60
|
+
### Shareable HTML export
|
|
61
|
+
|
|
62
|
+
- `reactive-md-state/v1` stores only public binding names and serializable values. It excludes `@` internal bindings, revisions, node IDs, AST data, UI state and timers. Source digest, syntax, parameter set and every value are validated before import; unknown or conflicting keys reject the whole file.
|
|
63
|
+
- Default ReactiveMD interactive exports embed a fixed standalone runtime and a CSP with no network connections, frames, objects, base injection or form submission. Native HTML exports additionally permit the sandboxed `srcdoc` frame that holds the document; its own CSP governs author CSS and scripts. JSON, source, titles and notices are escaped for their HTML/script context.
|
|
64
|
+
- The CLI inlines only relative raster files that resolve inside the document directory or an explicit asset root. It rejects remote images, URL schemes, absolute paths, traversal, symlink escapes, SVG, forged formats and oversized assets. The demo export dialog disables HTML export when images are present.
|
|
65
|
+
- Static HTML contains no runtime script or auto-mount payload. Static-first hydration is covered only in the single-file Chromium/Edge path; it is not a general hydration or sandboxing guarantee. Use a sandboxed iframe for fully untrusted authors.
|
|
66
|
+
- Exporting current parameters is an explicit host/reader action. Treat the generated state file and HTML as potentially sensitive; choose initial values unless current values are intentionally meant to be shared.
|
|
67
|
+
|
|
68
|
+
## Host responsibilities
|
|
69
|
+
|
|
70
|
+
- Decide who may write, submit and share documents; limit request size, concurrency and execution time for untrusted authors. Compiling a 1,000,000-character document is still real CPU work.
|
|
71
|
+
- Configure `urlPolicy` for images and links; maintain CSP, network egress control and image allowlists.
|
|
72
|
+
- Revalidate form values, permissions and business constraints on the server; do not trust `disabled`, conditional visibility or client state inside the document.
|
|
73
|
+
- When persistence is needed, store the original `.reactive.md` source securely; runtime state and `LocalDocument` should not be treated as a persistence format.
|
|
74
|
+
- Before statically rendering untrusted documents on the server, assess the resource limits of the rendering process. General SSR hydration remains unverified; only the single-file static-first path has Chromium/Edge coverage. Hydration is not a security boundary.
|
|
75
|
+
- Report vulnerabilities in third-party dependencies upstream as well; this package is responsible only for its own integration code.
|
|
76
|
+
|
|
77
|
+
## Reporting vulnerabilities
|
|
78
|
+
|
|
79
|
+
The repository has GitHub private vulnerability reporting enabled. Submit affected versions, a minimal reproduction, expected impact and remediation suggestions through [Report a vulnerability](https://github.com/yao1145/ReactiveMD/security/advisories/new).
|
|
80
|
+
|
|
81
|
+
Use the private channel to report vulnerability details; remove exploit code, credentials, user data and information about affected deployments from public issues and PRs.
|