Publish reviewed history-free open-source snapshot (2026-10-12)
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
|
||||
root_dir=$(CDPATH= cd -- "$(dirname "$0")/.." && pwd)
|
||||
vendor_dir="$root_dir/Vendor"
|
||||
destination="$vendor_dir/LibXray.xcframework"
|
||||
archive_url="https://github.com/XTLS/libXray/releases/download/v26.7.28/libxray-apple-cgo.zip"
|
||||
expected_sha256="07f7ed7697277930e1c517755855950f594f41435b0dfc5917a66eea6278aeb9"
|
||||
|
||||
if [ -d "$destination" ]; then
|
||||
echo "LibXray.xcframework 已存在。"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
work_dir=$(mktemp -d "${TMPDIR:-/tmp}/ucvl-libxray.XXXXXX")
|
||||
trap 'rm -rf "$work_dir"' EXIT INT TERM
|
||||
archive_path="$work_dir/libxray-apple-cgo.zip"
|
||||
|
||||
curl --fail --location --retry 3 --output "$archive_path" "$archive_url"
|
||||
actual_sha256=$(shasum -a 256 "$archive_path" | awk '{print tolower($1)}')
|
||||
if [ "$actual_sha256" != "$expected_sha256" ]; then
|
||||
echo "libXray SHA256 校验失败。" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
unzip -q "$archive_path" -d "$work_dir/unpacked"
|
||||
framework_path=$(find "$work_dir/unpacked" -type d -name LibXray.xcframework -print -quit)
|
||||
if [ -z "$framework_path" ]; then
|
||||
echo "官方压缩包中没有 LibXray.xcframework。" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p "$vendor_dir"
|
||||
mv "$framework_path" "$destination"
|
||||
echo "已安装并校验 libXray v26.7.28。"
|
||||
@@ -0,0 +1,8 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
cd "$(dirname "$0")/.."
|
||||
command -v xcodegen >/dev/null 2>&1 || {
|
||||
echo "请先安装 XcodeGen:brew install xcodegen" >&2
|
||||
exit 1
|
||||
}
|
||||
xcodegen generate
|
||||
@@ -0,0 +1,122 @@
|
||||
from __future__ import annotations
|
||||
|
||||
import hashlib
|
||||
import json
|
||||
import plistlib
|
||||
import re
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
ROOT = Path(__file__).resolve().parent.parent
|
||||
EXPECTED = [
|
||||
"project.yml",
|
||||
"App/AppState.swift",
|
||||
"App/ContentView.swift",
|
||||
"App/PlatformAPI.swift",
|
||||
"App/VPNController.swift",
|
||||
"PacketTunnel/PacketTunnelProvider.swift",
|
||||
"PacketTunnel/XrayBridge.swift",
|
||||
"Shared/Models.swift",
|
||||
"Shared/TunnelConfigurationBuilder.swift",
|
||||
"Shared/NetworkAddress.swift",
|
||||
"Tests/TunnelConfigurationBuilderTests.swift",
|
||||
"Tests/ClientConfigResponseTests.swift",
|
||||
"Shared/ConnectionAttemptPolicy.swift",
|
||||
"Tests/ConnectionAttemptPolicyTests.swift",
|
||||
]
|
||||
|
||||
|
||||
def require(condition: bool, message: str) -> None:
|
||||
if not condition:
|
||||
raise RuntimeError(message)
|
||||
|
||||
|
||||
def main() -> int:
|
||||
for relative in EXPECTED:
|
||||
require((ROOT / relative).is_file(), f"缺少文件:{relative}")
|
||||
|
||||
for relative in ("App/Info.plist", "PacketTunnel/Info.plist", "App/UCVLZonghengjia.entitlements", "PacketTunnel/PacketTunnel.entitlements"):
|
||||
with (ROOT / relative).open("rb") as stream:
|
||||
value = plistlib.load(stream)
|
||||
if relative.endswith("entitlements"):
|
||||
require(
|
||||
"packet-tunnel-provider" in value.get("com.apple.developer.networking.networkextension", []),
|
||||
f"Network Extension 权限缺失:{relative}",
|
||||
)
|
||||
|
||||
project = (ROOT / "project.yml").read_text(encoding="utf-8")
|
||||
version_match = re.search(r'MARKETING_VERSION:\s*"(\d+\.\d+\.\d+)"', project)
|
||||
require(version_match is not None, "缺少规范的源码版本号")
|
||||
source_version = version_match.group(1)
|
||||
readme = (ROOT / "README.md").read_text(encoding="utf-8")
|
||||
require(f"{source_version} 源码候选版" in readme.splitlines()[0]
|
||||
and f"版本 `{source_version}`" in readme, "README 与工程版本不一致")
|
||||
require("cn.toplc.zonghengjia.PacketTunnel" in project, "Packet Tunnel Bundle ID 缺失")
|
||||
require('iOS: "15.0"' in project, "iOS 最低版本与验收基线不一致")
|
||||
|
||||
app_state = (ROOT / "App/AppState.swift").read_text(encoding="utf-8")
|
||||
api = (ROOT / "App/PlatformAPI.swift").read_text(encoding="utf-8")
|
||||
tunnel = (ROOT / "PacketTunnel/PacketTunnelProvider.swift").read_text(encoding="utf-8")
|
||||
require("selectedNodeID" not in app_state, "客户端仍暴露节点选择")
|
||||
require('URLQueryItem(name: "node", value: "auto")' in api, "未启用后台自动选节点")
|
||||
require("verifyProxyEgress" in api and "verifyProxyEgress" in app_state, "缺少出口验证")
|
||||
require("resolveIPv4Address" in tunnel and "excludedRoutes" in tunnel, "缺少节点域名防回环处理")
|
||||
require("dns.alidns.com/resolve" in api and "doh.pub/resolve" in api, "缺少国内 DoH 真实地址解析")
|
||||
require("NetworkAddress.isPublicIPv4" in api and "NetworkAddress.isPublicIPv4" in tunnel, "未拒绝 Fake-IP/内网地址")
|
||||
require("response.gateway" in app_state and "configContract" in (ROOT / "Shared/Models.swift").read_text(encoding="utf-8"), "未兼容后台网关契约")
|
||||
require("vpn.status == .connected" in app_state, "出口验证后未复核系统 VPN 状态")
|
||||
require("ConnectionAttemptPolicy.decide" in app_state and "attemptedNode" in app_state,
|
||||
"未区分控制面、本地授权与节点出口故障")
|
||||
|
||||
secret_pattern = re.compile(
|
||||
r"(?i)(password|passwd|private[_-]?key)['\"]?\s*[:=]\s*['\"][^'\"]{4,}['\"]"
|
||||
)
|
||||
findings: list[str] = []
|
||||
for path in ROOT.rglob("*"):
|
||||
if not path.is_file() or any(part in {".git", "Vendor", "BuildArtifacts"} for part in path.parts):
|
||||
continue
|
||||
if path.suffix.lower() not in {".swift", ".yml", ".yaml", ".json", ".md", ".sh", ".py", ".plist"}:
|
||||
continue
|
||||
text = path.read_text(encoding="utf-8", errors="ignore")
|
||||
if secret_pattern.search(text):
|
||||
findings.append(str(path.relative_to(ROOT)))
|
||||
require(not findings, "疑似明文凭据:" + ", ".join(findings))
|
||||
|
||||
vendor_archive = ROOT / "Vendor/libxray-apple-cgo-v26.7.28.zip"
|
||||
vendor_result = "not-present"
|
||||
if vendor_archive.is_file():
|
||||
digest = hashlib.sha256(vendor_archive.read_bytes()).hexdigest()
|
||||
require(digest == "07f7ed7697277930e1c517755855950f594f41435b0dfc5917a66eea6278aeb9", "libXray 本地归档 SHA256 不匹配")
|
||||
vendor_result = digest
|
||||
|
||||
geo_files = [ROOT / "Resources/Geo/geoip.dat", ROOT / "Resources/Geo/geosite.dat"]
|
||||
geo_present = [path.is_file() for path in geo_files]
|
||||
require(all(geo_present) or not any(geo_present), "Geo data must be supplied as a complete pair")
|
||||
geo_status = "present-not-verified-by-source-audit" if all(geo_present) else "not-packaged"
|
||||
|
||||
report = {
|
||||
"result": "PASS",
|
||||
"source_version": source_version,
|
||||
"geo_data_status": geo_status,
|
||||
"geo_data_required_before_build_and_tunnel": True,
|
||||
"documentation_version_matches": True,
|
||||
"scope": "Source audit only; no Xcode compile, signing, IPA export, or iPhone tunnel acceptance",
|
||||
"automatic_node_selection": True,
|
||||
"egress_verification": ["api.openai.com", "chatgpt.com"],
|
||||
"domain_loop_prevention": True,
|
||||
"gateway_contract": 2,
|
||||
"legacy_backend_compatible": True,
|
||||
"network_extension_entitlement": True,
|
||||
"libxray_archive_sha256": vendor_result,
|
||||
}
|
||||
print(json.dumps(report, ensure_ascii=False, indent=2))
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
try:
|
||||
raise SystemExit(main())
|
||||
except Exception as exc:
|
||||
print(json.dumps({"result": "FAIL", "error": str(exc)}, ensure_ascii=False, indent=2), file=sys.stderr)
|
||||
raise SystemExit(1)
|
||||
@@ -0,0 +1,35 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
cd "$(dirname "$0")/.."
|
||||
test -n "${DEVELOPMENT_TEAM:-}" || {
|
||||
echo "请设置 DEVELOPMENT_TEAM(Apple Developer Team ID)。" >&2
|
||||
exit 1
|
||||
}
|
||||
./Scripts/fetch-libxray.sh
|
||||
./Scripts/generate-project.sh
|
||||
xcodebuild \
|
||||
-project UCVLZonghengjia.xcodeproj \
|
||||
-scheme UCVLZonghengjia \
|
||||
-destination 'platform=iOS Simulator,name=iPhone 16 Pro' \
|
||||
DEVELOPMENT_TEAM="$DEVELOPMENT_TEAM" \
|
||||
test
|
||||
xcodebuild \
|
||||
-project UCVLZonghengjia.xcodeproj \
|
||||
-scheme UCVLZonghengjia \
|
||||
-configuration Release \
|
||||
-destination 'generic/platform=iOS' \
|
||||
-archivePath build/UCVL-Zonghengjia-1.0.0.xcarchive \
|
||||
DEVELOPMENT_TEAM="$DEVELOPMENT_TEAM" \
|
||||
archive
|
||||
|
||||
if [ -n "${EXPORT_OPTIONS_PLIST:-}" ]; then
|
||||
test -f "$EXPORT_OPTIONS_PLIST" || {
|
||||
echo "EXPORT_OPTIONS_PLIST 指定的文件不存在。" >&2
|
||||
exit 1
|
||||
}
|
||||
xcodebuild \
|
||||
-exportArchive \
|
||||
-archivePath build/UCVL-Zonghengjia-1.0.0.xcarchive \
|
||||
-exportPath build/export \
|
||||
-exportOptionsPlist "$EXPORT_OPTIONS_PLIST"
|
||||
fi
|
||||
Reference in New Issue
Block a user