gchq / gchq/CyberChef

Bug report: Some `chef.help` Operation Names Incompatible with `chef.bake`

Open
#1,191 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
JavaScript
Stars
35.8k
Forks
4.1k
Avg merge
2d 26m
Merged PRs (30d)
33

Description

**Describe the bug**
When searching for operations using the `chef.help` function, you can be returned an operation object that contains a name that will not work with `chef.bake` including the operation names `'Adler-32 Checksum', 'CRC-16 Checksum', 'CRC-32 Checksum', 'CRC-8 Checksum', 'Convert co-ordinate format', 'Find / Replace', 'Fletcher-16 Checksum', 'Fletcher-32 Checksum', 'Fletcher-64 Checksum', 'Fletcher-8 Checksum', 'HAS-160', 'Image Brightness / Contrast', 'Image Hue/Saturation/Lightness', 'Parse ASN.1 hex string', 'Parse X.509 certificate', 'Pseudo-Random Number Generator', 'TCP/IP Checksum'`. If any of these operation names that can be found with the `chef.help` function are attempted with the `chef.bake` function, it will throw an error including `Couldn't find an operation with name {operationName}`.

**To Reproduce**
1. Run the `chef.bake("foobar", { op: chef.help('Adler')[0].name })`

**Expected behaviour**
I would expect every operation name found with the `chef.help` function to be compatible with `chef.bake`

**Additional context**
The list above of operation names that that come from `chef.help` that are not compatible with `chef.bake` comes from the code:
```javascript
chef.help(" ")
.filter(({ name }) => {
try { chef.bake("asdf", { op: name });}
catch (e) { return e.message && e.message.includes("Couldn't find an operation with name"); }
})
.map(({name}) => name);
```
There could be more operations that have this issue as well, but the current mapping I've found that works when mapping the `chef.help` operation names with operation names that actually work with `chef.bake` are:
```javascript
{
'Adler-32 Checksum': 'adler32Checksum',
'CRC-16 Checksum': 'CRC16Checksum',
'CRC-32 Checksum': 'CRC32Checksum',
'CRC-8 Checksum': 'CRC8Checksum',
'Convert co-ordinate format': 'convertCoordinateFormat',
'Find / Replace': 'FindReplace',
'Fletcher-16 Checksum': 'fletcher16Checksum',
'Fletcher-32 Checksum': 'fletcher32Checksum',
'Fletcher-64 Checksum': 'fletcher64Checksum',
'Fletcher-8 Checksum': 'fletcher8Checksum',
'HAS-160': 'HAS160',
'Image Brightness / Contrast': 'imageBrightnessContrast',
'Image Hue/Saturation/Lightness': 'imageHueSaturationLightness',
'Parse ASN.1 hex string': 'parseASN1HexString',
'Parse X.509 certificate': 'parseX509Certificate',
'Pseudo-Random Number Generator': 'pseudoRandomNumberGenerator',
'TCP/IP Checksum': 'TCPIPChecksum'
}
```

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.