tosijs-styled-editor 0.5.1 → 0.5.2
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.md +23 -0
- package/SECURITY.md +2 -1
- package/dist/changes.d.ts +20 -0
- package/dist/index.js +4 -4
- package/dist/module.js +9 -7
- package/dist/version.d.ts +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.5.2] - 2026-09-26
|
|
11
|
+
|
|
12
|
+
### Security
|
|
13
|
+
|
|
14
|
+
- **0.5.1's fix was incomplete: `reviseWith()` could still emit live HTML.**
|
|
15
|
+
The guard that strips `<` and `>` from `changeAuthor` was applied at the four
|
|
16
|
+
write sites in the component and missed the fifth, `mark()` in
|
|
17
|
+
`src/changes.ts` — which is exactly what `reviseWith()` and the exported
|
|
18
|
+
`applyRevision()` go through. So the LLM-proofreading path, documented public
|
|
19
|
+
API, still broke a display name out of a raw-text element and put an
|
|
20
|
+
`<img onerror>` into `editor.value`. Reproduced end to end through the public
|
|
21
|
+
`value` setter and `reviseWith()`, with no host cooperation beyond wiring
|
|
22
|
+
`changeAuthor.name` to a profile name.
|
|
23
|
+
|
|
24
|
+
The guard now lives in `src/changes.ts` beside the only code that writes those
|
|
25
|
+
attributes, and every writer shares it. **A guard belongs at the layer every
|
|
26
|
+
writer shares, not at the addresses where the bug was first noticed** — which
|
|
27
|
+
is precisely the mistake 0.5.1 made.
|
|
28
|
+
|
|
29
|
+
**Upgrade from 0.5.1 as well as from 0.5.0** if you use `trackChanges` or
|
|
30
|
+
`reviseWith`. `SECURITY.md`'s statement in 0.5.1 was true of typing and
|
|
31
|
+
deletion and false of revision.
|
|
32
|
+
|
|
10
33
|
## [0.5.1] - 2026-09-26
|
|
11
34
|
|
|
12
35
|
### Security
|
package/SECURITY.md
CHANGED
|
@@ -38,7 +38,8 @@ and we will find a private channel.
|
|
|
38
38
|
`editor.value`, the form value and every undo snapshot. It is host-supplied and
|
|
39
39
|
inside your trust boundary — but "the host wired it to a profile name" is the
|
|
40
40
|
ordinary case, so the editor does not trust it: `<` and `>` are stripped at the
|
|
41
|
-
seam (fixed in 0.5.
|
|
41
|
+
seam (fully fixed in 0.5.2 — 0.5.0 is affected, and **0.5.1 is still affected
|
|
42
|
+
through `reviseWith()`**, whose write site the first fix missed).
|
|
42
43
|
|
|
43
44
|
They have to be stripped rather than escaped. HTML attribute serialization
|
|
44
45
|
escapes `&` and `"` and **never `<`**, and `style`, `xmp`, `title`, `textarea`,
|
package/dist/changes.d.ts
CHANGED
|
@@ -63,6 +63,26 @@ export declare class TosiIns extends HTMLElement {
|
|
|
63
63
|
export declare class TosiDel extends HTMLElement {
|
|
64
64
|
}
|
|
65
65
|
export declare function defineChanges(): void;
|
|
66
|
+
/**
|
|
67
|
+
* An attribute value that cannot break out of the element it is written into.
|
|
68
|
+
*
|
|
69
|
+
* HTML attribute serialization escapes `&` and `"` and **never `<`**. Inside a
|
|
70
|
+
* raw-text or RCDATA element — `style`, `xmp`, `title`, `textarea`, `noembed`,
|
|
71
|
+
* `noframes`, `plaintext` — the contents re-parse as text, so a `</style>` in
|
|
72
|
+
* an attribute value terminates the element and everything after it parses as
|
|
73
|
+
* markup, and `editor.value` then carries live HTML.
|
|
74
|
+
*
|
|
75
|
+
* This lives HERE, next to the only code that writes these attributes, because
|
|
76
|
+
* the first version of the fix lived in the component and covered four of the
|
|
77
|
+
* five write sites. The fifth was `mark()` below — on the public `reviseWith()`
|
|
78
|
+
* path — so 0.5.1 shipped as the fix for this and was still exploitable
|
|
79
|
+
* through it. A guard belongs at the layer every writer shares, not at the
|
|
80
|
+
* addresses where the bug was first noticed.
|
|
81
|
+
*
|
|
82
|
+
* Stripping, not escaping: no escape survives attribute serialization into a
|
|
83
|
+
* raw-text element.
|
|
84
|
+
*/
|
|
85
|
+
export declare function safeAttributeValue(value: string): string;
|
|
66
86
|
/** Every tracked change in a root, in document order. */
|
|
67
87
|
export declare function changesIn(root: Element): TrackedChange[];
|
|
68
88
|
/**
|