Skip to content

Commit 4d089ed

Browse files
author
Lauris Kaplinski
committed
Limit maximum expiry to six months from now
1 parent 64cf8bc commit 4d089ed

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

client/CDocSupport.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,8 @@ libcdoc::result_t DDNetworkBackend::sendKey(
237237
QNetworkRequest req(QString::fromStdString(url + "/key-capsules"));
238238
req.setHeader(QNetworkRequest::ContentTypeHeader, QStringLiteral("application/json"));
239239
if (expiry_ts) {
240+
uint64_t expiry = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now() + std::chrono::months(6));
241+
expiry_ts = std::min(expiry_ts, expiry);
240242
req.setRawHeader("x-expiry-time", QDateTime::fromSecsSinceEpoch(expiry_ts).toString(Qt::ISODate).toLatin1());
241243
}
242244
if (!checkConnection()) {

0 commit comments

Comments
 (0)