From 0e84a94146120011f1b259969123fa0070c0440f Mon Sep 17 00:00:00 2001 From: Joseph Schorr Date: Tue, 29 Mar 2016 15:16:22 -0400 Subject: [PATCH] Make analyzer handle images without features or vulnerabilities --- util/secscan/analyzer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/util/secscan/analyzer.py b/util/secscan/analyzer.py index 28352bdea..0558ba808 100644 --- a/util/secscan/analyzer.py +++ b/util/secscan/analyzer.py @@ -113,7 +113,7 @@ class LayerAnalyzer(object): if layer_data is not None: # Dispatch events for any detected vulnerabilities logger.debug('Got data for layer %s: %s', layer.id, layer_data) - found_features = layer_data['Layer']['Features'] + found_features = layer_data['Layer'].get('Features', []) for repository_id in repository_map: tags = repository_map[repository_id] @@ -121,7 +121,7 @@ class LayerAnalyzer(object): if 'Vulnerabilities' not in feature: continue - for vulnerability in feature['Vulnerabilities']: + for vulnerability in feature.get('Vulnerabilities', []): event_data = { 'tags': [tag.name for tag in tags], 'vulnerability': {