Fix Debian canonical update feed and distinguish Cloudflare Git rejection

This commit is contained in:
Andrei Smaliak 2026-11-19 16:06:37 +01:00
parent 4e58671b32
commit 743048ec60
11 changed files with 51 additions and 10 deletions

View File

@ -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.

View File

@ -116,6 +116,14 @@ def refresh():
error = 'The stage release catalog has not been published to Git yet.' error = 'The stage release catalog has not been published to Git yet.'
elif exc.code in (401, 403): elif exc.code in (401, 403):
error = 'Git access was denied. Check the Edge Git credentials.' 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. # Do not expose credentials, HTTP bodies or private paths in the API.
delivery.write_json(STATE / 'available.json', { delivery.write_json(STATE / 'available.json', {
**previous, 'attempt_at': int(time.time()), 'error': error, **previous, 'attempt_at': int(time.time()), 'error': error,

View File

@ -275,6 +275,18 @@ class StageVersionsTest(unittest.TestCase):
self.assertEqual(expected, versions.read_json(versions.STATE / 'available.json')['error']) self.assertEqual(expected, versions.read_json(versions.STATE / 'available.json')['error'])
self.assertFalse(self.snapshot()['can_install']) 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): def test_release_check_refreshes_after_one_minute(self):
for age, expected in [(59, False), (61, True)]: for age, expected in [(59, False), (61, True)]:
with self.subTest(age=age), mock.patch.object(versions, '_checking', False), \ with self.subTest(age=age), mock.patch.object(versions, '_checking', False), \

View File

@ -14,7 +14,7 @@
"version": "1.0.1" "version": "1.0.1"
}, },
"stage_ui": { "stage_ui": {
"version": "3.1.41" "version": "3.1.42"
}, },
"stage_avahi": { "stage_avahi": {
"version": "1.0.0" "version": "1.0.0"
@ -23,7 +23,7 @@
"version": "1.0.0" "version": "1.0.0"
}, },
"stage_itscreen": { "stage_itscreen": {
"version": "1.0.40" "version": "1.0.41"
}, },
"stage_reverse_tunnels": { "stage_reverse_tunnels": {
"version": "1.0.2" "version": "1.0.2"

View File

@ -22,7 +22,7 @@ import time
import urllib.parse import urllib.parse
import urllib.request 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/' PREFIX = 'https://git.iomatex.com/An-J/DOWNLOAD_IOMATEX_APP/raw/branch/main/edge-client/debian/releases/'
BINARY = Path('/opt/itscreen/bin/itscreen') BINARY = Path('/opt/itscreen/bin/itscreen')
STATE = Path('/var/lib/iomatex/client-update') STATE = Path('/var/lib/iomatex/client-update')

View File

@ -21,6 +21,20 @@ def manifest():
class TestUpdater(unittest.TestCase): 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): def setUp(self):
self.tmp = tempfile.TemporaryDirectory() self.tmp = tempfile.TemporaryDirectory()
self.addCleanup(self.tmp.cleanup) self.addCleanup(self.tmp.cleanup)

View File

@ -1,3 +1,3 @@
{ {
"version": "1.0.40" "version": "1.0.41"
} }

View File

@ -62,7 +62,7 @@ APP_DIR = "/opt/iomatex-console"
PUBLIC_DIR = os.path.join(APP_DIR, "public") PUBLIC_DIR = os.path.join(APP_DIR, "public")
PROVIDERS_DIR = os.path.join(APP_DIR, "providers.d") PROVIDERS_DIR = os.path.join(APP_DIR, "providers.d")
CONFIG_PATH = "/etc/iomatex/console.json" 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" STORAGE_HEALTH_COMMAND = "/usr/local/sbin/iomatex-storage-health"
ZONEINFO_ROOT = "/usr/share/zoneinfo" ZONEINFO_ROOT = "/usr/share/zoneinfo"

View File

@ -49,7 +49,7 @@
{ mode: "test_by", label: "test.it-screen.by", host: "rest.test.it-screen.by" }, { mode: "test_by", label: "test.it-screen.by", host: "rest.test.it-screen.by" },
{ mode: "custom", label: "Custom", host: "" } { 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_INITIAL_LINES = 50;
const ITSCREEN_LOG_BUFFER_LIMIT = 300; const ITSCREEN_LOG_BUFFER_LIMIT = 300;
const ITSCREEN_LOG_BATCH_MS = 250; const ITSCREEN_LOG_BATCH_MS = 250;

View File

@ -23,7 +23,7 @@
} catch (error) {} } catch (error) {}
})(); })();
</script> </script>
<link rel="stylesheet" href="/console.css?v=3.1.41&amp;rev=edge-runtime-profile-1"> <link rel="stylesheet" href="/console.css?v=3.1.42&amp;rev=edge-runtime-profile-1">
</head> </head>
<body> <body>
<main class="shell"> <main class="shell">
@ -109,7 +109,7 @@
</main> </main>
<div id="menuBackdrop" class="menuBackdrop" hidden></div> <div id="menuBackdrop" class="menuBackdrop" hidden></div>
<div id="toastStack" class="toastStack" aria-live="polite" aria-atomic="true"></div> <div id="toastStack" class="toastStack" aria-live="polite" aria-atomic="true"></div>
<script src="/console.i18n.js?v=3.1.41&amp;rev=edge-runtime-profile-1"></script> <script src="/console.i18n.js?v=3.1.42&amp;rev=edge-runtime-profile-1"></script>
<script src="/console.js?v=3.1.41&amp;rev=edge-runtime-profile-1"></script> <script src="/console.js?v=3.1.42&amp;rev=edge-runtime-profile-1"></script>
</body> </body>
</html> </html>

View File

@ -1,3 +1,3 @@
{ {
"version": "3.1.41" "version": "3.1.42"
} }