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

SSG Test Suite: Fix (all) profile execution when running test suite in rule mode #4792

Merged

Conversation

ggbecker
Copy link
Member

@ggbecker ggbecker commented Sep 3, 2019

Description:

  • Fix (all) profile execution when running test suite in rule mode.

@ggbecker ggbecker added the Python label Sep 3, 2019
@pep8speaks
Copy link

pep8speaks commented Sep 3, 2019

Hello @ggbecker! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:

There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻

Comment last updated at 2019-09-05 09:31:22 UTC

@ggbecker ggbecker added this to the 0.1.47 milestone Sep 3, 2019
@ggbecker ggbecker force-pushed the ssgts-all-profile-in-rule-mode branch from 11b87ec to b4dbfde Compare September 4, 2019 07:26
@ggbecker ggbecker requested a review from matejak September 4, 2019 07:40
@ggbecker ggbecker added the Test Suite Update in Test Suite. label Sep 4, 2019
Copy link
Member

@matejak matejak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR aims to make virtual profiles working with the test suite and fixes an oscap-ssh error that has not yet propagated.
I propose some modifications that would simplify the behavior and implementation.

tests/ssg_test_suite/rule.py Outdated Show resolved Hide resolved
tests/ssg_test_suite/oscap.py Outdated Show resolved Hide resolved
tests/ssg_test_suite/rule.py Show resolved Hide resolved
tests/ssg_test_suite/rule.py Outdated Show resolved Hide resolved
When overriding the profile metadata from test scenarios with the (all)
profile, dependending the version of OpenSCAP it may fail to run because
of some bash syntax error.
@ggbecker ggbecker force-pushed the ssgts-all-profile-in-rule-mode branch from b4dbfde to 8bd3d7e Compare September 4, 2019 12:11
The fix for oscap-ssh is already in Fedora 30 and is going to be
backported to 29 soon.
When generating remediation from arf and the arf file has only on
TestResult, it doesn't matter if you provide a value for result-id and
for (all) profile it was breaking the bash command with bad syntax.
@ggbecker ggbecker changed the title SSG Test Suite: Add option --profile ALL to rule mode. SSG Test Suite: Fix (all) profile execution when running test suite in rule mode Sep 4, 2019
Copy link
Member

@matejak matejak left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, the generate_fixes_remotely method generates a command string out of command components without any additional processing. However, individual components may need protection from shell interpretation.

Therefore something like

command_components = command_base + command_options + command_operands
command_string = ' '.join(["'%s'" % c for c in command_components])

may work.

@matejak matejak self-assigned this Sep 5, 2019
@matejak
Copy link
Member

matejak commented Sep 5, 2019

Great, I can confirm that it works also on the system with quoting fixed in oscap-ssh.

@matejak matejak merged commit 56fe87b into ComplianceAsCode:master Sep 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Test Suite Update in Test Suite.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants