Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions UPGRADING.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ writes nothing.
`GET /api/v2/documents/{docId}/similar`, new in 15.10, answers `400 invalid_request` unless
`api.search.similar=true`.

**Chat answers carry no images.** The `html_content` of a chat answer (`done` event of
`/api/v2/chat/stream`) no longer keeps `<img>` elements, whether the model wrote them as Markdown or as HTML.
The bundled theme already left them out. A client of its own that showed them now shows the text without the
image.

**The admin console no longer ships Bootstrap, AdminLTE, jQuery, Popper, moment.js, the date/time pickers or
the form validator.** Fess 15.9.0 loaded them from `css/admin/` and `js/admin/`. The console now uses its own
`css/admin/admin.css` and `js/admin/admin.js` (plain JavaScript), Font Awesome 7 Free under
Expand Down
6 changes: 1 addition & 5 deletions src/main/java/org/codelibs/fess/helper/MarkdownRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,7 @@ public void init() {
.allowAttributes("href")
.onElements("a")
.requireRelNofollowOnLinks()
// Images - only allow http/https protocols
.allowElements("img")
.allowUrlProtocols("http", "https")
.allowAttributes("src", "alt", "title")
.onElements("img")
// No images: the browser would load them as soon as it shows the answer
// Span and div for formatting
.allowElements("span", "div")
// Class attributes for styling code blocks
Expand Down
11 changes: 11 additions & 0 deletions src/test/java/org/codelibs/fess/helper/MarkdownRendererTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,17 @@ public void test_render_xss_imgOnerror() {
assertFalse(result.contains("onerror"));
}

/** A browser loads an image as soon as it shows the answer, from whatever address the answer names. */
@Test
public void test_render_imageIsNotLoadedFromTheAnswer() {
final String result =
markdownRenderer.render("See ![chart](https://example.com/c.png) and <img src=\"https://example.com/d.png\">");

assertFalse(result.contains("<img"), result);
assertFalse(result.contains("example.com"), result);
assertTrue(result.contains("See"), result);
}

@Test
public void test_render_xss_iframeTag() {
String malicious = "<iframe src=\"http://evil.com\"></iframe>";
Expand Down
Loading