Skip to content

Comments

Moves glob/wildcard matching into Fact.#323

Open
Stringy wants to merge 6 commits intomainfrom
giles/wildcard-support
Open

Moves glob/wildcard matching into Fact.#323
Stringy wants to merge 6 commits intomainfrom
giles/wildcard-support

Conversation

@Stringy
Copy link
Contributor

@Stringy Stringy commented Feb 23, 2026

Description

Host scanning now uses globs to only get inodes for the specific files matching the globs.

Prefix map is populated with the longest prefix for each glob e.g. /etc/**/*.conf -> /etc/
/home/user/.ssh/id_{rsa,dsa} -> /home/user/.ssh/id_

Kernel captures events based on inode first and then prefix match (this behavior is unchanged) and then userspace does a glob match on the path and host_path.

Somewhat relies on a chain of PRs in the main repo (in merge order):

stackrox/stackrox#19057
stackrox/stackrox#19063
stackrox/stackrox#19089

Checklist

  • Investigated and inspected CI test results
  • Updated documentation accordingly

Automated testing

  • Added unit tests
  • Added integration tests
  • Added regression tests

If any of these don't apply, please comment below.

Testing Performed

TODO(replace-me)
Use this space to explain how you tested your PR, or, if you didn't test it, why you did not do so. (Valid reasons include "CI is sufficient" or "No testable changes")
In addition to reviewing your code, reviewers must also review your testing instructions, and make sure they are sufficient.

For more details, ref the Confluence page about this section.

Host scanning now uses globs to only get inodes for the specific files
matching the globs.

Prefix map is populated with the longest prefix for each glob
e.g. /etc/**/*.conf -> /etc/
     /home/user/.ssh/id_{rsa,dsa} -> /home/user/.ssh/id_

Kernel captures events based on inode first and then prefix match (this
behavior is unchanged) and then userspace does a glob match on the path
and host_path.
Copy link
Contributor

@Molter73 Molter73 left a comment

Choose a reason for hiding this comment

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

Awesome! Thanks for tackling this!!

let mut new_paths = Vec::with_capacity(paths_config.len());
let mut builder = GlobSetBuilder::new();
for p in paths_config.iter() {
builder.add(Glob::new(&p.to_string_lossy())?);
Copy link
Contributor

Choose a reason for hiding this comment

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

We probably want to hard fail if a configured path is wrong, if we change the string at this point we might not match the strings configured by a user and we will not report things in there.

@Stringy Stringy requested a review from Molter73 February 23, 2026 15:27
Copy link
Contributor

@Molter73 Molter73 left a comment

Choose a reason for hiding this comment

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

Changes look good, can we add at least one integration test with globs? Just to make sure it is working, we can always expand later.

@Stringy Stringy requested a review from Molter73 February 24, 2026 14:21
@Stringy Stringy marked this pull request as ready for review February 24, 2026 14:21
@Stringy Stringy requested review from a team and rhacs-bot as code owners February 24, 2026 14:21
@Molter73
Copy link
Contributor

/retest

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants