fix: GTK-Theme-Validierung entfernt — GTK löst Theme-Namen selbst auf
Die Regex VALID_THEME_NAME blockierte Theme-Namen mit '+' (z.B. catppuccin-mocha-lavender-standard+default). Da GTK den Theme-Namen intern über Standardverzeichnisse auflöst, ist eigene Validierung unnötig und kontraproduktiv.
This commit is contained in:
@@ -1,15 +1,12 @@
|
||||
# ABOUTME: Configuration loading from moongreet.toml.
|
||||
# ABOUTME: Parses appearance and behavior settings with wallpaper path resolution.
|
||||
|
||||
import re
|
||||
import tomllib
|
||||
from contextlib import AbstractContextManager
|
||||
from dataclasses import dataclass
|
||||
from importlib.resources import as_file, files
|
||||
from pathlib import Path
|
||||
|
||||
VALID_THEME_NAME = re.compile(r"^[A-Za-z0-9_-]+$")
|
||||
|
||||
DEFAULT_CONFIG_PATHS = [
|
||||
Path("/etc/moongreet/moongreet.toml"),
|
||||
]
|
||||
@@ -56,7 +53,7 @@ def load_config(config_path: Path | None = None) -> Config:
|
||||
config.background = bg_path
|
||||
|
||||
gtk_theme = appearance.get("gtk-theme")
|
||||
if gtk_theme and VALID_THEME_NAME.match(gtk_theme):
|
||||
if gtk_theme:
|
||||
config.gtk_theme = gtk_theme
|
||||
|
||||
return config
|
||||
|
||||
@@ -2,12 +2,9 @@
|
||||
# ABOUTME: Provides User dataclass and helper functions for the greeter UI.
|
||||
|
||||
import configparser
|
||||
import re
|
||||
from dataclasses import dataclass
|
||||
from pathlib import Path
|
||||
|
||||
VALID_THEME_NAME = re.compile(r"^[A-Za-z0-9_-]+$")
|
||||
|
||||
NOLOGIN_SHELLS = {"/usr/sbin/nologin", "/sbin/nologin", "/bin/false", "/usr/bin/nologin"}
|
||||
MIN_UID = 1000
|
||||
MAX_UID = 65533
|
||||
@@ -106,8 +103,7 @@ def get_user_gtk_theme(config_dir: Path | None = None) -> str | None:
|
||||
|
||||
if config.has_option("Settings", "gtk-theme-name"):
|
||||
theme = config.get("Settings", "gtk-theme-name")
|
||||
# Validate against path traversal — only allow safe theme names
|
||||
if theme and VALID_THEME_NAME.match(theme):
|
||||
if theme:
|
||||
return theme
|
||||
|
||||
return None
|
||||
|
||||
Reference in New Issue
Block a user