fixed sec
This commit is contained in:
1 parent
86d4117773
commit
1b81962c03
2 files changed
+4
-5
No files matched your search
@@ -101,7 +101,7 @@ class AutomationDBConnection:
|
||||
def get_automation(self, automation_id: str) -> ExtenededAutomation:
|
||||
with self.get_cur() as cur:
|
||||
cur.execute(
|
||||
f'SELECT rest, source_file, source_file_type, configuration_key FROM {automations_tbl} WHERE id = "{automation_id}"'
|
||||
f'SELECT rest, source_file, source_file_type, configuration_key FROM {automations_tbl} WHERE id = "{automation_id}"' # nosec
|
||||
)
|
||||
objs = cur.fetchone()
|
||||
if objs is None:
|
||||
@@ -112,10 +112,10 @@ class AutomationDBConnection:
|
||||
def list_automations(self, offset: int, limit: int) -> Iterable[ExtenededAutomation]:
|
||||
with self.get_cur() as cur:
|
||||
for [rest, source_file, source_file_type, configuration_key] in cur.execute(
|
||||
f"SELECT rest, source_file, source_file_type, configuration_key FROM {automations_tbl} LIMIT {limit} OFFSET {offset}"
|
||||
f"SELECT rest, source_file, source_file_type, configuration_key FROM {automations_tbl} LIMIT {limit} OFFSET {offset}" # nosec
|
||||
):
|
||||
yield decode_auto(rest, source_file, source_file_type, configuration_key)
|
||||
|
||||
def count_automations(self) -> int:
|
||||
with self.get_cur() as cur:
|
||||
return cur.execute(f"SELECT count(id) FROM {automations_tbl}").fetchone()[0]
|
||||
return cur.execute(f"SELECT count(id) FROM {automations_tbl}").fetchone()[0] # nosec
|
||||
@@ -1,4 +1,3 @@
|
||||
from enum import auto
|
||||
from pathlib import Path
|
||||
from tempfile import mktemp
|
||||
from typing import Dict, Optional, Union
|
||||
@@ -32,7 +31,7 @@ class AutomationManager:
|
||||
db_path: Optional[Path] = None,
|
||||
) -> None:
|
||||
if db_path is None:
|
||||
db_path = Path(mktemp())
|
||||
db_path = Path(mktemp()) # nosec
|
||||
self.hass_config = hass_config
|
||||
self.db = AutomationDBConnection(db_path)
|
||||
self.tag_path = hass_config.get_automation_tags_path()
|
||||
|
||||
Reference in new issue
Block a user