Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tests/utils/autotailor_integration_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
assert_exists 1 '/Benchmark/TestResult/rule-result[@idref="xccdf_com.example.www_rule_R2"]/result[text()="pass"]'
assert_exists 1 '/Benchmark/TestResult/rule-result[@idref="xccdf_com.example.www_rule_R3"]/result[text()="pass"]'
assert_exists 1 '/Benchmark/TestResult/rule-result[@idref="xccdf_com.example.www_rule_R4"]/result[text()="notselected"]'
grep "xccdf-1.2:" $tailoring

# select additional rules R3, R4
python3 $autotailor --id-namespace "com.example.www" --select R3 --select R4 $ds $original_profile > $tailoring
Expand Down Expand Up @@ -114,7 +115,7 @@
assert_exists 1 '/Benchmark/TestResult/rule-result[@idref="xccdf_com.example.www_rule_R4"]/result[text()="notselected"]'

# use JSON tailoring
python3 $autotailor $ds --id-namespace "com.example.www" --json-tailoring $json_tailoring > $tailoring

Check warning on line 118 in tests/utils/autotailor_integration_test.sh

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Define a constant instead of using the literal 'com.example.www' 11 times.

See more on https://sonarcloud.io/project/issues?id=OpenSCAP_openscap&issues=AZ1OHOKm7R0-edR1n2nQ&open=AZ1OHOKm7R0-edR1n2nQ&pullRequest=2329
$OSCAP xccdf eval --profile JSON_P1 --progress --tailoring-file $tailoring --results $result $ds
assert_exists 1 '/Benchmark/TestResult/set-value[@idref="xccdf_com.example.www_value_V1" and text()="New Value"]'
assert_exists 1 '/Benchmark/TestResult/set-value[@idref="xccdf_com.example.www_value_V2" and text()="Some Value"]'
Expand Down
3 changes: 3 additions & 0 deletions utils/autotailor
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import json


NS = "http://checklists.nist.gov/xccdf/1.2"
NS_PREFIX = "xccdf-1.2"
DEFAULT_PROFILE_SUFFIX = "_customized"
DEFAULT_REVERSE_DNS = "org.ssgproject.content"
ROLES = ["full", "unscored", "unchecked"]
Expand Down Expand Up @@ -408,6 +409,8 @@ if __name__ == "__main__":
parser = get_parser()
args = parser.parse_args()

ET.register_namespace(NS_PREFIX, NS)

if not args.profile and not args.json_tailoring:
parser.error("one of the following arguments has to be provided: "
"BASE_PROFILE_ID or --json-tailoring JSON_TAILORING_FILENAME")
Expand Down
Loading