Linux x86_64 または aarch64、Python 3、curl、CA 証明書、書き込み可能なディレクトリが必要です。コードは取得と検証のみを行い、入口もインストーラーも実行しません。2026-10-20 に両アーキテクチャの公式パッケージを取得・検証しました。製品導入と実行時の受け入れは未実施です。
# Preparation only: this block NEVER runs an installer.
# Optional: use your own retained package instead of the current official entry.
# export MONKEYCODE_PACKAGE=/absolute/path/to/monkeycode-online-linux-ARCH.tgz
python3 - <<'PY'
import hashlib, json, os, pathlib, platform, re, shutil, subprocess, tarfile, tempfile
from urllib.parse import unquote, urlsplit
VERSION = "v261009"
PINS = {"amd64": "6dd439a994920e435137101a8953ec0843131110f07eb6ef48877c98d05344c4", "arm64": "ad42bf3ed93a651fb98652374ae44bd870b29288beed04e8cd28c8d2d18e1d35"}
HOST = "monkeycode-release.oss-cn-hangzhou.aliyuncs.com"
arch = {"x86_64": "amd64", "aarch64": "arm64", "arm64": "arm64"}.get(platform.machine())
if not arch:
raise SystemExit("STOP: unsupported architecture: " + platform.machine())
work = pathlib.Path(tempfile.mkdtemp(prefix="monkeycode-review-", dir=".")).resolve()
package = work / ("monkeycode-online-linux-" + arch + ".tgz")
def fetch(url, destination):
subprocess.run(["curl", "--proto", "=https", "--proto-redir", "=https", "--tlsv1.2",
"-fsSL", "--connect-timeout", "20", "--max-time", "180", url,
"-o", str(destination)], check=True)
try:
retained = os.environ.get("MONKEYCODE_PACKAGE")
if retained:
shutil.copyfile(pathlib.Path(retained).expanduser(), package)
else:
entry = work / "official-entry.txt"
fetch("https://monkeycode-ai.com/online/install", entry)
text = entry.read_text(encoding="utf-8")
def declaration(name):
values = re.findall(r'^' + name + r'="([^"\r\n]+)"$', text, re.M)
if len(values) != 1:
raise ValueError("missing or ambiguous entry declaration: " + name)
return values[0]
if declaration("VERSION") != VERSION:
raise ValueError("official release changed; review the new package before updating pins")
url = declaration(arch.upper() + "_URL")
parsed = urlsplit(url)
expected = "/online-package/" + VERSION + "/" + package.name
if (parsed.scheme != "https" or parsed.hostname != HOST or parsed.port not in (None, 443)
or parsed.username or parsed.password or parsed.fragment or unquote(parsed.path) != expected):
raise ValueError("unexpected package URL; review the official entry as text")
fetch(url, package)
actual = hashlib.sha256(package.read_bytes()).hexdigest()
if actual != PINS[arch]:
raise ValueError("package SHA-256 mismatch; do not extract or run it")
root = "monkeycode-online-linux-" + arch
required = {root + "/" + name for name in
("manifest.json", "docker-compose.yml", "package.env", "install.sh", "installer", ".env.example")}
with tarfile.open(package, "r:gz") as archive:
members = archive.getmembers()
names = [m.name for m in members]
if len(names) != len(set(names)) or set(names) != required | {root}:
raise ValueError("unexpected archive layout")
if sum(m.size for m in members) > 64 * 1024 * 1024:
raise ValueError("unexpected unpacked size")
for member in members:
safe = member.isdir() if member.name == root else member.isfile() and member.name in required
if not safe:
raise ValueError("unsafe archive member: " + member.name)
manifest = json.load(archive.extractfile(root + "/manifest.json"))
if manifest.get("version") != VERSION or manifest.get("arch") != arch or manifest.get("package_type") != "online":
raise ValueError("manifest version/architecture/type mismatch")
compose = archive.extractfile(root + "/docker-compose.yml").read()
if hashlib.sha256(compose).hexdigest() != manifest.get("compose_sha256"):
raise ValueError("compose SHA-256 mismatch")
# Package, manifest and archive checks all finish before extraction.
(work / root).mkdir()
for member in members:
if member.isfile():
target = work / member.name
target.write_bytes(archive.extractfile(member).read())
target.chmod(member.mode & 0o755)
(work / "verification.json").write_text(json.dumps({"version": VERSION, "arch": arch,
"package_sha256": actual, "manifest_commit": manifest.get("commit"),
"compose_sha256": manifest["compose_sha256"], "installer_executed": False}, indent=2) + "\n")
print("VERIFIED (download/archive only; NOT installed):", VERSION, arch, actual)
print("Review directory:", work / root)
print("Keep the .tgz and verification.json privately for this exact release.")
except Exception as error:
raise SystemExit("STOP: " + str(error) + "\nUntrusted files retained for inspection at: " + str(work)
+ "\nDo not run them. Retry in a new directory after resolving the cause.")
PY