From 3458dcc33aa07615dad66ba2b2ee643f874b5f22 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 12 Mar 2021 18:40:38 +0900 Subject: [PATCH] Use whitelist to avoid exposing settings to user that shouldn't be --- .../Settings/Sections/InputSection.cs | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/osu.Game/Overlays/Settings/Sections/InputSection.cs b/osu.Game/Overlays/Settings/Sections/InputSection.cs index 107e37909c..e6aaa1ade9 100644 --- a/osu.Game/Overlays/Settings/Sections/InputSection.cs +++ b/osu.Game/Overlays/Settings/Sections/InputSection.cs @@ -5,6 +5,8 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Sprites; using osu.Framework.Input.Handlers; +using osu.Framework.Input.Handlers.Joystick; +using osu.Framework.Input.Handlers.Midi; using osu.Framework.Input.Handlers.Mouse; using osu.Framework.Platform; using osu.Game.Configuration; @@ -50,11 +52,6 @@ private void load() private SettingsSubsection createSectionFor(InputHandler handler) { - var settingsControls = handler.CreateSettingsControlsFromAllBindables(false); - - if (settingsControls.Count == 0) - return null; - SettingsSubsection section; switch (handler) @@ -63,11 +60,21 @@ private SettingsSubsection createSectionFor(InputHandler handler) section = new MouseSettings(mh); break; - default: + // whitelist the handlers which should be displayed to avoid any weird cases of users touching settings they shouldn't. + case JoystickHandler _: + case MidiHandler _: section = new HandlerSection(handler); break; + + default: + return null; } + var settingsControls = handler.CreateSettingsControlsFromAllBindables(false); + + if (settingsControls.Count == 0) + return null; + section.AddRange(settingsControls); return section;