perform extra validation for private message rpc

pull/1/head
ansuz 3 years ago
parent 6e9fc243f0
commit d2852fdba4

@ -258,6 +258,11 @@ Channel.writePrivateMessage = function (Env, args, _cb, Server, netfluxId) {
return void cb('METADATA_ERR'); return void cb('METADATA_ERR');
} }
// treat the broadcast channel as write-protected
if (channelId.length === HK.ADMIN_CHANNEL_LENGTH) {
metadata.restricted = true;
}
if (!metadata || !metadata.restricted) { if (!metadata || !metadata.restricted) {
return; return;
} }
@ -265,10 +270,6 @@ Channel.writePrivateMessage = function (Env, args, _cb, Server, netfluxId) {
var session = HK.getNetfluxSession(Env, netfluxId); var session = HK.getNetfluxSession(Env, netfluxId);
var allowed = HK.listAllowedUsers(metadata); var allowed = HK.listAllowedUsers(metadata);
// Special broadcast channel
if (channelId.length === HK.ADMIN_CHANNEL_LENGTH) {
allowed = Env.admins;
}
if (HK.isUserSessionAllowed(allowed, session)) { return; } if (HK.isUserSessionAllowed(allowed, session)) { return; }

Loading…
Cancel
Save