CyberChef icon indicating copy to clipboard operation
CyberChef copied to clipboard

Bug report: Forking breaks highlighting for regular expression and other operations

Open mattnotmax opened this issue 2 years ago • 2 comments

Describe the bug On Chrome, Firefox and Edge it appears that when you apply fork, a subsequent regex doesn't perform match highlighting as per screenshots below

To Reproduce

Write simple input and apply regex looking for string 'test'. Highlighting is applied

image

Fork the same input and the highlight will disappear / not be applied

image

This also appears to break text highlights for selecting text

image

And forked:

image

Expected behaviour Highlight of regex matches or selected text should occur regardless of fork operation being applied. I wonder if it relates to: https://github.com/gchq/CyberChef/issues/267

Screenshots As above

Desktop (if relevant, please complete the following information):

  • Version: 9.37.3
  • Compile time: 14/04/2022 17:10:14 UTC
  • User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.41 Safari/537.36

Thank you!

mattnotmax avatar May 22 '22 09:05 mattnotmax

This is certainly something I would like to improve. I've removed the 'bug' label since this is expected behaviour at the moment. Highlighting is currently calculated purely based on offsets. The 'Fork' operation introduces unknown-length delimiters which the surrounding operations can't see. It wouldn't be possible for the Hexdump operation in your example to accurately calculate the correct offsets without knowing a lot more about its environment than it currently has access to, as well as understanding exactly how the Fork operation works and how it modified the input. For that reason, the Fork operation doesn't support highlighting and it will be turned off whenever it is active in the recipe.

As you note, #267 covers a potential solution to this, but it would represent quite a chunk of work and it's not currently near the top of the priority list. If someone wants to take this on or offer some thoughts on how it could be achieved, please go ahead!

n1474335 avatar Jun 08 '22 18:06 n1474335

Thanks @n1474335 I appreciate the detailed explanation. Thanks as always for the tool and work.

mattnotmax avatar Jun 15 '22 10:06 mattnotmax