[mig modules] Pattern matching on path component in file module



Enterprise Information Security
3 years ago
3 years ago


(Reporter: alm, Unassigned)





3 years ago
Can we add support to pattern match on the path component as well?

For example, looking for common files like __init__.py, it can be useful to limit the matches to certain directories, like a specific library.
There is a significant amount of history on this particular features. The now defunct `filechecker` module has path expansion using Golang's filepath package [1]. Problem is, the syntax for filepath.Match() is different than what one would expect using bash's path expansion, which is also different from other shells or stuff you'd find on windows with %VARIABLES% expansion.

I considered reimplementing bash's path expansion code, but that's a lot of work and dark magic.

Taking the approach that too many choices are worse that none, I decided to remove the path pattern matching logic entirely. The `file` module doesn't support it at all. Instead, it supports searching on metadata, like filename, size, permissions, maxdepth, etc... which is almost as fast as matching a path, and has the benefit of having a deterministic behavior.

That said, if we can find a good way to implement path pattern matching in the file module, I'm up for it. But I will prefer no pattern matching to something that has potentially confusing behavior.

[1] http://golang.org/pkg/path/filepath/#Match
Blocks: 1116678
Summary: Pattern matching on path component → [mig modules] Pattern matching on path component in file module

Comment 2

3 years ago
It's simple enough just to filter the results client side as well, closing.
Last Resolved: 3 years ago
Resolution: --- → WONTFIX


3 years ago
Component: Operations Security (OpSec): MIG → MIG
Product: mozilla.org → Enterprise Information Security
You need to log in before you can comment on or make changes to this bug.