Extend checks during received data decompression
Implement zip bomb protection aligned with Qt Network's
QDecompressHelper approach:
- Once decompressed output exceeds 10 MB (DecompressedSafetyCheckThreshold),
check the compression ratio. If it exceeds 40:1 for gzip/deflate,
abort decompression as a potential archive bomb.
This allows legitimate large responses with normal compression ratios
to pass through, while catching pathological payloads early.
Additionally:
- Pass 'safetyThresholdSize' to parseResponse() for all
response types (not just file responses), closing a gap where JSON/XML
responses had no protection.
- Add setSafetyDecompressedThresholdSize() and
safetyDecompressedThresholdSize() APIs to make the safety threshold
size configurable.
- Add test cases verifying a new logic of the ratio-based bomb
detection.
Task-number: QTBUG-147739
Pick-to: 6.12
Change-Id: I6bbedd8d4e25d47b85ae8c98ecfdb8c0900dc932
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
| commit | 3fae11f843b9801df7df34684d174cacf1f57cfd |
| parent | 13fe665b5f80e5f013ea934070966a5af6b58a94 |
| author | Tatiana Borisova <tatiana.borisova@qt.io> |
| committer | Tatiana Borisova <tatiana.borisova@qt.io> |
| commit time | Sat, 11 Jul 2026 13:33:22 +0000 |
- M src/tools/qtopenapi-generator/src/main/resources/cpp-qt6-client/api-body.mustache
- M src/tools/qtopenapi-generator/src/main/resources/cpp-qt6-client/common/api-base-body.mustache
- M src/tools/qtopenapi-generator/src/main/resources/cpp-qt6-client/common/api-base-header.mustache
- M src/tools/qtopenapi-generator/src/main/resources/cpp-qt6-client/common/httprequest.cpp.mustache
- M src/tools/qtopenapi-generator/src/main/resources/cpp-qt6-client/common/httprequest.h.mustache
- M tests/auto/compression/client/tst_compression/tst_compression.cpp
- M tests/auto/qtopenapigen/client/openapigen/data/cmake_generated/clienttest/client/petapi.cpp
- M tests/auto/qtopenapigen/client/openapigen/data/cmake_generated/clienttest/client/storeapi.cpp
- M tests/auto/qtopenapigen/client/openapigen/data/cmake_generated/clienttest/client/userapi.cpp
- M tests/auto/qtopenapigen/client/openapigen/data/cmake_generated/commonlibtest/common/qoaibaseapi.cpp
- M tests/auto/qtopenapigen/client/openapigen/data/cmake_generated/commonlibtest/common/qoaibaseapi.h
- M tests/auto/qtopenapigen/client/openapigen/data/cmake_generated/commonlibtest/common/qoaihttprequest.cpp
- M tests/auto/qtopenapigen/client/openapigen/data/cmake_generated/commonlibtest/common/qoaihttprequest.h