Skip to content

Commit 48abb41

Browse files
committed
Do not emit warning when a rule has only OCIL or SCE
OCIL is a valid SCAP check, we only don't support it in OpenSCAP. SCE is supported by OpenSCAP, but users can use OpenSCAP without SCE plugin. Instead we will display an info message (in verbose mode). We will still keep the warning for really invalid check systems. Problem with warning messages is that they're understood as errors by SCAP Workbench and the diagnostic window pops up when they're produced.
1 parent 02c7831 commit 48abb41

File tree

4 files changed

+35
-0
lines changed

4 files changed

+35
-0
lines changed

src/XCCDF_POLICY/xccdf_policy.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -584,6 +584,10 @@ _xccdf_policy_rule_get_applicable_check(struct xccdf_policy *policy, struct xccd
584584
result = check;
585585
} else if (strcmp("http://oval.mitre.org/XMLSchema/oval-definitions-5", check->system) == 0) {
586586
print_oval_warning = true;
587+
} else if (strcmp("http://scap.nist.gov/schema/ocil/2", check->system) == 0) {
588+
dI("This rule requires an OCIL check. OCIL checks are not supported by OpenSCAP.");
589+
} else if (strcmp("http://open-scap.org/page/SCE", check->system) == 0) {
590+
dI("This rule requires a SCE check but the SCE plugin was disabled.");
587591
} else {
588592
print_general_warning = true;
589593
warning_check_system = check->system;

tests/API/XCCDF/unittests/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ add_oscap_test("test_xccdf_check_negate.sh")
3232
add_oscap_test("test_xccdf_check_multi_check.sh")
3333
add_oscap_test("test_xccdf_check_multi_check2.sh")
3434
add_oscap_test("test_xccdf_check_multi_check_zero_definitions.sh")
35+
add_oscap_test("test_xccdf_check_ocil.sh")
3536
add_oscap_test("test_xccdf_check_content_ref_without_name_attr.sh")
3637
add_oscap_test("test_xccdf_check_without_content_refs.sh")
3738
add_oscap_test("test_xccdf_refine_rule.sh")
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
. $builddir/tests/test_common.sh
3+
4+
set -e
5+
set -o pipefail
6+
7+
result=`mktemp`
8+
stderr=`mktemp`
9+
$OSCAP xccdf eval --results $result $srcdir/test_xccdf_check_ocil.xml 2> $stderr
10+
[ ! -s "$stderr" ]
11+
$OSCAP xccdf validate $result
12+
assert_exists 1 '//rule-result[@idref="xccdf_moc.elpmaxe.www_rule_1"]/result[text()="notchecked"]'
13+
rm $stderr
14+
rm $result
15+
16+
stderr=`mktemp`
17+
$OSCAP xccdf eval --verbose INFO $srcdir/test_xccdf_check_ocil.xml 2> $stderr
18+
grep -q "This rule requires an OCIL check. OCIL checks are not supported by OpenSCAP." $stderr
19+
rm $stderr
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<Benchmark xmlns="http://checklists.nist.gov/xccdf/1.2" id="xccdf_moc.elpmaxe.www_benchmark_test">
3+
<status>incomplete</status>
4+
<version>1.0</version>
5+
<Rule selected="true" id="xccdf_moc.elpmaxe.www_rule_1">
6+
<title>Rule with OCIL check</title>
7+
<check system="http://scap.nist.gov/schema/ocil/2">
8+
<check-content-ref href="test_xccdf_check_ocil.ocil.xml"/>
9+
</check>
10+
</Rule>
11+
</Benchmark>

0 commit comments

Comments
 (0)