mirror of
https://github.com/shadowsocks/ShadowsocksX-NG.git
synced 2026-11-22 13:34:00 +00:00
Pin sslocal v1.25.0 (aarch64-apple-darwin) and v2ray-plugin v1.3.2 via committed manifests (tag + asset URL + archive SHA-256 + bundle location + sign identifier): - Scripts/fetch-external-binaries.sh downloads the pinned archive, verifies its SHA-256 byte-for-byte, extracts only the named member (arm64-only check) and stamps the local cache; archive hash mismatch fails hard, and any manifest/local-artifact drift forces a re-verified refetch. It re-runs as a pre-build phase so tampering fails the build itself. - project.yml installs both binaries via Copy Files into Contents/Helpers[/Plugins]; generate requires the artifacts to exist (fetch before generate, else Copy Files phases are silently dropped). - Scripts/sign-embedded-helpers.sh re-signs each helper Developer ID with --options runtime --timestamp and the pinned identifier (<bundle-id>[.plugin.]<name>) before Xcode seals the outer app signature. - Scripts/packaging-gate.sh asserts strict nested signature verification, DevID + Hardened Runtime on the app with no App Sandbox entitlement, and exact per-binary manifest coverage under Contents/Helpers. - Tests pin both manifests' schema and anchor hashes. Verified: build + gate all green; byte-flip, foreign-binary and missing-binary tampers each caught; 5 unit tests pass; no submodules or in-repo builds; notarization stays out of scope (#39).
52 lines
2.1 KiB
Bash
Executable File
52 lines
2.1 KiB
Bash
Executable File
#!/bin/sh
|
|
# Re-sign every embedded helper binary with the Developer ID identity before
|
|
# Xcode signs the app itself (spec #21 D6/D10).
|
|
#
|
|
# Upstream ships these binaries ad-hoc signed; they must carry our Developer ID
|
|
# signature with Hardened Runtime and a stable code-signing identifier so the
|
|
# outer app seal, notarization and Gatekeeper cover them. Xcode runs this as a
|
|
# post-build script phase and applies the app's own signature afterwards, so
|
|
# the outer signature embeds the re-signed nested code.
|
|
#
|
|
# The identifier scheme is pinned in the manifests: <bundle-id>.<name> for
|
|
# sslocal, <bundle-id>.plugin.<name> for SIP003 plugins.
|
|
|
|
set -eu
|
|
|
|
SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd)
|
|
. "$SCRIPT_DIR/lib-manifests.sh"
|
|
|
|
SRCROOT=${SRCROOT:?SRCROOT not set}
|
|
BUILT_PRODUCTS_DIR=${BUILT_PRODUCTS_DIR:?BUILT_PRODUCTS_DIR not set}
|
|
CONTENTS_FOLDER_PATH=${CONTENTS_FOLDER_PATH:?CONTENTS_FOLDER_PATH not set}
|
|
PRODUCT_BUNDLE_IDENTIFIER=${PRODUCT_BUNDLE_IDENTIFIER:?PRODUCT_BUNDLE_IDENTIFIER not set}
|
|
|
|
IDENTITY=${EXPANDED_CODE_SIGN_IDENTITY:-${EXPANDED_CODE_SIGN_IDENTITY_NAME:-${CODE_SIGN_IDENTITY:-}}}
|
|
[ -n "$IDENTITY" ] || {
|
|
echo "error: no code signing identity (EXPANDED_CODE_SIGN_IDENTITY empty)" >&2
|
|
exit 1
|
|
}
|
|
|
|
CONTENTS="$BUILT_PRODUCTS_DIR/$CONTENTS_FOLDER_PATH"
|
|
tmproot=$(mktemp -d "${TMPDIR:-/tmp}/ng2-sign.XXXXXX")
|
|
trap 'rm -rf "$tmproot"' EXIT INT TERM
|
|
|
|
manifests=$(VENDOR_DIR="$SRCROOT/Vendor" vendor_manifests) || exit 1
|
|
for manifest in $manifests; do
|
|
plist="$tmproot/manifest.plist"
|
|
manifest_to_plist "$manifest" "$plist"
|
|
binary=$(manifest_field "$plist" binary "$manifest")
|
|
subpath=$(manifest_field "$plist" bundleSubpath "$manifest")
|
|
identifier=$(manifest_field "$plist" signIdentifier "$manifest")
|
|
|
|
target="$CONTENTS/$subpath/$binary"
|
|
[ -f "$target" ] || {
|
|
echo "error: embedded helper missing: $target (check the Copy Files phase in project.yml)" >&2
|
|
exit 1
|
|
}
|
|
|
|
codesign --force --sign "$IDENTITY" --timestamp --options runtime \
|
|
--identifier "$identifier" "$target"
|
|
echo "sign($binary): $identifier"
|
|
done
|