machine: validate web_request args

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Eric Callahan 2023-02-18 20:22:24 -05:00
parent 2d70511474
commit 4281c4d978
No known key found for this signature in database
GPG Key ID: 5A1EB336DFB4C71B
1 changed files with 2 additions and 2 deletions

View File

@ -303,7 +303,7 @@ class Machine:
self.server.get_event_loop().create_task(wrapper())
async def _handle_service_request(self, web_request: WebRequest) -> str:
name: str = web_request.get('service')
name: str = web_request.get_str('service')
action = web_request.get_endpoint().split('/')[-1]
if name == self.unit_name:
if action != "restart":
@ -389,7 +389,7 @@ class Machine:
async def _handle_sudo_info(
self, web_request: WebRequest
) -> Dict[str, Any]:
check_access = web_request.get("check_access", False)
check_access = web_request.get_boolean("check_access", False)
has_sudo: Optional[bool] = None
if check_access:
has_sudo = await self.check_sudo_access()