This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env python3
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
"""Tracked guardrails for Phase-1.0AN."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import json
|
||||
from pathlib import Path
|
||||
import unittest
|
||||
|
||||
|
||||
PARSER = argparse.ArgumentParser()
|
||||
PARSER.add_argument("--root", type=Path, required=True)
|
||||
ROOT = PARSER.parse_args().root
|
||||
|
||||
|
||||
class Phase10ANGuardrails(unittest.TestCase):
|
||||
@classmethod
|
||||
def setUpClass(cls) -> None:
|
||||
cls.data = json.loads((ROOT / "manifests/retroarch/phase-1.0an-service-lifecycle-audit.json").read_text(encoding="utf-8"))
|
||||
|
||||
def test_fail_stop_is_not_promoted_to_recovery(self) -> None:
|
||||
lifecycle = self.data["service_lifecycle"]
|
||||
self.assertTrue(lifecycle["ptrace_auth_restore_failure_latched"])
|
||||
self.assertTrue(lifecycle["request_handler_process_exits_125"])
|
||||
self.assertFalse(lifecycle["service_restart_owner_present"])
|
||||
self.assertFalse(lifecycle["restart_identity_verification_present"])
|
||||
|
||||
def test_pt_copyin_remains_unproven(self) -> None:
|
||||
copy = self.data["copy_path"]
|
||||
self.assertFalse(copy["ptrace_io_descriptor_progress_checked"])
|
||||
self.assertFalse(copy["hard_deadline_or_preemption_present"])
|
||||
self.assertFalse(copy["safe_replacement_for_mdbg_copy_proven"])
|
||||
|
||||
def test_no_restart_reuse_or_authority(self) -> None:
|
||||
self.assertFalse(any(self.data["authorizations"].values()))
|
||||
self.assertFalse(self.data["decision"]["hardened_pt_copyin_reuse_allowed"])
|
||||
self.assertFalse(self.data["decision"]["automatic_service_restart_allowed"])
|
||||
self.assertFalse(self.data["decision"]["target_implementation_allowed"])
|
||||
self.assertFalse(self.data["decision"]["device_action_allowed"])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main(argv=[__file__])
|
||||
Reference in New Issue
Block a user