Repository navigation
Fix behavior of OSCAP_PROBE_IGNORE_PATHS variable - #2487
Merged
Merged
Conversation
If the variable is set to an empty string or contains empty strings in columns, the empty string shall be ignored and shall not cause ignoring any paths. Resolves: https://redhat.atlassian.net/browse/RHEL-310454
|
jamesconwaydev
left a comment
There was a problem hiding this comment.
Read through against main; the root cause and the fix line up:
- Where the empty entries come from.
oscap_splitis built onstrsep, so it yields an empty field for"", for a leading or trailing:, and for::. Each went intoblocked_paths. - Why an empty entry blocked everything.
probe_path_is_blockedchecks each entry withoscap_path_startswith(path, item). Foritem = "", the prefix splits into[""], and the loop skips the empty component and runs out of prefix withresstilltrue. So an empty entry matched every path, and the probes ignored them all. - The fix is in the right place. Skipping empty fields in
_add_blocked_pathsmeans neitherprobe_path_is_blockednorprobe_fd_path_is_blocked, which strips the prefix and then calls the former, ever sees one.
The tests cover the cases that matter: unset, '' and ':', each collecting all 8 objects, and real paths with empty entries around them blocking exactly as before.
One thing to be aware of, which this PR doesn't change: an entry of only slashes, such as /, still matches everything, since every component is empty after splitting. That reads as intended for / ("ignore the whole filesystem"), so I'd leave it.
Read only; I didn't run it.
Mab879
approved these changes
Nov 25, 2026
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.



If the variable is set to an empty string or contains empty strings in columns, the empty string shall be ignored and shall not cause ignoring any paths.
Resolves: https://redhat.atlassian.net/browse/RHEL-310454