Skip to content

Commit 1562c6f

Browse files
authored
Use static nums for role elevation check (#1137)
* I never have liked this test and mathematical calc... it's just asking for a security breach if there is an error somewhere else * Set to static numbers... we have static numbers all over the place so continue to use these Applies to #1109 and #1107 Auto-merge
1 parent 4143501 commit 1562c6f

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

controllers/scriptStorage.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1337,7 +1337,7 @@ exports.storeScript = function (aUser, aMeta, aBuf, aCallback, aUpdate) {
13371337
}
13381338

13391339
// Check for role change and modify accordingly
1340-
if (aUser.role === userRoles.length - 1) {
1340+
if (aUser.role === 5) {
13411341
if (!aUser.save) {
13421342
// Probably using req.session.user which may have gotten serialized.
13431343
userDoc = aUser;
@@ -1352,7 +1352,7 @@ exports.storeScript = function (aUser, aMeta, aBuf, aCallback, aUpdate) {
13521352
return;
13531353
}
13541354

1355-
--aUser.role;
1355+
aUser.role = 4;
13561356
aUser.save(function (aErr, aUser) {
13571357
if (aErr) {
13581358
console.warn('MongoDB User save warning error\n' +
@@ -1365,7 +1365,7 @@ exports.storeScript = function (aUser, aMeta, aBuf, aCallback, aUpdate) {
13651365
});
13661366
});
13671367
} else {
1368-
--aUser.role;
1368+
aUser.role = 4;
13691369
aUser.save(function (aErr, aUser) {
13701370
if (aErr) {
13711371
console.warn('MongoDB User save warning error\n' +

0 commit comments

Comments
 (0)