Merge branch 'staging' of github.com:cryptpad/cryptpad into staging

This commit is contained in:
yflory 2025-04-14 11:40:53 +02:00
commit 5cd91200b1
4 changed files with 43 additions and 20 deletions

View File

@ -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

View File

@ -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

View File

@ -347,16 +347,27 @@ var factory = function () {
// 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) {

View File

@ -37,15 +37,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) {