gchq / gchq/CyberChef

Feature request: URL parameter to disable console logging

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

Description

**Is your feature request related to a problem? Please describe.**
My use case is implementing this application in an iFrame, where ideally I would like to avoid logging to the console if possible. Some of the output I would like to avoid being displayed is the following:

![unwanted console output](https://user-images.githubusercontent.com/17814535/190913259-5518fb2b-3e45-40c3-8518-28401a9cc519.png)

**Describe the solution you'd like**
A URL parameter specifying that nothing should be output to the console, something like `?logging=false`.

**Describe alternatives you've considered**
I have tried to intercept calls to `console.*` on my end, but since it is a cross-origin iframe, the following code just results in a DOMException:

```js
iframe.onload = () => {
iframe.contentWindow.console.log = () => {};
iframe.contentWindow.console.error = () => {};
iframe.contentWindow.console.warn = () => {};
iframe.contentWindow.console.info = () => {};
iframe.contentWindow.console.debug = () => {};
}
```

**Additional context**
The implementation would simply need to be something along the lines of the following when the URL parameter is present:

```js
window.console.log = () => {};
window.console.error = () => {};
window.console.warn = () => {};
window.console.info = () => {};
window.console.debug = () => {};
```

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.