cloudsploit icon indicating copy to clipboard operation
cloudsploit copied to clipboard

RangeError: Invalid array length

Open sukuias12 opened this issue 4 years ago • 3 comments

root@ch:/usr/local/scans# ./index.js --config ./config.js --plugin maxPasswordAge

RangeError: Invalid array length at /usr/local/scans/node_modules/tty-table/src/format.js:172:15 at Array.map () at Object.module.exports.wrapCellText (/usr/local/scans/node_modules/tty-table/src/format.js:156:35) at Object.module.exports.buildCell (/usr/local/scans/node_modules/tty-table/src/render.js:287:39) at /usr/local/scans/node_modules/tty-table/src/render.js:171:26 at Array.map () at Object.module.exports.buildRow (/usr/local/scans/node_modules/tty-table/src/render.js:170:13) at /usr/local/scans/node_modules/tty-table/src/render.js:47:24 at Array.map () at Object.module.exports.stringifyData (/usr/local/scans/node_modules/tty-table/src/render.js:46:45)

sukuias12 avatar Sep 16 '20 02:09 sukuias12

Someone from my team has found a workaround - just make the terminal window smaller 😃. Another workaround is to simply use --console=text parameter. I guess there is a bug in the module?

Another curious finding is these cases: In custom plugin I want to completely ignore all UNIX VMs.

if (windowsImg) {
   if (antiMalware) {
      helpers.addResult(results, 0, 'Endpoint protection is installed on the virtual machine', location, vm.id);
   } else {
      helpers.addResult(results, 2, 'Endpoint protection is not installed on the virtual machine', location, vm.id);
   }
}

Therefore after I check if the OS is MS based I want to output this which causes RangeError:

helpers.addResult(results, 0, 'No Windows Virtual Machine found', location);

but for some reason providing resource id doesn't:

helpers.addResult(results, 0, 'No Windows Virtual Machine found', location, , vm.id);

Just to clarify. In all cases the results object was correctly filled out and not null.

MxRay avatar Dec 03 '20 10:12 MxRay

Any updates on this one?

brainbug89 avatar Feb 17 '21 16:02 brainbug89

Also seeing this error when attempting to run several other aws modules e.g. ./index.js --plugin ebsSnapshotPublic ./index.js --plugin excessiveSecurityGroups

/home/user/development/cloudsploit/node_modules/tty-table/src/format.js:172
            + Array(padBoth + 1 + padRemainder).join(" ")
              ^
RangeError: Invalid array length
    at string.split.map.line (/home/user/development/cloudsploit/node_modules/tty-table/src/format.js:172:15)
    at Array.map (<anonymous>)
    at Object.module.exports.wrapCellText (/home/user/development/cloudsploit/node_modules/tty-table/src/format.js:156:35)
    at Object.module.exports.buildCell (/home/user/development/cloudsploit/node_modules/tty-table/src/render.js:287:39)
    at row.map (/home/user/development/cloudsploit/node_modules/tty-table/src/render.js:171:26)
    at Array.map (<anonymous>)
    at Object.module.exports.buildRow (/home/user/development/cloudsploit/node_modules/tty-table/src/render.js:170:13)
    at sections.header.config.table.header.map.row (/home/user/development/cloudsploit/node_modules/tty-table/src/render.js:47:24)
    at Array.map (<anonymous>)
    at Object.module.exports.stringifyData (/home/user/development/cloudsploit/node_modules/tty-table/src/render.js:46:45)

andromeda306 avatar Mar 16 '21 07:03 andromeda306