Skip to content

bug(dashboard): command injection on Linux + cross-platform crash in ecc_dashboard.py #1424

@konghun

Description

@konghun

Two confirmed bugs in ecc_dashboard.py (merged via #1377). Both affect the open_terminal() method and the __init__ window-state call.


Bug 1 — Shell command injection via unsanitized path (Linux) · Security

File: ecc_dashboard.py:799

def open_terminal(self):
    path = self.path_entry.get()          # ← user-editable text field, no sanitisation
    ...
    else:  # Linux
        subprocess.Popen(['x-terminal-emulator', '-e', f'cd {path}'])

x-terminal-emulator -e <cmd> passes <cmd> to a shell. If path contains shell metacharacters — e.g. a project path with a space, a backtick, or a semicolon — the terminal will execute them. For example:

path = "/home/user/proj; rm -rf ~"
→ x-terminal-emulator -e "cd /home/user/proj; rm -rf ~"

The user controls the entry field directly (Browse button + manual editing), so this is a real injection surface even in a local app.

Fix: Pass the cd command as a properly quoted list argument, or use shlex.quote:

import shlex
subprocess.Popen(['x-terminal-emulator', '-e', f'cd {shlex.quote(path)}'])

Or, better, use the terminal's -–working-directory flag where available instead of a shell -e argument.


Bug 2 — self.state('zoomed') raises TclError on macOS and Linux · Correctness

File: ecc_dashboard.py:260

self.state('zoomed')   # ← Windows-only Tk state

'zoomed' is a valid window state on Windows. On macOS and most Linux desktop environments it raises:

_tkinter.TclError: bad argument "zoomed": must be normal, iconic, or withdrawn

This crashes the dashboard on startup on non-Windows systems.

Fix:

try:
    self.state('zoomed')          # Windows
except tk.TclError:
    self.attributes('-zoomed', True)  # Linux (most WMs)

macOS maximise requires self.attributes('-fullscreen', True) or can be skipped — the window is still usable at its default size.


Related open PRs worth merging alongside a fix

PR Summary
#1420 Replaces 8 bare except: with except Exception — directly related to this file
#1419 Reduces unnecessary disk writes in gateguard-fact-force.js
#1411 Stable session fallback for GateGuard in API/proxy setups

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions