1 |
commit: 75a72fe24a730420ec692367e4e108d4a0a6d617 |
2 |
Author: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org> |
3 |
AuthorDate: Mon Sep 10 20:33:04 2018 +0000 |
4 |
Commit: Andreas Sturmlechner <asturm <AT> gentoo <DOT> org> |
5 |
CommitDate: Mon Sep 10 20:38:03 2018 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=75a72fe2 |
7 |
|
8 |
kde-apps/okular: Fix path traversal issue when extracting .okular file |
9 |
|
10 |
With a specially crafted .okular files it was possible to trick okular |
11 |
to create temporary files outside the temporary folder. |
12 |
|
13 |
Bug: https://bugs.gentoo.org/665662 |
14 |
KDE-Bug: https://bugs.kde.org/show_bug.cgi?id=398096 |
15 |
See also: https://phabricator.kde.org/D15192 |
16 |
Package-Manager: Portage-2.3.49, Repoman-2.3.10 |
17 |
|
18 |
.../okular-18.04.3-path-traversal-issue.patch | 46 +++++++++ |
19 |
kde-apps/okular/okular-18.04.3-r1.ebuild | 106 +++++++++++++++++++++ |
20 |
2 files changed, 152 insertions(+) |
21 |
|
22 |
diff --git a/kde-apps/okular/files/okular-18.04.3-path-traversal-issue.patch b/kde-apps/okular/files/okular-18.04.3-path-traversal-issue.patch |
23 |
new file mode 100644 |
24 |
index 00000000000..216f235d864 |
25 |
--- /dev/null |
26 |
+++ b/kde-apps/okular/files/okular-18.04.3-path-traversal-issue.patch |
27 |
@@ -0,0 +1,46 @@ |
28 |
+From 8ff7abc14d41906ad978b6bc67e69693863b9d47 Mon Sep 17 00:00:00 2001 |
29 |
+From: Albert Astals Cid <aacid@×××.org> |
30 |
+Date: Mon, 3 Sep 2018 21:14:30 +0200 |
31 |
+Subject: Fix path traversal issue when extracting an .okular file |
32 |
+ |
33 |
+Summary: |
34 |
+With specially crafted .okular files you can trick okular to create temporary files outside the temporary folder |
35 |
+ |
36 |
+We fix that by making sure the file doesn't have folders since the ones we create don't |
37 |
+ |
38 |
+BUGS: 398096 |
39 |
+ |
40 |
+Subscribers: okular-devel |
41 |
+ |
42 |
+Tags: #okular |
43 |
+ |
44 |
+Differential Revision: https://phabricator.kde.org/D15192 |
45 |
+--- |
46 |
+ core/document.cpp | 12 ++++++++++++ |
47 |
+ 1 file changed, 12 insertions(+) |
48 |
+ |
49 |
+diff --git a/core/document.cpp b/core/document.cpp |
50 |
+index 5e3c169..7d46173 100644 |
51 |
+--- a/core/document.cpp |
52 |
++++ b/core/document.cpp |
53 |
+@@ -4819,6 +4819,18 @@ ArchiveData *DocumentPrivate::unpackDocumentArchive( const QString &archivePath |
54 |
+ return nullptr; |
55 |
+ |
56 |
+ const KArchiveDirectory * mainDir = okularArchive.directory(); |
57 |
++ |
58 |
++ // Check the archive doesn't have folders, we don't create them when saving the archive |
59 |
++ // and folders mean paths and paths mean path traversal issues |
60 |
++ for ( const QString &entry : mainDir->entries() ) |
61 |
++ { |
62 |
++ if ( mainDir->entry( entry )->isDirectory() ) |
63 |
++ { |
64 |
++ qWarning() << "Warning: Found a directory inside" << archivePath << " - Okular does not create files like that so it is most probably forged."; |
65 |
++ return nullptr; |
66 |
++ } |
67 |
++ } |
68 |
++ |
69 |
+ const KArchiveEntry * mainEntry = mainDir->entry( QStringLiteral("content.xml") ); |
70 |
+ if ( !mainEntry || !mainEntry->isFile() ) |
71 |
+ return nullptr; |
72 |
+-- |
73 |
+cgit v0.11.2 |
74 |
|
75 |
diff --git a/kde-apps/okular/okular-18.04.3-r1.ebuild b/kde-apps/okular/okular-18.04.3-r1.ebuild |
76 |
new file mode 100644 |
77 |
index 00000000000..f802a174ab1 |
78 |
--- /dev/null |
79 |
+++ b/kde-apps/okular/okular-18.04.3-r1.ebuild |
80 |
@@ -0,0 +1,106 @@ |
81 |
+# Copyright 1999-2018 Gentoo Foundation |
82 |
+# Distributed under the terms of the GNU General Public License v2 |
83 |
+ |
84 |
+EAPI=6 |
85 |
+ |
86 |
+KDE_HANDBOOK="forceoptional" |
87 |
+KDE_TEST="forceoptional" |
88 |
+VIRTUALX_REQUIRED="test" |
89 |
+inherit kde5 |
90 |
+ |
91 |
+DESCRIPTION="Universal document viewer based on KDE Frameworks" |
92 |
+HOMEPAGE="https://okular.kde.org https://www.kde.org/applications/graphics/okular" |
93 |
+KEYWORDS="~amd64 ~x86" |
94 |
+IUSE="chm crypt djvu epub +image-backend markdown mobi mobile +pdf plucker +postscript share speech +tiff" |
95 |
+ |
96 |
+DEPEND=" |
97 |
+ $(add_frameworks_dep kactivities) |
98 |
+ $(add_frameworks_dep karchive) |
99 |
+ $(add_frameworks_dep kbookmarks) |
100 |
+ $(add_frameworks_dep kcompletion) |
101 |
+ $(add_frameworks_dep kconfig) |
102 |
+ $(add_frameworks_dep kconfigwidgets) |
103 |
+ $(add_frameworks_dep kcoreaddons) |
104 |
+ $(add_frameworks_dep kcrash) |
105 |
+ $(add_frameworks_dep kio) |
106 |
+ $(add_frameworks_dep kjs) |
107 |
+ $(add_frameworks_dep kparts) |
108 |
+ $(add_frameworks_dep kpty) |
109 |
+ $(add_frameworks_dep kwallet) |
110 |
+ $(add_frameworks_dep threadweaver) |
111 |
+ $(add_qt_dep qtdbus) |
112 |
+ $(add_qt_dep qtgui) |
113 |
+ $(add_qt_dep qtprintsupport) |
114 |
+ $(add_qt_dep qtsvg) |
115 |
+ $(add_qt_dep qtwidgets) |
116 |
+ media-libs/freetype |
117 |
+ media-libs/phonon[qt5(+)] |
118 |
+ sys-libs/zlib |
119 |
+ chm? ( |
120 |
+ $(add_frameworks_dep khtml) |
121 |
+ dev-libs/chmlib |
122 |
+ ) |
123 |
+ crypt? ( app-crypt/qca:2[qt5(+)] ) |
124 |
+ djvu? ( app-text/djvu ) |
125 |
+ epub? ( app-text/ebook-tools ) |
126 |
+ image-backend? ( |
127 |
+ $(add_kdeapps_dep libkexiv2) |
128 |
+ $(add_qt_dep qtgui 'gif,jpeg,png') |
129 |
+ ) |
130 |
+ markdown? ( app-text/discount ) |
131 |
+ mobi? ( $(add_kdeapps_dep kdegraphics-mobipocket) ) |
132 |
+ pdf? ( app-text/poppler[qt5] ) |
133 |
+ plucker? ( virtual/jpeg:0 ) |
134 |
+ postscript? ( app-text/libspectre ) |
135 |
+ share? ( $(add_frameworks_dep purpose) ) |
136 |
+ speech? ( $(add_qt_dep qtspeech) ) |
137 |
+ tiff? ( media-libs/tiff:0 ) |
138 |
+" |
139 |
+RDEPEND="${DEPEND} |
140 |
+ image-backend? ( $(add_frameworks_dep kimageformats) ) |
141 |
+ mobile? ( |
142 |
+ $(add_frameworks_dep kirigami) |
143 |
+ $(add_qt_dep qtquickcontrols) |
144 |
+ ) |
145 |
+" |
146 |
+ |
147 |
+PATCHES=( |
148 |
+ "${FILESDIR}/${PN}-tests.patch" |
149 |
+ "${FILESDIR}/${P}-path-traversal-issue.patch" |
150 |
+) |
151 |
+ |
152 |
+src_prepare() { |
153 |
+ kde5_src_prepare |
154 |
+ use mobile || cmake_comment_add_subdirectory mobile |
155 |
+ use test || cmake_comment_add_subdirectory conf/autotests |
156 |
+} |
157 |
+ |
158 |
+src_configure() { |
159 |
+ local mycmakeargs=( |
160 |
+ $(cmake-utils_use_find_package chm CHM) |
161 |
+ $(cmake-utils_use_find_package crypt Qca-qt5) |
162 |
+ $(cmake-utils_use_find_package djvu DjVuLibre) |
163 |
+ $(cmake-utils_use_find_package epub EPub) |
164 |
+ $(cmake-utils_use_find_package image-backend KF5KExiv2) |
165 |
+ $(cmake-utils_use_find_package markdown Discount) |
166 |
+ $(cmake-utils_use_find_package mobi QMobipocket) |
167 |
+ $(cmake-utils_use_find_package pdf Poppler) |
168 |
+ $(cmake-utils_use_find_package plucker JPEG) |
169 |
+ $(cmake-utils_use_find_package postscript LibSpectre) |
170 |
+ $(cmake-utils_use_find_package share KDEExperimentalPurpose) |
171 |
+ $(cmake-utils_use_find_package speech Qt5TextToSpeech) |
172 |
+ $(cmake-utils_use_find_package tiff TIFF) |
173 |
+ ) |
174 |
+ |
175 |
+ kde5_src_configure |
176 |
+} |
177 |
+ |
178 |
+src_test() { |
179 |
+ # mainshelltest hangs, chmgeneratortest fails, bug #603116 |
180 |
+ # parttest hangs, bug #641728 |
181 |
+ local myctestargs=( |
182 |
+ -E "(mainshelltest|chmgeneratortest|parttest)" |
183 |
+ ) |
184 |
+ |
185 |
+ kde5_src_test |
186 |
+} |