Fix team access list issue #1972

This commit is contained in:
yflory 2025-07-21 17:16:27 +02:00
parent 5aa8dfad51
commit d8cd653b08
5 changed files with 14 additions and 1 deletions

View File

@ -107,6 +107,10 @@ HK.authenticateNetfluxSession = function (Env, netfluxId, unsafeKey) {
var user = Env.netfluxUsers[netfluxId] = Env.netfluxUsers[netfluxId] || {};
user[unsafeKey] = +new Date();
};
HK.unauthenticateNetfluxSession = function (Env, netfluxId, unsafeKey) {
var user = Env.netfluxUsers[netfluxId] = Env.netfluxUsers[netfluxId] || {};
delete user[unsafeKey];
};
HK.closeNetfluxSession = function (Env, netfluxId) {
delete Env.netfluxUsers[netfluxId];

View File

@ -72,6 +72,7 @@ const AUTHENTICATED_USER_SCOPED = {
REMOVE_PINS: Pinning.removePins,
TRIM_PINS: Pinning.trimPins,
COOKIE: Core.haveACookie,
DESTROY: () => {}
};
var isAuthenticatedCall = function (call) {
@ -190,6 +191,11 @@ var rpc = function (Env, Server, userId, data, respond) {
if (command === 'COOKIE' && !hadSession && Env.logIP) {
Env.Log.info('NEW_RPC_SESSION', {userId: userId, publicKey: publicKey});
}
if (command === "DESTROY") {
HK.unauthenticateNetfluxSession(Env, userId, publicKey);
return; // No need to respond, user will close the session
}
HK.authenticateNetfluxSession(Env, userId, publicKey);
return void handleAuthenticatedMessage(Env, publicKey, msg, respond, Server);
});

View File

@ -264,6 +264,8 @@ var factory = function (Util, Nacl) {
clearTimeout(to);
});
ctx.send('DESTROY', "", function () {});
// remove the ctx from the network's stack
var idx = networkContext.authenticated.indexOf(ctx);
if (idx === -1) { return; }

View File

@ -107,6 +107,7 @@ const factory = (Util, Hash, Constants, Realtime, ProxyManager,
try { team.roster.stop(); } catch (e) {}
team.proxy = {};
team.stopped = true;
team?.rpc?.destroy();
delete ctx.teams[teamId];
delete ctx.cache[teamId];
delete ctx.store.proxy.teams[teamId];

File diff suppressed because one or more lines are too long