Merge remote-tracking branch 'origin/staging' into insert-onlyoffice-api

This commit is contained in:
Wolfgang Ginolas 2025-04-16 11:42:48 +02:00
commit bbea589935
6 changed files with 50 additions and 29 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

@ -327,6 +327,12 @@ app.use(function (req, res, next) {
next();
});
Object.keys(plugins || {}).forEach(name => {
let plugin = plugins[name];
if (!plugin.addHttpEndpoints) { return; }
plugin.addHttpEndpoints(Env, app);
});
// serve custom app content from the customize directory
// useful for testing pages customized with opengraph data
@ -537,12 +543,6 @@ app.use("/block", (req, res, next) => {
next();
});
Object.keys(plugins || {}).forEach(name => {
let plugin = plugins[name];
if (!plugin.addHttpEndpoints) { return; }
plugin.addHttpEndpoints(Env, app);
});
app.use("/customize", Express.static('customize'));
app.use("/customize", Express.static('customize.dist'));
app.use("/customize.dist", Express.static('customize.dist'));

View File

@ -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);
};

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) {