diff --git a/docs/releases/console-3.1.31.md b/docs/releases/console-3.1.31.md new file mode 100644 index 0000000..dde735b --- /dev/null +++ b/docs/releases/console-3.1.31.md @@ -0,0 +1,10 @@ +# Console 3.1.31 — persist migration from old installed bootstrap + +- Bench upgrade through the pre-migration Console revealed that the old running + bootstrap writes its old host into snapshot metadata and credentials before + invoking the new activator. Requests already normalize it, but stored values + must also migrate. +- The new activator now persists the canonical host in both source metadata and + credentials as well as the derived APT and stage-update configuration. +- Preserve credentials and their 0600 permissions; never expose them in logs. +- Includes the complete Console 3.1.30 module audit and new-domain-only retries. diff --git a/offline/git_delivery.py b/offline/git_delivery.py index 3347015..7e52a49 100644 --- a/offline/git_delivery.py +++ b/offline/git_delivery.py @@ -407,8 +407,14 @@ def activate(root): source = json.loads((root / '.iomatex-source.json').read_text()) repo_name('https://' + git_host(source.get('host', HOST)) + '/' + source['repo']) raw_endpoint('probe', source['commit']) - auth_from_env() # fail before modifying APT if reboot credentials are missing + auth = auth_from_env() # fail before modifying APT if reboot credentials are missing + auth['host'] = git_host(auth.get('host', HOST)) text, objects = catalog(root) + # An older bootstrap invokes this NEW activator but may have persisted its old host. + # Migrate both durable inputs here, not only the derived APT/stage configuration. + source['host'] = HOST + write_json(root / '.iomatex-source.json', source) + write_json(AUTH, auth, 0o600) STATE.mkdir(parents=True, exist_ok=True) (STATE / 'Packages').write_text(text) (STATE / 'Packages.gz').write_bytes(gzip.compress(text.encode(), mtime=0)) diff --git a/offline/test_git_delivery.py b/offline/test_git_delivery.py index 7ebebdf..5f3bb6e 100644 --- a/offline/test_git_delivery.py +++ b/offline/test_git_delivery.py @@ -31,6 +31,31 @@ class DeliveryTest(unittest.TestCase): d.download_object(config, 'debian/a.deb', Path(folder)/'a.deb', {'username': 'u', 'password': 'p'}) self.assertEqual('git.iomatex.com', request.call_args.args[2]['host']) + def test_new_activator_migrates_old_bootstrap_persisted_inputs(self): + with tempfile.TemporaryDirectory() as folder: + base = Path(folder) + root = base/'snapshot' + (root/'offline').mkdir(parents=True) + (root/'offline/git_delivery.py').write_text('# delivery owner') + (root/'.iomatex-source.json').write_text(json.dumps({ + 'host':'git.it-screen.com','repo':'An-J/Iomatex_OS','commit':'a'*40})) + (base/'etc/apt/apt.conf.d').mkdir(parents=True) + (base/'usr/lib/apt/methods').mkdir(parents=True) + auth = base/'auth.json' + def mapped(value): + return base/str(value).lstrip('/') if str(value).startswith(('/etc/apt','/usr/')) else Path(value) + with patch.object(d, 'platform_check'), patch.object(d, 'catalog', return_value=('',{})), \ + patch.object(d, 'auth_from_env', return_value={'username':'u','password':'p','host':'git.it-screen.com'}), \ + patch.object(d, 'STATE', base/'state'), patch.object(d, 'AUTH', auth), \ + patch.object(d, 'CACHE', base/'cache'), patch.object(d, 'Path', side_effect=mapped), \ + patch.object(d, 'cleanup'): + d.activate(root) + for path in [auth, root/'.iomatex-source.json', base/'state/source.json']: + self.assertEqual('git.iomatex.com', json.loads(path.read_text())['host']) + self.assertEqual('p', json.loads(auth.read_text())['password']) + self.assertEqual(0o600, auth.stat().st_mode & 0o777) + self.assertIn('iomatex://git.iomatex.com/', (base/'etc/apt/iomatex-offline.list').read_text()) + def test_payloads_excluded_from_edge_snapshot(self): for name in ['third_party/debian/bullseye-arm64/repo/a.deb', 'third_party/zigbee2mqtt/z.tar.gz', 'stage_itscreen/itscreen']: self.assertTrue(d.is_payload(name)) diff --git a/stage-releases.json b/stage-releases.json index ccd3e89..2b6f9c5 100644 --- a/stage-releases.json +++ b/stage-releases.json @@ -14,7 +14,7 @@ "version": "1.0.1" }, "stage_ui": { - "version": "3.1.30" + "version": "3.1.31" }, "stage_avahi": { "version": "1.0.0" diff --git a/stage_ui/version.json b/stage_ui/version.json index 6a2480f..ec50c94 100644 --- a/stage_ui/version.json +++ b/stage_ui/version.json @@ -1,3 +1,3 @@ { - "version": "3.1.30" + "version": "3.1.31" }