mwdb-core icon indicating copy to clipboard operation
mwdb-core copied to clipboard

Four backslashes needed to query configuration value with single backslash

Open psrok1 opened this issue 3 years ago • 1 comments

Environment information

  • MWDB version (from /about): 2.7.0
  • Installation method:
    • [x] mwdb.cert.pl service
    • [ ] From PyPi (pip install mwdb-core)
    • [ ] From docker-compose
    • [ ] Other (please explain)
  • Plugins installed: unrelevant

Behaviour the bug (what happened?)

Backslash needs to be escaped two times to work correctly in configuration search

Configuration:

{
    "pdb_path": "C:\\xxxx\\12345678.pdb"
}

Working lucene query for pdb_path field:

cfg.pdb_path:"C:\\\\xxxx\\\\12345678.pdb"

Expected behaviour

Backslash should be unescaped once:

cfg.pdb_path:"C:\\xxxx\\12345678.pdb"

psrok1 avatar Sep 13 '22 13:09 psrok1

Possibly caused by additional unicode_escape in database. I think it's completely unnecessary for JSONB and if it's added because there were issues with non-ascii characters, we need to find a more transparent solution.

See also: https://github.com/CERT-Polska/mwdb-core/blob/master/mwdb/model/config.py#L44

psrok1 avatar Sep 13 '22 14:09 psrok1