google / google/grr

Using filefinder with windows path separator can lead to unexpected escaping

Open
#117 2 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
5.1k
Forks
796
PR merge metrics
No merged PRs in 30d

Description

The FileFinder allows for interpolation and wildcards in the path query but this interacts very badly with the \ windows path separator.

For example a query like:
HKEY_CLASSES_ROOT\CLSID{aaaabbbbb-111-2222-333-beef}*

Does not work because the interpolation happens first which means * is replaced with a literal \* and { is replaced with a literal {. Doubling up on the \ still does not seem to work. Its very difficult to predict why something is not going to work with \ in the path because we dont know if its supposed to be a char escape or a path separator.

Similarly the interpolation supports the use of {} as a group operator just like bash does it (e.g. ls foo.{exe,dll}), so the { above are misinterpreted as a grouping operator (with one option). So {} chars will generally need to be escaped.

The normal path separator is / which is fine so this works:
HKEY_CLASSES_ROOT/CLSID/{aaaabbbbb-111-2222-333-beef}/*

We think the fix is some combination of:
Marking special globbing characters differently in the UI (e.g. red, or bold) so it's obvious what's happening
Allowing the user to turn off all globbing and just make it a string literal

This will be easier once we have angular forms: #115

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.