chef / automate

Chef Automate provides a full suite of enterprise capabilities for maintaining continuous visibility into application, infrastructure, and security automation.
https://automate.chef.io/
Apache License 2.0
224 stars 111 forks source link

Compliance Wildcard profile filtering #1811

Open lancewf opened 4 years ago

lancewf commented 4 years ago

User Story

As an Automate user when filtering on profiles with wildcards, I want the profiles in the profile tab to be filtered. Currently, only the nodes are being filtered when adding a profile with wildcard filter. The profiles that are shown are all the profiles from the nodes on the node tab.

Definition of Done

When filtering on profiles with wildcards the filter will be applied to the profile tab.

Demo Script / Repro Steps

  1. Add some InSpec reports. chef_load_compliance_nodes 100
  2. Open https://a2-dev.test/compliance/reports/profiles
  3. From the search bar all profile filters with wildcards.
  4. Ensure profiles are filtered.

Extra Info

Here is a branch that is starting to work on this problem. https://github.com/chef/automate/compare/lancewf/filter_list_profiles_with_wildcards The problem is in the components/compliance-service/reporting/relaxting/profiles_report_level.go "getProfileMinsFromNodesResults" function where the profiles are being filtered down if there is a "profile_id" filter. The "profile_name" and "profile_with_version" filters need to be added to this function. The problem with adding these filters is there is no access to the profile title or version.

These changes need to be added to the components/compliance-service/reporting/relaxting/profiles_profile_level.go and components/compliance-service/reporting/relaxting/profiles_control_level.go files also.

lancewf commented 4 years ago

Below is a go library that can be used for the wildcard matching. This library is already imported in Automate by auth. https://github.com/gobwas/glob