From 72aaecddcbbf965f7bab7bd783966e5125fcfb99 Mon Sep 17 00:00:00 2001 From: firestar5683 <168790843+firestar5683@users.noreply.github.com> Date: Sun, 15 Nov 2026 22:39:13 -0600 Subject: [PATCH] Preserve saved Toyota security keys during migration --- openpilot/starpilot/state_migration.py | 2 +- .../starpilot/tests/test_first_start_migration.py | 11 +++++++++++ prebuilt.json | 2 +- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/openpilot/starpilot/state_migration.py b/openpilot/starpilot/state_migration.py index 313af25465..55c61c04ae 100644 --- a/openpilot/starpilot/state_migration.py +++ b/openpilot/starpilot/state_migration.py @@ -27,7 +27,7 @@ OPERATIONAL_KEYS = frozenset({ 'DongleId', 'HardwareSerial', 'GithubSshKeys', 'GithubUsername', 'SshEnabled', 'AlphaLongitudinalEnabled', 'HasAcceptedTerms', 'CompletedTrainingVersion', 'CellularDisabled', 'GsmApn', 'GsmMetered', 'GsmRoaming', 'NetworkMetered', 'BluetoothEnabled', - 'ConnectProvider', 'PairingProvider', 'PairingEmail', 'PrimeType', 'AssistNowToken', 'SecOCKey', + 'ConnectProvider', 'PairingProvider', 'PairingEmail', 'PrimeType', 'AssistNowToken', 'SecOCKey', 'SecOCKeys', }) diff --git a/openpilot/starpilot/tests/test_first_start_migration.py b/openpilot/starpilot/tests/test_first_start_migration.py index ec7f7cc974..04258c9465 100644 --- a/openpilot/starpilot/tests/test_first_start_migration.py +++ b/openpilot/starpilot/tests/test_first_start_migration.py @@ -76,6 +76,17 @@ class TestFirstStartMigration(unittest.TestCase): self.assertNotIn('HasAcceptedTerms', self.values()) self.assertNotIn('CompletedTrainingVersion', self.values()) + def test_security_key_library_survives_preference_reset_and_restart(self): + self.types['SecOCKeys'] = 'STRING' + library = b'[{"name":"family car","value":"abababababababababababababababab"}]' + original = {'SecOCKey': b'ab' * 16, 'SecOCKeys': library, 'SteerFriction': b'0.2'} + self.write(original) + self.start() + self.assertEqual(self.values(), {'SecOCKey': original['SecOCKey'], 'SecOCKeys': library}) + self.assertEqual(migration.load_snapshot(next((self.storage / 'snapshots').iterdir())), original) + self.start() + self.assertEqual(self.values()['SecOCKeys'], library) + def test_alpha_longitudinal_preserves_both_values_and_later_changes(self): for value in (b'0', b'1'): with self.subTest(value=value), tempfile.TemporaryDirectory() as directory: diff --git a/prebuilt.json b/prebuilt.json index 3d2c795527..f15ab41bf2 100644 --- a/prebuilt.json +++ b/prebuilt.json @@ -1 +1 @@ -{"protected_inventory_sha256": "83237d06437bc81e92392b5a1195097519dab1837ab89231e5ffa09d7b60826f", "schema_version": 1} +{"protected_inventory_sha256": "4b56ae14d6ef04e25ad2d14af2db8eb05076511204b09a66cc4d74d1b970b848", "schema_version": 1}