mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-19 04:46:08 +00:00
fix: keep verified Steam navigation
This commit is contained in:
1 parent
3ccf8ca01a
commit
ea8feebea7
6 files changed
+6
-7
No files matched your search
@@ -1053,7 +1053,7 @@ def handle(agent_dir, req):
|
||||
if kind == "steam-url":
|
||||
url = req.get("url")
|
||||
if not isinstance(url, str) or not re.fullmatch(
|
||||
r"steam://(?:open/downloads|nav/library|uninstall/[1-9][0-9]{0,9})", url):
|
||||
r"steam://(?:open/downloads|uninstall/[1-9][0-9]{0,9})", url):
|
||||
raise AgentError("INVALID_REQUEST", "Steam navigation URL is not supported")
|
||||
try:
|
||||
subprocess.Popen(["steam", url], stdin=subprocess.DEVNULL, stdout=subprocess.DEVNULL,
|
||||
|
||||
@@ -205,7 +205,7 @@ class AgentTest(unittest.TestCase):
|
||||
self.assertTrue(popen.call_args.kwargs["start_new_session"])
|
||||
|
||||
def test_steam_url_rejects_untrusted_routes_and_argument_injection(self):
|
||||
for url in ("steam://open/settings", "steam://open/downloads\n--exec", "https://example.com"):
|
||||
for url in ("steam://open/settings", "steam://nav/library", "steam://open/downloads\n--exec", "https://example.com"):
|
||||
with self.subTest(url=url), patch.object(agent.subprocess, "Popen") as popen:
|
||||
answer = self.ask({"kind": "steam-url", "url": url})
|
||||
self.assertFalse(answer["ok"])
|
||||
|
||||
Reference in new issue
Block a user