Fix Debian canonical update feed and distinguish Cloudflare Git rejection
This commit is contained in:
parent
4e58671b32
commit
743048ec60
|
|
@ -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.
|
||||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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), \
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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')
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
{
|
||||
"version": "1.0.40"
|
||||
"version": "1.0.41"
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@
|
|||
} catch (error) {}
|
||||
})();
|
||||
</script>
|
||||
<link rel="stylesheet" href="/console.css?v=3.1.41&rev=edge-runtime-profile-1">
|
||||
<link rel="stylesheet" href="/console.css?v=3.1.42&rev=edge-runtime-profile-1">
|
||||
</head>
|
||||
<body>
|
||||
<main class="shell">
|
||||
|
|
@ -109,7 +109,7 @@
|
|||
</main>
|
||||
<div id="menuBackdrop" class="menuBackdrop" hidden></div>
|
||||
<div id="toastStack" class="toastStack" aria-live="polite" aria-atomic="true"></div>
|
||||
<script src="/console.i18n.js?v=3.1.41&rev=edge-runtime-profile-1"></script>
|
||||
<script src="/console.js?v=3.1.41&rev=edge-runtime-profile-1"></script>
|
||||
<script src="/console.i18n.js?v=3.1.42&rev=edge-runtime-profile-1"></script>
|
||||
<script src="/console.js?v=3.1.42&rev=edge-runtime-profile-1"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
{
|
||||
"version": "3.1.41"
|
||||
"version": "3.1.42"
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue