aquasecurity / kube-hunter

Hunt for security weaknesses in Kubernetes clusters
Apache License 2.0
4.66k stars 578 forks source link

Added correct exception handling for discovery of Metadata apis #488

Closed danielsagi closed 2 years ago

danielsagi commented 2 years ago

Description

Following #486 There seems to be an exception risen when requesting AWS metadata server when running under GKE clusters. For some reason exception handling there was lacking, and caught only connection timeout Exceptions.

Now added general except for all metadata api discoveries.

Fixed Issues

Fixes #486

Contribution checklist

CLAassistant commented 2 years ago

CLA assistant check
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.

codecov[bot] commented 2 years ago

Codecov Report

Merging #488 (d513aa7) into main (00eb0df) will increase coverage by 0.08%. The diff coverage is 50.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #488      +/-   ##
==========================================
+ Coverage   64.68%   64.76%   +0.08%     
==========================================
  Files          46       46              
  Lines        2509     2512       +3     
==========================================
+ Hits         1623     1627       +4     
+ Misses        886      885       -1     
Impacted Files Coverage Δ
kube_hunter/modules/discovery/hosts.py 54.01% <50.00%> (+0.74%) :arrow_up:
kube_hunter/core/events/handler.py 90.13% <0.00%> (+0.65%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 00eb0df...d513aa7. Read the comment docs.