non-UTF8 paths on Linux are not always escaped
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 23.6k
- Forks
- 2.6k
- Avg merge
- 6d 7h
- Merged PRs (30d)
- 14
Description
Bug report
What operating system and version are you using?
Linux
What version of osquery are you using?
master
What steps did you take to reproduce the issue?
- From a shell create a file with a non-UTF8 character with
touch $'file with \x80 non-utf8 name'. Also suppose that this file is in/home/user - With
lsverify that the filename should look like'file_with_'$'\200''_non-utf8_name' - Run this osqueryi query:
osqueryi -S 'SELECT * FROM file WHERE path LIKE "/home/user/%"' - Also try with
osqueryi -S --json 'SELECT * FROM file WHERE path LIKE "/home/user/%"'
What did you expect to see?
The filename escaped in some way, so that it's still in UTF8
What did you see instead?
The problem is that we never escape the results, unless they are in a scheduled query with a differential query, so the same problem exists for results that are either saved locally to log files or sent via network.
More info also in https://github.com/osquery/osquery/issues/7614.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with osqueryi, the file table, and both normal and --json queries using the non-UTF8 filename described. Trace how file-table results are serialized and handled for direct output, saved logs, and network results, also reviewing issue 7614. Done means the path is escaped into valid UTF-8 consistently across these outputs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, sql
- Domain
- operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100