From 743048ec600fa70e8df787ca9da777e95e961b8e Mon Sep 17 00:00:00 2001 From: Andrei Smaliak Date: Thu, 19 Nov 2026 16:06:37 +0100 Subject: [PATCH] Fix Debian canonical update feed and distinguish Cloudflare Git rejection --- docs/releases/console-3.1.42.md | 7 +++++++ offline/stage_versions.py | 8 ++++++++ offline/test_stage_versions.py | 12 ++++++++++++ stage-releases.json | 4 ++-- stage_itscreen/updater/client_updater.py | 2 +- stage_itscreen/updater/test_client_updater.py | 14 ++++++++++++++ stage_itscreen/version.json | 2 +- stage_ui/console_core/backend/app.py | 2 +- stage_ui/console_core/frontend/console.js | 2 +- stage_ui/console_core/frontend/index.html | 6 +++--- stage_ui/version.json | 2 +- 11 files changed, 51 insertions(+), 10 deletions(-) create mode 100644 docs/releases/console-3.1.42.md diff --git a/docs/releases/console-3.1.42.md b/docs/releases/console-3.1.42.md new file mode 100644 index 0000000..d06b15c --- /dev/null +++ b/docs/releases/console-3.1.42.md @@ -0,0 +1,7 @@ +# Console 3.1.42 — Git diagnostics and Debian update channel + +- Distinguish Cloudflare HTTP 403 / 1010 client-signature rejection from Git credential failures; do not expose HTTP response bodies or secrets. +- Publish `stage_itscreen` 1.0.41: the Debian updater reads `latest-iomatex.json`, whose binary URL matches its strict `git.iomatex.com` allowlist. Legacy `latest.json` remains available for old-domain clients. +- Preserve checksum/size/embedded-version checks, redirect refusal, installer lock and rollback. No client binary is replaced in the public repository. + +Validation: offline delivery/stage-version tests, Debian updater tests, Console stage-update API/UI contracts, and the active UAE Edge diagnostic recorded separately. diff --git a/offline/stage_versions.py b/offline/stage_versions.py index 04eca3e..fb08c80 100644 --- a/offline/stage_versions.py +++ b/offline/stage_versions.py @@ -116,6 +116,14 @@ def refresh(): error = 'The stage release catalog has not been published to Git yet.' elif exc.code in (401, 403): error = 'Git access was denied. Check the Edge Git credentials.' + # Cloudflare 1010 is a rejected HTTP client signature, not failed Git auth. + # Read only a bounded diagnostic marker; never expose the response body. + try: + blocked_client = exc.code == 403 and b'error code: 1010' in (exc.read(4096) or b'').lower() + except (OSError, AttributeError, TypeError): + blocked_client = False + if blocked_client: + error = 'Git network protection blocked this updater (HTTP 403, Cloudflare 1010). Update or restart Edge Console; check server access rules.' # Do not expose credentials, HTTP bodies or private paths in the API. delivery.write_json(STATE / 'available.json', { **previous, 'attempt_at': int(time.time()), 'error': error, diff --git a/offline/test_stage_versions.py b/offline/test_stage_versions.py index cf79337..86df3bd 100644 --- a/offline/test_stage_versions.py +++ b/offline/test_stage_versions.py @@ -275,6 +275,18 @@ class StageVersionsTest(unittest.TestCase): self.assertEqual(expected, versions.read_json(versions.STATE / 'available.json')['error']) self.assertFalse(self.snapshot()['can_install']) + def test_cloudflare_client_block_is_not_reported_as_bad_git_credentials(self): + from urllib.error import HTTPError + failure = HTTPError('https://git.iomatex.com/', 403, 'Forbidden', {}, + io.BytesIO(b'error code: 1010')) + with mock.patch.object(versions.delivery, 'open_git', side_effect=failure), \ + mock.patch.object(versions.delivery, 'auth_from_env', return_value={}): + versions.refresh() + error = versions.read_json(versions.STATE / 'available.json')['error'] + self.assertIn('Cloudflare 1010', error) + self.assertNotIn('credentials', error) + self.assertFalse(self.snapshot()['can_install']) + def test_release_check_refreshes_after_one_minute(self): for age, expected in [(59, False), (61, True)]: with self.subTest(age=age), mock.patch.object(versions, '_checking', False), \ diff --git a/stage-releases.json b/stage-releases.json index 836c324..3e4031f 100644 --- a/stage-releases.json +++ b/stage-releases.json @@ -14,7 +14,7 @@ "version": "1.0.1" }, "stage_ui": { - "version": "3.1.41" + "version": "3.1.42" }, "stage_avahi": { "version": "1.0.0" @@ -23,7 +23,7 @@ "version": "1.0.0" }, "stage_itscreen": { - "version": "1.0.40" + "version": "1.0.41" }, "stage_reverse_tunnels": { "version": "1.0.2" diff --git a/stage_itscreen/updater/client_updater.py b/stage_itscreen/updater/client_updater.py index 78ae4d0..b110221 100644 --- a/stage_itscreen/updater/client_updater.py +++ b/stage_itscreen/updater/client_updater.py @@ -22,7 +22,7 @@ import time import urllib.parse import urllib.request -FEED = 'https://git.iomatex.com/An-J/DOWNLOAD_IOMATEX_APP/raw/branch/main/edge-client/debian/latest.json' +FEED = 'https://git.iomatex.com/An-J/DOWNLOAD_IOMATEX_APP/raw/branch/main/edge-client/debian/latest-iomatex.json' PREFIX = 'https://git.iomatex.com/An-J/DOWNLOAD_IOMATEX_APP/raw/branch/main/edge-client/debian/releases/' BINARY = Path('/opt/itscreen/bin/itscreen') STATE = Path('/var/lib/iomatex/client-update') diff --git a/stage_itscreen/updater/test_client_updater.py b/stage_itscreen/updater/test_client_updater.py index d5bb69b..f4b6300 100644 --- a/stage_itscreen/updater/test_client_updater.py +++ b/stage_itscreen/updater/test_client_updater.py @@ -21,6 +21,20 @@ def manifest(): class TestUpdater(unittest.TestCase): + def test_manifest_requests_use_updater_user_agent(self): + opener = unittest.mock.Mock() + opener.open.return_value = io.BytesIO(json.dumps(manifest()).encode()) + with patch.object(c.urllib.request, 'build_opener', return_value=opener): + data = self.u.manifest() + request = opener.open.call_args.args[0] + self.assertEqual(c.FEED, request.full_url) + self.assertEqual('IomatexOS-Updater/1.0', request.get_header('User-agent')) + self.assertTrue(data['download_url'].startswith(c.PREFIX)) + + def test_feed_matches_strict_canonical_download_host(self): + # Legacy latest.json intentionally keeps git.it-screen.com URLs. + self.assertEqual(c.PREFIX.rsplit('/releases/', 1)[0] + '/latest-iomatex.json', c.FEED) + def setUp(self): self.tmp = tempfile.TemporaryDirectory() self.addCleanup(self.tmp.cleanup) diff --git a/stage_itscreen/version.json b/stage_itscreen/version.json index 4a62bf6..33f8321 100644 --- a/stage_itscreen/version.json +++ b/stage_itscreen/version.json @@ -1,3 +1,3 @@ { - "version": "1.0.40" + "version": "1.0.41" } diff --git a/stage_ui/console_core/backend/app.py b/stage_ui/console_core/backend/app.py index d5659b2..bc40097 100644 --- a/stage_ui/console_core/backend/app.py +++ b/stage_ui/console_core/backend/app.py @@ -62,7 +62,7 @@ APP_DIR = "/opt/iomatex-console" PUBLIC_DIR = os.path.join(APP_DIR, "public") PROVIDERS_DIR = os.path.join(APP_DIR, "providers.d") CONFIG_PATH = "/etc/iomatex/console.json" -UI_VERSION = "V 3.1.41" +UI_VERSION = "V 3.1.42" STORAGE_HEALTH_COMMAND = "/usr/local/sbin/iomatex-storage-health" ZONEINFO_ROOT = "/usr/share/zoneinfo" diff --git a/stage_ui/console_core/frontend/console.js b/stage_ui/console_core/frontend/console.js index aa9a758..c0f17ad 100644 --- a/stage_ui/console_core/frontend/console.js +++ b/stage_ui/console_core/frontend/console.js @@ -49,7 +49,7 @@ { mode: "test_by", label: "test.it-screen.by", host: "rest.test.it-screen.by" }, { mode: "custom", label: "Custom", host: "" } ]; - const UI_VERSION = "V 3.1.41"; + const UI_VERSION = "V 3.1.42"; const ITSCREEN_LOG_INITIAL_LINES = 50; const ITSCREEN_LOG_BUFFER_LIMIT = 300; const ITSCREEN_LOG_BATCH_MS = 250; diff --git a/stage_ui/console_core/frontend/index.html b/stage_ui/console_core/frontend/index.html index fab164a..c4fdd76 100644 --- a/stage_ui/console_core/frontend/index.html +++ b/stage_ui/console_core/frontend/index.html @@ -23,7 +23,7 @@ } catch (error) {} })(); - +
@@ -109,7 +109,7 @@
- - + + diff --git a/stage_ui/version.json b/stage_ui/version.json index aaa3c2f..44f30eb 100644 --- a/stage_ui/version.json +++ b/stage_ui/version.json @@ -1,3 +1,3 @@ { - "version": "3.1.41" + "version": "3.1.42" }