ensure pluginDone is called under all circumstances
Fixes #552, Fixes #557
The implementation of async.mapValuesLimit in engine.collector fails to resolve all of the asynchronous functions. This prevents the callback function from executing, which means outputHandler.close() never gets called. That means output is never written to the console, nor saved to JSON.
If we move the call to pluginDone out of the if statement, it is called under all circumstances, ensuring we get proper output.
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.
I think the test case for accessKeysRotated is prone to false negative. The test spec is initialized with:
warnDate.setMonth(warnDate.getMonth() - 3);
and the plugin makes its determination based on > (not >=):
if (helpers.daysAgo(userCreationTime) > config.access_keys_rotated_warn
which means the warnDate in the test case won't actually generate a warning since it's exactly 90 days old. If you change the test spec to, e.g.
warnDate.setMonth(warnDate.getMonth() - 4);
the test passes