<table><tr><td style="">martinkostolny updated this revision to Diff 14013.<br />martinkostolny added a comment.
</td><a style="text-decoration: none; padding: 4px 8px; margin: 0 8px 8px; float: right; color: #464C5C; font-weight: bold; border-radius: 3px; background-color: #F7F7F9; background-image: linear-gradient(to bottom,#fff,#f1f0f1); display: inline-block; border: 1px solid rgba(71,87,120,.2);" href="https://phabricator.kde.org/D5394" rel="noreferrer">View Revision</a></tr></table><br /><div><div><p>Thanks for noticing the security issues! And sorry for the pause. Here is an updated diff which should ensure, QFile is using relative path. I've managed to reduce the use of absolute paths to this state - strace (saving privileged example2.txt file inside ~/Downloads):</p>

<div class="remarkup-code-block" style="margin: 12px 0;" data-code-lang="text" data-sigil="remarkup-code-block"><pre class="remarkup-code" style="font: 11px/15px "Menlo", "Consolas", "Monaco", monospace; padding: 12px; margin: 0; background: rgba(71, 87, 120, 0.08);">chdir("/home/kotelnik/Downloads")       = 0
stat("example2.txt", {st_mode=S_IFREG|0640, st_size=1085659, ...}) = 0
getcwd("/home/kotelnik/Downloads", 4096) = 25
getpid()                                = 3343
open("/home/kotelnik/Downloads/example2.txt.TJ3343", O_RDWR|O_CREAT|O_EXCL|O_CLOEXEC, 0600) = 10
fcntl(10, F_SETFD, FD_CLOEXEC)          = 0
lseek(10, 0, SEEK_SET)                  = 0
close(10)                               = 0
open("/tmp/kate.nS3280", O_RDONLY|O_CLOEXEC) = 10
fcntl(10, F_SETFD, FD_CLOEXEC)          = 0
fstat(10, {st_mode=S_IFREG|0600, st_size=1085661, ...}) = 0
open("example2.txt.TJ3343", O_RDWR|O_CREAT|O_CLOEXEC, 0666) = 11
[...]
stat("example2.txt", {st_mode=S_IFREG|0640, st_size=1085659, ...}) = 0
access("example2.txt", R_OK)            = 0
access("example2.txt", W_OK)            = 0
access("example2.txt", X_OK)            = -1 EACCES (Permission denied)
chmod("example2.txt.TJ3343", 0640)      = 0
fchown(11, 33, 33)                      = 0
rename("example2.txt.TJ3343", "example2.txt") = 0</pre></div>

<p>One not-nice part in code is opening and immediately closing the QTemporaryFile (the only use of absolute path). Then tempFile is opened again with relative path and written to like before. I wanted to make use of the convenient way of creating unique temporary filename. Other suggestions are welcome :).</p>

<p>Regarding parallel KAuth actions I didn't manage to understand KAuth code enough to make a fix myself. So there comes 2 bug reports:</p>

<ul class="remarkup-list">
<li class="remarkup-list-item"><a href="https://bugs.kde.org/show_bug.cgi?id=379215" class="remarkup-link" target="_blank" rel="noreferrer">https://bugs.kde.org/show_bug.cgi?id=379215</a></li>
<li class="remarkup-list-item"><a href="https://bugs.kde.org/show_bug.cgi?id=379216" class="remarkup-link" target="_blank" rel="noreferrer">https://bugs.kde.org/show_bug.cgi?id=379216</a></li>
</ul></div></div><br /><div><strong>REPOSITORY</strong><div><div>R39 KTextEditor</div></div></div><br /><div><strong>CHANGES SINCE LAST UPDATE</strong><div><a href="https://phabricator.kde.org/D5394?vs=13621&id=14013" rel="noreferrer">https://phabricator.kde.org/D5394?vs=13621&id=14013</a></div></div><br /><div><strong>REVISION DETAIL</strong><div><a href="https://phabricator.kde.org/D5394" rel="noreferrer">https://phabricator.kde.org/D5394</a></div></div><br /><div><strong>AFFECTED FILES</strong><div><div>src/buffer/katesecuretextbuffer.cpp<br />
src/buffer/katesecuretextbuffer_p.h<br />
src/buffer/katetextbuffer.cpp<br />
src/buffer/katetextbuffer.h</div></div></div><br /><div><strong>To: </strong>martinkostolny, KTextEditor, fvogt<br /><strong>Cc: </strong>elvisangelaccio, aacid, ivan, lbeltrame, fvogt, apol, anthonyfieroni, cullmann, ltoscano, dhaumann, graesslin, davidedmundson, palant, kwrite-devel, dfaure, Frameworks, head7, kfunk, sars<br /></div>