crash_reporter: flag reports where console was used in app_version
so we don't waste time on weird reports where the user modified internals at runtime ref https://github.com/spesmilo/electrum/issues/10217 https://github.com/spesmilo/electrum/issues/10218
This commit is contained in:
@@ -39,6 +39,12 @@ if TYPE_CHECKING:
|
|||||||
from .network import ProxySettings
|
from .network import ProxySettings
|
||||||
|
|
||||||
|
|
||||||
|
_tainted_by_console = False
|
||||||
|
def taint_reports_by_console_usage():
|
||||||
|
global _tainted_by_console
|
||||||
|
_tainted_by_console = True
|
||||||
|
|
||||||
|
|
||||||
class CrashReportResponse(NamedTuple):
|
class CrashReportResponse(NamedTuple):
|
||||||
status: Optional[str]
|
status: Optional[str]
|
||||||
text: str
|
text: str
|
||||||
@@ -153,8 +159,11 @@ class BaseCrashReporter(Logger):
|
|||||||
return sha256(str(_id))
|
return sha256(str(_id))
|
||||||
|
|
||||||
def get_additional_info(self):
|
def get_additional_info(self):
|
||||||
|
app_version = (get_git_version() or ELECTRUM_VERSION)
|
||||||
|
if _tainted_by_console:
|
||||||
|
app_version += "-consoletaint"
|
||||||
args = {
|
args = {
|
||||||
"app_version": get_git_version() or ELECTRUM_VERSION,
|
"app_version": app_version,
|
||||||
"python_version": sys.version,
|
"python_version": sys.version,
|
||||||
"os": describe_os_version(),
|
"os": describe_os_version(),
|
||||||
"wallet_type": "unknown",
|
"wallet_type": "unknown",
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ from PyQt6.QtCore import Qt
|
|||||||
|
|
||||||
from electrum import util
|
from electrum import util
|
||||||
from electrum.i18n import _
|
from electrum.i18n import _
|
||||||
|
from electrum.base_crash_reporter import taint_reports_by_console_usage
|
||||||
|
|
||||||
from .util import MONOSPACE_FONT, font_height
|
from .util import MONOSPACE_FONT, font_height
|
||||||
|
|
||||||
@@ -83,7 +84,7 @@ class Console(QtWidgets.QPlainTextEdit):
|
|||||||
with open(filename) as f:
|
with open(filename) as f:
|
||||||
script = f.read()
|
script = f.read()
|
||||||
|
|
||||||
self.exec_command(script)
|
self._exec_command(script)
|
||||||
|
|
||||||
def updateNamespace(self, namespace):
|
def updateNamespace(self, namespace):
|
||||||
self.namespace.update(namespace)
|
self.namespace.update(namespace)
|
||||||
@@ -221,12 +222,13 @@ class Console(QtWidgets.QPlainTextEdit):
|
|||||||
command = self.getConstruct(command)
|
command = self.getConstruct(command)
|
||||||
|
|
||||||
if command:
|
if command:
|
||||||
self.exec_command(command)
|
self._exec_command(command)
|
||||||
self.newPrompt('')
|
self.newPrompt('')
|
||||||
self.set_json(False)
|
self.set_json(False)
|
||||||
|
|
||||||
def exec_command(self, command):
|
def _exec_command(self, command):
|
||||||
tmp_stdout = sys.stdout
|
tmp_stdout = sys.stdout
|
||||||
|
taint_reports_by_console_usage()
|
||||||
|
|
||||||
class StdoutProxy:
|
class StdoutProxy:
|
||||||
def __init__(self, write_func):
|
def __init__(self, write_func):
|
||||||
|
|||||||
Reference in New Issue
Block a user