Closed baltpeter closed 4 years ago
Good catch! I think that the best approach here is just issuing a warning hinting for manual review, just as you designed. I'll merge this to master now, but it will ship with v1.6.1 as soon as we fix something major like #62. Thanks again for the PR :)
The
AvailableSecurityFixesGlobalCheck
was failing if it encountered an unknown Electron release. The bug is in this code:https://github.com/doyensec/electronegativity/blob/7cfc8d3e12cb6f70deb1c26c56b1ef15aaa9e4a2/src/finder/checks/GlobalChecks/AvailableSecurityFixesGlobalCheck.js#L58-L60
This assumes that we can always find a
latestRelease
, which isn't necessarily the case leading to an unhandled promise rejection.As an example of this bug:
git clone https://github.com/zadam/trilium.git
electronegativity -i trilium
Instead of producing a result, Electronegativity fails with the following error:
This PR fixes that bug by only executing the remaining check code if we did in fact find a
latestRelease
. Otherwise, we inform the user and report available security fixes with a tentative confidence.To do so, the
checkSecurityFixes()
function now returns a confidence instead oftrue
in case of potential available fixes.I was thinking of reporting an error in this cases but if I understand your code correctly, those are only meant for parser errors. And if we cannot update the releases list, we only fail with a warning as well, so this approach seems reasonable to me. Let me know, if you prefer a different apporach, though.