only allow valid types for doExport

backport of
This commit is contained in:
Barış Soner Uşaklı
2023-07-19 17:51:13 -04:00
parent e9ec1969b5
commit 354c9c2cc1

View File

@@ -64,6 +64,10 @@ module.exports = function (SocketUser) {
};
async function doExport(socket, data, type) {
const validTypes = ['profile', 'posts', 'uploads'];
if (!validTypes.includes(type)) {
throw new Error('[[error:invalid-data]]');
}
if (!socket.uid) {
throw new Error('[[error:invalid-uid]]');
}