anchore / anchore-engine

A service that analyzes docker images and scans for vulnerabilities
Apache License 2.0
1.58k stars 273 forks source link

Image metadata is lost when syft output is imported and not artifacts were found #969

Open thehh1974 opened 3 years ago

thehh1974 commented 3 years ago

Is this a request for help?: No

Is this a BUG REPORT or a FEATURE REQUEST? (choose one): BUG REPORT

Version of Anchore Engine and Anchore CLI if applicable: 0.9.2

What happened: Missing metadata on images analyzed with Syft without any artifacts.

What did you expect to happen: Still get information about distro and layers. Any relevant log output from /var/log/anchore: Analyzer log: [service:worker] 2021-04-13 11:37:46+0000 [-] [Thread-28291] [anchore_engine.common.helpers/extract_analyzer_content()] [ERROR] could not extract/parse content info - exception: 'package_list' [service:worker] 2021-04-13 11:37:46+0000 [-] [Thread-28291] [anchore_engine.services.analyzer.analysis/store_analysis_results()] [WARN] ERR: 'package_list' [service:worker] 2021-04-13 11:37:46+0000 [-] [Thread-28291] [anchore_engine.common.helpers/extract_analyzer_content()] [ERROR] could not extract/parse content info - exception: could not extract/parse content info - exception: 'file_checksums' [service:worker] 2021-04-13 11:37:46+0000 [-] [Thread-28291] [anchore_engine.services.analyzer.analysis/store_analysis_results()] [WARN] ERR: could not extract/parse content info - exception: 'file_checksums' [service:worker] 2021-04-13 11:37:46+0000 [-] [Thread-28291] [anchore_engine.common.helpers/extract_analyzer_content()] [ERROR] could not extract/parse content info - exception: 'package_list' [service:worker] 2021-04-13 11:37:46+0000 [-] [Thread-28291] [anchore_engine.services.analyzer.analysis/store_analysis_results()] [WARN] ERR: 'package_list' [service:worker] 2021-04-13 11:37:46+0000 [-] [Thread-28291] [anchore_engine.common.helpers/extract_analyzer_content()] [ERROR] could not extract/parse content info - exception: 'package_list' [service:worker] 2021-04-13 11:37:46+0000 [-] [Thread-28291] [anchore_engine.services.analyzer.analysis/store_analysis_results()] [WARN] ERR: 'package_list' [service:worker] 2021-04-13 11:37:46+0000 [-] [Thread-28291] [anchore_engine.common.helpers/extract_analyzer_content()] [ERROR] could not extract/parse content info - exception: 'package_list' [service:worker] 2021-04-13 11:37:46+0000 [-] [Thread-28291] [anchore_engine.services.analyzer.analysis/store_analysis_results()] [WARN] ERR: 'package_list' [service:worker] 2021-04-13 11:37:46+0000 [-] [Thread-28291] [anchore_engine.common.helpers/extract_analyzer_content()] [ERROR] could not extract/parse content info - exception: 'package_list' [service:worker] 2021-04-13 11:37:46+0000 [-] [Thread-28291] [anchore_engine.services.analyzer.analysis/store_analysis_results()] [WARN] ERR: 'package_list' [service:worker] 2021-04-13 11:37:46+0000 [-] [Thread-28291] [anchore_engine.common.helpers/extract_analyzer_content()] [ERROR] could not extract/parse content info - exception: 'package_list' [service:worker] 2021-04-13 11:37:46+0000 [-] [Thread-28291] [anchore_engine.services.analyzer.analysis/store_analysis_results()] [WARN] ERR: 'package_list' [service:worker] 2021-04-13 11:37:46+0000 [-] [Thread-28291] [anchore_engine.common.helpers/extract_analyzer_content()] [ERROR] could not extract/parse content info - exception: 'package_list' [service:worker] 2021-04-13 11:37:46+0000 [-] [Thread-28291] [anchore_engine.services.analyzer.analysis/store_analysis_results()] [WARN] ERR: 'package_list' [service:worker] 2021-04-13 11:37:46+0000 [-] [Thread-28291] [anchore_engine.common.helpers/extract_analyzer_content()] [ERROR] could not extract/parse content info - exception: 'package_list' [service:worker] 2021-04-13 11:37:46+0000 [-] [Thread-28291] [anchore_engine.services.analyzer.analysis/store_analysis_results()] [WARN] ERR: 'package_list' [service:worker] 2021-04-13 11:37:46+0000 [-] [Thread-28291] [anchore_engine.common.helpers/extract_analyzer_content()] [ERROR] could not extract/parse content info - exception: 'package_list' [service:worker] 2021-04-13 11:37:46+0000 [-] [Thread-28291] [anchore_engine.services.analyzer.analysis/store_analysis_results()] [WARN] ERR: 'package_list' [service:worker] 2021-04-13 11:37:46+0000 [-] [Thread-28291] [anchore_engine.common.helpers/extract_analyzer_content()] [ERROR] could not extract/parse content info - exception: 'package_list' [service:worker] 2021-04-13 11:37:46+0000 [-] [Thread-28291] [anchore_engine.services.analyzer.analysis/store_analysis_results()] [WARN] ERR: 'package_list' [service:worker] 2021-04-13 11:37:46+0000 [-] [Thread-28291] [anchore_engine.services.analyzer.analysis/store_analysis_results()] [INFO] Adding image content data to archive [service:worker] 2021-04-13 11:37:46+0000 [-] [Thread-28291] [anchore_engine.common.helpers/extract_analyzer_content()] [ERROR] could not extract/parse content info - exception: 'package_list' [service:worker] 2021-04-13 11:37:46+0000 [-] Traceback (most recent call last): [service:worker] 2021-04-13 11:37:46+0000 [-] File "/usr/local/lib/python3.8/site-packages/anchore_engine/services/analyzer/analysis.py", line 548, in store_analysis_results [service:worker] 2021-04-13 11:37:46+0000 [-] helpers.update_image_record_with_analysis_data( [service:worker] 2021-04-13 11:37:46+0000 [-] File "/usr/local/lib/python3.8/site-packages/anchore_engine/common/helpers.py", line 143, in update_image_record_with_analysis_data [service:worker] 2021-04-13 11:37:46+0000 [-] image_summary_data = extract_analyzer_content(image_data, "metadata") [service:worker] 2021-04-13 11:37:46+0000 [-] File "/usr/local/lib/python3.8/site-packages/anchore_engine/common/helpers.py", line 404, in extract_analyzer_content [service:worker] 2021-04-13 11:37:46+0000 [-] raise err [service:worker] 2021-04-13 11:37:46+0000 [-] File "/usr/local/lib/python3.8/site-packages/anchore_engine/common/helpers.py", line 351, in extract_analyzer_content [service:worker] 2021-04-13 11:37:46+0000 [-] in idata["imagedata"]["analysis_report"]["package_list"] [service:worker] 2021-04-13 11:37:46+0000 [-] KeyError: 'package_list' [service:worker] 2021-04-13 11:37:46+0000 [-] [Thread-28291] [anchore_engine.services.analyzer.analysis/store_analysis_results()] [WARN] could not store image content metadata to archive - exception: 'package_list'

What docker images are you using: amd64

How to reproduce the issue: Use syft 0.13.1 to analyze k8s.gcr.io/etcd:3.4.13-0. Syft 0.14 finds a few packages, so the issue does not reproduce.

Anything else we need to know: convert_syft_to_engine handles the cases of busybox and unknown distro, but not the case of known distro and no packages.

zhill commented 3 years ago

Does this result in the import failing or it succeeds but has incorrect data?

thehh1974 commented 3 years ago

Import completes successfully, but no layers or distro info are reported.