Control: 3.2.2 Ensure packages are automatically scanned for known vulnerabilities
Description
Automatically scan every package for vulnerabilities.
Rationale
Automatic scanning for vulnerabilities detects known vulnerabilities in packages and dependencies in use, allowing faster patching when one is found. Such vulnerabilities can lead to a massive breach if not handled as fast as possible, as attackers will also know about those vulnerabilities and swiftly try to take advantage of them. Scanning packages regularly for vulnerabilities can also verify usage compliance with the organization’s security policy.
Audit
Ensure automatic scanning of packages for vulnerabilities is enabled.
Remediation
Set automatic scanning of packages for vulnerabilities.
Usage
Run the control in your terminal:
powerpipe control run github_compliance.control.cis_supply_chain_v100_3_2_2
Snapshot and share results via Turbot Pipes:
powerpipe loginpowerpipe control run github_compliance.control.cis_supply_chain_v100_3_2_2 --share
SQL
This control uses a named query:
with repositories as ( select name_with_owner, url from github_my_repository order by name_with_owner),pipelines as ( select name, repository_full_name, pipeline from github_workflow where repository_full_name in (select name_with_owner from repositories)),vulnerability_task_repos as ( select distinct p.repository_full_name from pipelines as p, jsonb_array_elements(pipeline -> 'jobs') as job, jsonb_array_elements(job -> 'steps') as step where step ->> 'type' = 'task' and (step -> 'task' ->> 'name')::text in ( 'argonsecurity/scanner-action', 'aquasecurity/trivy-action' ))select -- Required Columns r.url as resource, case when v.repository_full_name is null then 'alarm' else 'ok' end as status, case when v.repository_full_name is null then 'Automated vulnerabilities scanning is not set for pipelines.' else 'Automated vulnerabilities scanning is set for pipelines.' end as reason, -- Additional Dimensions r.name_with_ownerfrom repositories as r left join vulnerability_task_repos as v on r.name_with_owner = v.repository_full_name;