Hi,

I 100% agree with Kai's original suggestion, and it has been my thought as well 
for Qt 7: We should get rid of AutoText completely. The convenience of not 
having to set an explicit text format (one line of code) is debatable, and in 
my opinion nowhere near worth the risk of text fields accidentally being 
exposed to network access. Accidental rich text is always a bug, so it should 
always be explicit.

Given that AutoText is primarily a compatibility option at this point, I don't 
think we should do anything to mightBeRichText() that might change existing 
behavior (or add overhead). It is what it is.

However, I do think we should also consider ways of changing the default in Qt 
6 lifespan. We have to prioritize backwards compatibility, so we can't change 
it unconditionally for everyone. My idea so far has been that we could add 
application profiles which govern how defaults and behavior are chosen. With 
the default "compatibility" profile, backwards compatibility would be the 
priority like before. But for applications explicitly choosing a "security" 
profile, we would be able to change defaults and behavior between releases as 
long as we think it strengthens the security of the application by avoiding 
common pitfalls. Security-sensitive applications would pick this profile and 
accept the extra price of sometimes having to update their code.

I might make a session for this in the Contributor Summit, actually. It would 
be nice to hear if there are other ideas.

--
Eskil Abrahamsen Blomfeldt
Principal Manager, Graphics Engines

The Qt Company
Sandakerveien 116
0484 Oslo, Norway
[email protected]
http://qt.io

Public
________________________________
From: Development <[email protected]> on behalf of Edward 
Welbourne via Development <[email protected]>
Sent: Wednesday, July 29, 2026 10:13 AM
To: Kai Uwe Broulik <[email protected]>; [email protected] 
<[email protected]>
Subject: Re: [Development] Proposal: Disable AutoText in Qt 7

Kai Uwe Broulik (29 July 2026 09:52) wrote:
> Qt has a feature called AutoText where when you have a label (both in Qt
> Widgets and Qt Quick) and its contents “look like HTML”
> (Qt::mightBeRichText) it will switch to rich text (styled text) and
> start interpreting it as HTML.
>
> Just name a file or a Wifi SSID "<h1>hello.txt" and ...

A stray thought prompted by this: Qt::mightBeRichText() uses a fairly
dumb heuristic, just looking for something tag-like before the first
newline.  One potential mitigation would be to relegate that to a
pre-test and have a slightly more stringent test for AutoText, say
looksLikeRichText(), which uses that precheck and, if it passes, does
something closer to a (cheap as we can sensibly make it) check that the
apparent rich-text is well-formed.  For plain text this stays cheap, for
HTML it costs a bit more, but we'd avoid the "mark-up spills out of the
text into other things" issue (assuming we made that the focus of the
approximate-validity check).

I'm not familiar with the relevant infrastructure, though, so perhaps
that increase in cost would be a significant impediment to making such a
change.  If not, would it in fact mitigate the problem you're describing
adequately ?

        Eddy.
--
Development mailing list
[email protected]
https://lists.qt-project.org/listinfo/development
-- 
Development mailing list
[email protected]
https://lists.qt-project.org/listinfo/development

Reply via email to