Fix candidate build metadata and runtime safeguards
Offline project checks / check (push) Canceled after 0s
Offline project checks / check (push) Canceled after 0s
Repair kernel patch formatting and refresh kernel/camera package revisions and checksums. Integrate battery guard into generated images, correct charging controls and emergency shutdown handling, and reject invalid camera authentication configuration. Extend recipe validation and regression coverage, and update build and installation documentation. Kernel, camera and image compilation remain pending on the build server.
This commit is contained in:
@@ -321,21 +321,25 @@ class Audio:
|
||||
|
||||
|
||||
def load_auth(path):
|
||||
if not path or not path.exists():
|
||||
if path is None:
|
||||
return None
|
||||
try:
|
||||
data = json.loads(path.read_text())
|
||||
if not isinstance(data, dict):
|
||||
except FileNotFoundError:
|
||||
if not path.is_symlink():
|
||||
return None
|
||||
if not data.get('enabled', True):
|
||||
return None
|
||||
user = data.get('username')
|
||||
pwd = data.get('password')
|
||||
if user and pwd:
|
||||
return {'username': str(user), 'password': str(pwd)}
|
||||
except Exception:
|
||||
pass
|
||||
return None
|
||||
raise ValueError('Authentication configuration is unavailable') from None
|
||||
except (OSError, ValueError):
|
||||
raise ValueError('Authentication configuration cannot be read') from None
|
||||
if not isinstance(data, dict) or type(data.get('enabled', True)) is not bool:
|
||||
raise ValueError('Invalid authentication configuration')
|
||||
if data.get('enabled') is False:
|
||||
return None
|
||||
user, pwd = data.get('username'), data.get('password')
|
||||
if (not isinstance(user, str) or not user or ':' in user or
|
||||
not isinstance(pwd, str) or not pwd):
|
||||
raise ValueError('Authentication requires a username and password')
|
||||
return {'username': user, 'password': pwd}
|
||||
|
||||
|
||||
def make_handler(camera, shutdown, audio=None, auth=None):
|
||||
|
||||
Reference in New Issue
Block a user