aboutsummaryrefslogtreecommitdiffstats
path: root/src/cidschemehandler.cpp
diff options
context:
space:
mode:
authorDanilo M. <danix@danix.xyz>2026-08-02 17:49:48 +0200
committerDanilo M. <danix@danix.xyz>2026-08-02 17:49:48 +0200
commit6d4fcb8fd597c39ba0b7f404e64f500b11b75e1c (patch)
tree415d64e12b7bbc1e4b7f7213ac08bd19d397c422 /src/cidschemehandler.cpp
parent2a10cebcfb978ce7c5f03a97473eafe9bb3d15dd (diff)
downloadqtmaildir-6d4fcb8fd597c39ba0b7f404e64f500b11b75e1c.tar.gz
qtmaildir-6d4fcb8fd597c39ba0b7f404e64f500b11b75e1c.zip
fix: enforce !-free cidPrefix invariant at both concatenation sites
The cid: namespacing scheme (cid:<prefix>!<id>) is only unambiguous because the prefix half is guaranteed free of '!': the first '!' in the result is always the separator, so an attacker-controlled Content-ID containing '!' only extends the id half rather than colliding with a different prefix. That invariant previously existed only as a comment. Add Q_ASSERT_X at both independent call sites that perform this concatenation (CidSchemeHandler::namespacedKey and HtmlBuilder::namespaceCids) so a future prefix generator that violates it traps in debug builds, per Task 5's precedent of not letting one unit's correctness depend silently on another's future behaviour. Since Q_ASSERT compiles out in release, pin the property that actually matters release builds too test: distinct (prefix, id) pairs across a documented "m<index>" prefix set and hostile Content-IDs (containing '!', percent- encoded '!', empty, leading/trailing '!') never collide, and the key always splits at its first '!' back to the exact original prefix.
Diffstat (limited to 'src/cidschemehandler.cpp')
0 files changed, 0 insertions, 0 deletions