Prevent HTML injection in labels from unchecked sources
ClosedPublic

Authored by bruns on Nov 10 2019, 5:11 PM.

Details

Summary

Properties from arbitrary sources may contain any character, also
valid Qt richtext (HTML subset) sequences. In best case, this only
causes parsing and display issues, but may also inject malicious links:
<a href="http://malicous.domain/">unconspicious</a>.

The originUrl value is not affected, as QUrl percent-encodes '<' and '>',
thus can not contain any HTML tags. Explicitly cast the originUrl
QVariant to QUrl, which is always valid for values coming from KFileMetadata.

This affects all versions prior to 19.08.00. D21470 accidentally disabled
interactive links in the labels, thus malicious links are disabled.

Depends on D25239

Test Plan
  1. Create a document with e.g. a title resembling HTML tags
  2. Text should be rendered verbatirm

Diff Detail

Repository
R824 Baloo Widgets
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
bruns created this revision.Nov 10 2019, 5:11 PM
Restricted Application added a project: Baloo. · View Herald TranscriptNov 10 2019, 5:11 PM
bruns requested review of this revision.Nov 10 2019, 5:11 PM
bruns added a comment.Nov 10 2019, 5:22 PM

File with unsuspicious looking "nice" link

Exposing the malicous URL, and making it unaccessible.

ngraham accepted this revision.Nov 10 2019, 11:19 PM
This revision is now accepted and ready to land.Nov 10 2019, 11:19 PM
This revision was automatically updated to reflect the committed changes.