Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ansible Playbook with empty tasks level causes python exception and abnormal exit. #6744

Open
mystery-rabbit opened this issue Sep 30, 2024 · 0 comments
Labels

Comments

@mystery-rabbit
Copy link

Describe the issue
A valid playbook with an empty tasks section will cause a python exception and subsequently an abnormal exit for Checkov. An example for this is a simple playbook that calls a role. This is a valid ansible playbook, works in ansible, and is seen as valid by ansible-lint.

Examples

A Playbook of:

---
- name: Using a Role
  hosts: all
  roles:
    - role: somerolename
  tasks:

will cause a python exception: (trimmed)

...
File "./venv/lib/python3.10/site-packages/checkov/ansible/utils.py", line 144, in build_definitions_context
    for task in code_block[ResourceType.TASKS]:
TypeError: 'NoneType' object is not iterable

Exception Trace
debug_checkov.txt

Attached

Desktop (please complete the following information):

  • OS: Linux, Ubuntu 22.04,
  • Checkov Version 3.2.255

Additional context
none.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant