Skip to content

Commit

Permalink
Evaluate live keyboard sources safely
Browse files Browse the repository at this point in the history
  • Loading branch information
VladimirSlavik committed Dec 7, 2023
1 parent a468ced commit 8c5ef01
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions pyanaconda/modules/localization/live_keyboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
#

from abc import ABC, abstractmethod
import ast
from pyanaconda.core.util import execWithCaptureAsLiveUser
from pyanaconda.core.configuration.anaconda import conf

Expand Down Expand Up @@ -81,8 +82,8 @@ def _convert_to_xkb_format(self, sources):
# convert input "[('xkb', 'us'), ('xkb', 'cz+qwerty')]\n"
# to a python list of '["us", "cz (qwerty)"]'
try:
sources = eval(sources.rstrip())
except SyntaxError:
sources = ast.literal_eval(sources.rstrip())
except (SyntaxError, ValueError, TypeError):
log.error("Gnome Shell keyboard configuration can't be obtained from source %s!",
sources)
return []
Expand Down

0 comments on commit 8c5ef01

Please sign in to comment.