mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-08-25 17:55:21 +00:00
Merge pull request #232173 from e1mo/dokuwiki-xss-backport
[22.11] dokuwiki: Backport xss vulnerability fix
This commit is contained in:
39
pkgs/servers/web-apps/dokuwiki/backport-rss-xss-fix.patch
Normal file
39
pkgs/servers/web-apps/dokuwiki/backport-rss-xss-fix.patch
Normal file
@@ -0,0 +1,39 @@
|
||||
diff --git a/inc/parser/xhtml.php b/inc/parser/xhtml.php
|
||||
index 4c2cb78b4..6cc7a9263 100644
|
||||
--- a/inc/parser/xhtml.php
|
||||
+++ b/inc/parser/xhtml.php
|
||||
@@ -1347,15 +1347,11 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
|
||||
$this->doc .= '<li><div class="li">';
|
||||
// support feeds without links
|
||||
$lnkurl = $item->get_permalink();
|
||||
+ $title = html_entity_decode($item->get_title(), ENT_QUOTES, 'UTF-8');
|
||||
if($lnkurl) {
|
||||
- // title is escaped by SimplePie, we unescape here because it
|
||||
- // is escaped again in externallink() FS#1705
|
||||
- $this->externallink(
|
||||
- $item->get_permalink(),
|
||||
- html_entity_decode($item->get_title(), ENT_QUOTES, 'UTF-8')
|
||||
- );
|
||||
+ $this->externallink($item->get_permalink(), $title);
|
||||
} else {
|
||||
- $this->doc .= ' '.$item->get_title();
|
||||
+ $this->doc .= ' '.hsc($item->get_title());
|
||||
}
|
||||
if($params['author']) {
|
||||
$author = $item->get_author(0);
|
||||
@@ -1369,11 +1365,14 @@ class Doku_Renderer_xhtml extends Doku_Renderer {
|
||||
$this->doc .= ' ('.$item->get_local_date($conf['dformat']).')';
|
||||
}
|
||||
if($params['details']) {
|
||||
+ $desc = $item->get_description();
|
||||
+ $desc = strip_tags($desc);
|
||||
+ $desc = html_entity_decode($desc, ENT_QUOTES, 'UTF-8');
|
||||
$this->doc .= '<div class="detail">';
|
||||
if($conf['htmlok']) {
|
||||
$this->doc .= $item->get_description();
|
||||
} else {
|
||||
- $this->doc .= strip_tags($item->get_description());
|
||||
+ $this->doc .= hsc($desc);
|
||||
}
|
||||
$this->doc .= '</div>';
|
||||
}
|
||||
@@ -11,6 +11,15 @@ stdenv.mkDerivation rec {
|
||||
sha256 = "sha256-gtWEtc3kbMokKycTx71XXblkDF39i926uN2kU3oOeVw=";
|
||||
};
|
||||
|
||||
patches = [
|
||||
# Manually backported fix for a high severity vulnerability, allowing to inject
|
||||
# arbitrary HTML and thus cross site scripting via RSS feeds.
|
||||
# For reference see:
|
||||
# https://github.com/dokuwiki/dokuwiki/commit/53df38b0e4465894a67a5890f74a6f5f82e827de
|
||||
# https://huntr.dev/bounties/c6119106-1a5c-464c-94dd-ee7c5d0bece0/
|
||||
./backport-rss-xss-fix.patch
|
||||
];
|
||||
|
||||
preload = writeText "preload.php" ''
|
||||
<?php
|
||||
|
||||
|
||||
Reference in New Issue
Block a user