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

bug(ansible): not detecting yaml inventory since v1.7.11 #6814

Closed
timo-fc opened this issue Nov 23, 2023 · 5 comments · Fixed by #6816 or #6880
Closed

bug(ansible): not detecting yaml inventory since v1.7.11 #6814

timo-fc opened this issue Nov 23, 2023 · 5 comments · Fixed by #6816 or #6880
Labels
ansible Ansible query bug Something isn't working community Community contribution docker Docker query query New query feature

Comments

@timo-fc
Copy link

timo-fc commented Nov 23, 2023

Since Version 1.7.11 the yaml inventory files are not detected anymore and therefor not scanned.

Expected Behavior

With v1.7.10 I get the expanded behavior
docker run -t -v /path/to/inventory:/path checkmarx/kics:v1.7.10 scan -p /path

`Scanning with Keeping Infrastructure as Code Secure v1.7.10

Preparing Scan Assets: Done
Executing queries: [---------------------------------------------------] 100.00%

Files scanned: 332
Parsed files: 329
Queries loaded: 292
Queries failed to execute: 0`

and e.g., secrets in them are correct detected

Actual Behavior

With v1.7.11 no files are detected
docker run -t -v /path/to/inventory:/path checkmarx/kics:latest scan -p /path
`Scanning with Keeping Infrastructure as Code Secure v1.7.11

Files scanned: 0
Parsed files: 0
Queries loaded: 0
Queries failed to execute: 0`

Steps to Reproduce the Problem

The inventory folder contains multiple yaml files with hosts:
group1.yml

---
# group1
group1:
  hosts:
    host1.tld
    host2.tld

# sub group
sub_group:
  hosts:
    host2.tld

groups:
  children:
    sub_group:
    group1:

and sub folders group_vars and host_vars with yaml files for vars
group_vars/sub_group.yml

---
mysql_innodb_large_prefix: 0
mysql_skip_name_resolve: true
mysql_root_password: 'insecure'

Specifications

  • Version: v1.7.11
  • Platform: host Debian 12
@timo-fc timo-fc added bug Something isn't working community Community contribution labels Nov 23, 2023
@github-actions github-actions bot added query New query feature ansible Ansible query docker Docker query labels Nov 23, 2023
@gabriel-cx
Copy link
Contributor

Hi @timo-fc ,

Thank you for your input!
We are checking the situation and we will provide a fix for it asap.

@timo-fc
Copy link
Author

timo-fc commented Feb 8, 2024

Hello @gabriel-cx sorry for the log delayed response.
The problem still exists in version 1.7.12 with my example playbook.
As fare as I can tell the detection relies on the hierarchy starting with "all:" which is possible but not necessary.

Even the official documentation isn't mentioning it:
https://docs.ansible.com/ansible/latest/inventory_guide/intro_inventory.html#inventory-basics-formats-hosts-and-groups

This file is detected and scanned in 1.7.12

---
all:
  children:
    subgroup:
      hosts:
        webserver1:

but the corresponding host_vars/webserver1.yml and group_vars/subgroup.yml are not scanned

an inventory file without all: is not scanned

---
webserver:
  hosts:
    webserver1:

In Version 1.7.10 everything works as expected. All inventory files and the corresponding group_vars and host_vars files are checked.

@gabriel-cx
Copy link
Contributor

Hi @timo-fc ,

Thanks for your input!
I will reopen the issue so we can check it.

@gabriel-cx
Copy link
Contributor

gabriel-cx commented Mar 1, 2024

Hi @timo-fc ,

A new KICS version was released yesterday (v1.7.13), and in it you can find the fix for this issue. Kindly tell us if this is working for you as well.

Feel free to ping us again if you need more support on this.

@timo-fc
Copy link
Author

timo-fc commented Mar 4, 2024

Thanks v1.7.13 has fixed it for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ansible Ansible query bug Something isn't working community Community contribution docker Docker query query New query feature
Projects
None yet
2 participants