diff --git a/.github/ISSUE_TEMPLATE/bug_resolution.yml b/.github/ISSUE_TEMPLATE/bug_resolution.yml index 474070d59..2d6e98cb5 100644 --- a/.github/ISSUE_TEMPLATE/bug_resolution.yml +++ b/.github/ISSUE_TEMPLATE/bug_resolution.yml @@ -89,13 +89,10 @@ body: label: Version description: What version of CryptPad are you running? options: + - 2025.3.0 - 2024.12.0 - 2024.9.1 - 2024.9.0 - - 2024.6.1 - - 2024.6.0 - - 2024.3.1 - - 2024.3.0 - Other validations: required: true diff --git a/SECURITY.md b/SECURITY.md index 75100dbf0..3cadf5ceb 100644 --- a/SECURITY.md +++ b/SECURITY.md @@ -22,4 +22,5 @@ We do also communicate about this topic on: ## Reporting a Vulnerability -Vulnerabilities can be reported using the GitHub Security interface. You can also send us an email at security@cryptpad.org +Brefore reaching out about a potential vulnerability, ensure it falls within the scope of our project. Please read thoroughly our [whitepaper](https://blog.cryptpad.org/2023/02/02/Whitepaper/) describing our threat model and what we consider acceptable or not security-wise. If you are sure you found a real vulnerability, you can report it using the GitHub Security interface. You can also send us an email at security@cryptpad.org + diff --git a/src/worker/modules/cursor.js b/src/worker/modules/cursor.js index 17fe40cf9..e7aa5840b 100644 --- a/src/worker/modules/cursor.js +++ b/src/worker/modules/cursor.js @@ -12,9 +12,6 @@ const factory = (Util, Constants, Messages = {}, AppConfig = data.AppConfig; }; - - var DEGRADED = AppConfig.degradedLimit || 8; - var convertToUint8 = function (obj) { var l = Object.keys(obj).length; var u = new Uint8Array(l); @@ -59,6 +56,7 @@ const factory = (Util, Constants, Messages = {}, var updateDegraded = function (ctx, wc, chan) { var m = wc.members; + var DEGRADED = AppConfig.degradedLimit || 8; chan.degraded = (m.length-1) >= DEGRADED; ctx.emit('DEGRADED', { degraded: chan.degraded }, chan.clients); }; diff --git a/www/common/media-tag.js b/www/common/media-tag.js index 07c6a6f19..f019df47d 100644 --- a/www/common/media-tag.js +++ b/www/common/media-tag.js @@ -347,16 +347,27 @@ var factory = function (Util) { // Increment a nonce increment: function (N) { - var l = N.length; - while (l-- > 1) { - if (N[l] !== 255) { return void N[l]++; } - - // you don't need to worry about this running out. - // you'd need a REAAAALLY big file - if (l === 0) { throw new Error('E_NONCE_TOO_LARGE'); } - + // start from the last element directly without relying on confusing post-decrement behaviour + let l = N.length - 1; + while (l >= 0) { + // increment the least significant byte unless it's already at its maximum + if (N[l] !== 255) { + N[l] += 1; + return; + } + // if the loop reaches the most significant byte and the above block fails to return + // then the nonce's state-space has been exhausted + if (l === 0) { + throw new Error("E_NONCE_TOO_LARGE"); + } + // otherwise reset the lesser bytes to zero N[l] = 0; + // and proceed to the next more significant byte + l -= 1; } + // the loop body will never be executed if a zero-length nonce is supplied + // this handles that case + throw new Error("E_EMPTY_NONCE"); }, decodePrefix: function (A) { diff --git a/www/file/file-crypto.js b/www/file/file-crypto.js index 6dbaf0de9..622e857e1 100644 --- a/www/file/file-crypto.js +++ b/www/file/file-crypto.js @@ -38,15 +38,29 @@ define([ return new Uint8Array(new Array(24).fill(0)); }; - var increment = function (N) { - var l = N.length; - while (l-- > 1) { - /* our linter suspects this is unsafe because we lack types - but as long as this is only used on nonces, it should be safe */ - if (N[l] !== 255) { return void N[l]++; } - if (l === 0) { throw new Error('E_NONCE_TOO_LARGE'); } + // New version of "increment" from @ansuz + const increment = N => { + // start from the last element directly without relying on confusing post-decrement behaviour + let l = N.length - 1; + while (l >= 0) { + // increment the least significant byte unless it's already at its maximum + if (N[l] !== 255) { + N[l] += 1; + return; + } + // if the loop reaches the most significant byte and the above block fails to return + // then the nonce's state-space has been exhausted + if (l === 0) { + throw new Error("E_NONCE_TOO_LARGE"); + } + // otherwise reset the lesser bytes to zero N[l] = 0; + // and proceed to the next more significant byte + l -= 1; } + // the loop body will never be executed if a zero-length nonce is supplied + // this handles that case + throw new Error("E_EMPTY_NONCE"); }; var joinChunks = function (chunks) {