Bug 2026718

Summary: XCCDF Profile in Tailoring File selecting the first id not the selected id
Product: Red Hat Satellite Reporter: Aldrey Souza <alsouza>
Component: SCAP PluginAssignee: satellite6-bugs <satellite6-bugs>
Status: CLOSED ERRATA QA Contact: addubey
Severity: medium Docs Contact:
Priority: unspecified    
Version: 6.10.0CC: addubey, ldelouw, mhulan, pcreech, rlavi, zhunting
Target Milestone: 6.11.0Keywords: EasyFix, Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: foreman_openscap 5.1.1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-07-05 14:30:33 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Tailoring profile file: ssg-rhel7-ds-xccdf-tailoring.xml none

Description Aldrey Souza 2021-11-25 15:24:50 UTC
Created attachment 1843598 [details]
Tailoring profile file: ssg-rhel7-ds-xccdf-tailoring.xml

Description of problem:
 When you 'Edit' the Policy and select the 'XCCDF Profile in Tailoring File' it allows saving. But if you 'Edit' again it selects the first id, not the selected id.

Version-Release number of selected component (if applicable):


How reproducible:
 1. Create a Tailoring Files
 2. Create a new Policy
 3. Edit the Policy and select a different tailoring profile
 4. Check the selected tailoring profile again
 


Steps to Reproduce:
1. Create a Tailoring Files
 -> Satellite WebUI
 -> Hosts
 -> Compliance
 -> Tailoring Files
 -> Upload New Tailoring file
 -> Upload the file attached 'ssg-rhel7-ds-xccdf-tailoring.xml'

2. Create a new Policy
 -> Satellite WebUI
 -> Hosts
 -> Compliance
 -> Policies
 -> New Compliance Policy
 -> Deployment Options - Select: Ansible
 -> Policy Attributes - Name: policy_test
 -> SCAP Content:
     SCAP Content: Red Hat rhel7 default content
     XCCDF Profile: Default XCCDF profile
     Tailoring File: ssg-rhel7-ds-xccdf-tailoring
     XCCDF Profile in Tailoring File: CIS Red Hat Enterprise Linux 7 Benchmark for Level 1 - Minimal [CUSTOMIZED]
 -> Schedule (any period):
    Period: Weekly
    Weekday: Sunday
  -> Submit

  * In 'Effective Profile', we can see: CIS Red Hat Enterprise Linux 7 Benchmark for Level 1 - Minimal [CUSTOMIZED]  

3. Edit the policy 'policy_test'
  -> SCAP Content:
     SCAP Content: Red Hat rhel7 default content
     XCCDF Profile: Default XCCDF profile
     Tailoring File: ssg-rhel7-ds-xccdf-tailoring
     XCCDF Profile in Tailoring File: CIS Red Hat Enterprise Linux 7 Benchmark for Level 1 - WebServer [CUSTOMIZED]   <-- Changed to WebServer (before Minimal)

  * After the change, we can see in 'Effective Profile': CIS Red Hat Enterprise Linux 7 Benchmark for Level 1 - WebServer [CUSTOMIZED]  

4. Edit the policy 'policy_test'
  -> SCAP Content:
     SCAP Content: Red Hat rhel7 default content
     XCCDF Profile: Default XCCDF profile
     Tailoring File: ssg-rhel7-ds-xccdf-tailoring
     XCCDF Profile in Tailoring File: CIS Red Hat Enterprise Linux 7 Benchmark for Level 1 - Minimal [CUSTOMIZED]   <-- Showing Minimal and should select WebServer


 
Actual results:
 By default, it selects the first tailoring profile id, not the selected profile.

Expected results:
 See the selected tailoring profile

Additional info:
 Possible patch attached 'tailoring_profile_selected.patch'.

 To apply it:
 # patch -p0 /opt/theforeman/tfm/root/usr/share/gems/gems/foreman_openscap-4.3.3/app/helpers/policies_helper.rb < tailoring_profile_selected.patch

Comment 1 Aldrey Souza 2021-11-25 15:25:35 UTC
Created attachment 1843599 [details]
Possible patch: tailoring_profile_selected.patch

Comment 2 Ondřej Pražák 2021-11-26 07:53:42 UTC
Connecting redmine issue https://projects.theforeman.org/issues/33972 from this bug

Comment 3 Bryan Kearney 2021-11-26 12:05:33 UTC
Moving this bug to POST for triage into Satellite since the upstream issue https://projects.theforeman.org/issues/33972 has been resolved.

Comment 5 addubey 2022-02-02 13:37:56 UTC
FailedQA.

Version Tested: Satellite 7.0.0 Snap 7.0

Steps followed: 

 1. Create Tailoring Files
 2. Create a new Policy
 3. Edit the Policy and select a different tailoring profile
 4. Check the selected tailoring profile again

Observation: Not able to see the selected tailoring file.


Tested with below:

 XCCDF Profile in Tailoring File: CIS Red Hat Enterprise Linux 7 Benchmark for Level 1 - Minimal [CUSTOMIZED]
 XCCDF Profile in Tailoring File: CIS Red Hat Enterprise Linux 7 Benchmark for Level 1 - WebServer [CUSTOMIZED]

Comment 6 Ron Lavi 2022-02-07 13:25:31 UTC
Thanks, we just realized that the version of foreman_openscap with the fix didn't make it to the snap,
I released foreman_openscap.1 to address that

Comment 7 addubey 2022-02-22 07:55:37 UTC
Verified.


Tested on: Satellite-7.0.0 Snap 10.0


Steps followed:

 1. Create Tailoring Files
 2. Create a new Policy
 3. Edit the Policy and select a different tailoring profile
 4. Check the selected tailoring profile again

Observation: Able to see the correct selected tailoring file.

Comment 10 errata-xmlrpc 2022-07-05 14:30:33 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (Moderate: Satellite 6.11 Release), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHSA-2022:5498