-
Notifications
You must be signed in to change notification settings - Fork 383
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
Introduce a limit of collected items #2051
Merged
Merged
Changes from 6 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
d1045b2
Refactor: Extract function
jan-cerny b20fca6
Introduce a limit for collected objects
jan-cerny 5e3d8bc
Test collected items limit
jan-cerny 176f1a8
Handle return value of probe_item_collect
jan-cerny f2461c7
Make probe items limit configurable
jan-cerny fb97a51
Add comment for visual consistency
jan-cerny dd1977c
Remove empty line
jan-cerny 6b29c04
Rename "memory" directory to "probe_behavior"
jan-cerny File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,6 +30,7 @@ add_subdirectory("curl") | |
add_subdirectory("CPE") | ||
add_subdirectory("DS") | ||
add_subdirectory("mitre") | ||
add_subdirectory("memory") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The behavior alteration we are testing here is not exactly connected to memory. I'd rather name it like |
||
add_subdirectory("nist") | ||
add_subdirectory("oscap_string") | ||
add_subdirectory("oval_details") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
add_oscap_test("collect_limit.sh") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<?xml version="1.0"?> | ||
<oval_definitions xmlns:oval-def="http://oval.mitre.org/XMLSchema/oval-definitions-5" xmlns:oval="http://oval.mitre.org/XMLSchema/oval-common-5" xmlns:ind="http://oval.mitre.org/XMLSchema/oval-definitions-5#independent" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ind-def="http://oval.mitre.org/XMLSchema/oval-definitions-5#independent" xmlns:unix-def="http://oval.mitre.org/XMLSchema/oval-definitions-5#unix" xmlns:lin-def="http://oval.mitre.org/XMLSchema/oval-definitions-5#linux" xmlns="http://oval.mitre.org/XMLSchema/oval-definitions-5" xsi:schemaLocation="http://oval.mitre.org/XMLSchema/oval-definitions-5#unix unix-definitions-schema.xsd http://oval.mitre.org/XMLSchema/oval-definitions-5#independent independent-definitions-schema.xsd http://oval.mitre.org/XMLSchema/oval-definitions-5#linux linux-definitions-schema.xsd http://oval.mitre.org/XMLSchema/oval-definitions-5 oval-definitions-schema.xsd http://oval.mitre.org/XMLSchema/oval-common-5 oval-common-schema.xsd"> | ||
<generator> | ||
<oval:schema_version>5.10.1</oval:schema_version> | ||
<oval:timestamp>0001-01-01T00:00:00+00:00</oval:timestamp> | ||
</generator> | ||
|
||
<definitions> | ||
<definition class="compliance" version="1" id="oval:x:def:1"> | ||
<metadata> | ||
<title>x</title> | ||
<description>x</description> | ||
<affected family="unix"> | ||
<platform>x</platform> | ||
</affected> | ||
</metadata> | ||
<criteria> | ||
<criterion test_ref="oval:x:tst:1" comment="always pass"/> | ||
</criteria> | ||
</definition> | ||
</definitions> | ||
|
||
<tests> | ||
<ind:textfilecontent54_test id="oval:x:tst:1" version="1" comment="Test" check="all"> | ||
<ind:object object_ref="oval:x:obj:1"/> | ||
</ind:textfilecontent54_test> | ||
</tests> | ||
|
||
<objects> | ||
<ind:textfilecontent54_object id="oval:x:obj:1" version="1" comment="The object matches each line in /tmp/longfile."> | ||
<ind:filepath>/tmp/longfile</ind:filepath> | ||
<ind:pattern operation="pattern match">^.*$</ind:pattern> | ||
<ind:instance datatype="int" operation="greater than or equal">1</ind:instance> | ||
</ind:textfilecontent54_object> | ||
</objects> | ||
|
||
</oval_definitions> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash | ||
|
||
set -e -o pipefail | ||
|
||
. $builddir/tests/test_common.sh | ||
|
||
export OSCAP_PROBE_MAX_COLLECTED_ITEMS=100 | ||
seq 110 > /tmp/longfile | ||
result=$(mktemp) | ||
$OSCAP oval eval --results "$result" $srcdir/collect_limit.oval.xml | ||
assert_exists 1 '/oval_results/results/system/oval_system_characteristics/collected_objects/object' | ||
assert_exists 1 '/oval_results/results/system/oval_system_characteristics/collected_objects/object[@flag="incomplete"]' | ||
assert_exists 1 '/oval_results/results/system/oval_system_characteristics/collected_objects/object/message[@level="warning"]' | ||
text="Object is incomplete because the object matches more than 100 items." | ||
assert_exists 1 "/oval_results/results/system/oval_system_characteristics/collected_objects/object/message[text()=\"$text\"]" | ||
assert_exists 100 '/oval_results/results/system/oval_system_characteristics/system_data/ind-sys:textfilecontent_item' | ||
rm -f /tmp/longfile | ||
rm -f "$result" |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redundant \n