From 819bc9f2bcc0e3fa90ae21b7522c1a3b27ad481f Mon Sep 17 00:00:00 2001 From: "swu-codex[bot]" <344783151+swu-codex[bot]@users.noreply.github.com> Date: Sat, 21 Nov 2026 12:46:40 +0000 Subject: [PATCH 1/4] =?UTF-8?q?[CODEX:=E2=80=8A=E2=80=8A=E2=80=8AEE.1.S]?= =?UTF-8?q?=20Publish=20The=20Frozen=20Reviewed=20Source=20Composition?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/ios-fleet.sha256 | 6 +- scripts/ios-fleet/asc-api.mjs | 119 +------ scripts/ios-fleet/asc-key.mjs | 18 +- scripts/ios-fleet/ship-testflight.sh | 170 ++------- scripts/ios-fleet/test-asc-credentials.sh | 403 ++++++---------------- scripts/ios-fleet/test-asc-key.test.mjs | 137 ++++++-- 6 files changed, 278 insertions(+), 575 deletions(-) diff --git a/scripts/ios-fleet.sha256 b/scripts/ios-fleet.sha256 index 14e085263..99e578962 100644 --- a/scripts/ios-fleet.sha256 +++ b/scripts/ios-fleet.sha256 @@ -1,9 +1,9 @@ # sha256 pin for the in-repo iOS ship tooling in scripts/ios-fleet. # GitHub-hosted macos-latest ships from this copy, not /Users/jay/apps/ios-fleet. # Refresh with: bash scripts/ios-fleet-pin.sh --update (then land it in a PR) -645a5e07868f416cbd30270505f052ff4f3f0fb11efbfb26783c7a2b36d07304 ship-testflight.sh -ae1a380d41ed8ee9f19b99d7a420a0fab4d5352e2fb300e8625b423cffb2ecd5 asc-api.mjs -1d57b7bb3c76bf73f6ed932bfc34a937a2aa8ea1aa483d60d3ae0849576ec595 asc-key.mjs +3003ba1ad74d8dacacc2f37a23fb9688825cf85705fd292f90cd3e00edd94096 ship-testflight.sh +5b0ce96ab38418ae5c3b083550985b145fa66b5cb3b4fde4820a2ebfd0655c37 asc-api.mjs +b73de468651ab800d0efea38ae3a620e85801e87b5954e195f07fc30435a2644 asc-key.mjs 3de97aa5b28a8f15571eb4ec3c34436d720b99bd43f852c320387d57ea3927ca apps.json b41b09704f40be9e0a14a66ec302589d763b03ef65baf37437c00fdaa55287d0 AppUpdatePrompt.swift c2f45059b2462a1c6d0c204999cb6da3c50ea2d74b5d829254b143a252dff221 version-plan.mjs diff --git a/scripts/ios-fleet/asc-api.mjs b/scripts/ios-fleet/asc-api.mjs index 9cab5e95f..837dc551e 100644 --- a/scripts/ios-fleet/asc-api.mjs +++ b/scripts/ios-fleet/asc-api.mjs @@ -3,17 +3,13 @@ * Minimal App Store Connect API client. No dependencies beyond Node's * built-in crypto (ES256 JWT signing) and fetch (Node 18+). * - * Auth (AFC-459): the first source that is present (never prints values): + * Auth: complete Infisical-synced environment tuples, in order: * 1. APPLE_API_KEY_ID / APPLE_API_ISSUER_ID / APPLE_API_KEY_P8_BASE64 - * (the base64 p8 is decoded to a 0600 temp file and removed on exit) - * 2. ASC_KEY_ID / ASC_ISSUER_ID / ASC_KEY_P8 in the environment - * 3. Infisical Fleet-OPS /asc via `fleet-secrets get` + * 2. ASC_KEY_ID / ASC_ISSUER_ID / ASC_KEY_P8 * - * A caller-supplied file is NOT a credential source (AFC-459): the private key - * is a secret, and the approved sources are the process environment, a - * captured `fleet-secrets get NAME` and bootstrap-only Keychain credentials. - * The shell layer that owns the credential hands the key over in ASC_KEY_P8, - * so ASC_KEY_PATH never reaches this client as a path to read. + * A caller-supplied file is not a credential source. The owning shell stages + * keys for Apple tools separately; this client signs with the in-memory PEM. + * Partial tuples never combine, and an invalid complete preferred tuple fails. * * Usage: * node asc-api.mjs GET /v1/apps @@ -32,11 +28,9 @@ * echoing anything secret-shaped from the response (ASC responses don't * carry credentials, only app metadata, so this is safe to print as-is). */ -import { readFileSync, writeFileSync, mkdtempSync, rmSync, chmodSync, realpathSync } from "node:fs"; +import { readFileSync, realpathSync } from "node:fs"; import { execFileSync } from "node:child_process"; import { createHash, createSign } from "node:crypto"; -import { homedir, tmpdir } from "node:os"; -import { join } from "node:path"; import { pathToFileURL } from "node:url"; import { normalizePrivateKey } from "./asc-key.mjs"; import { nextSharedBuild } from "./shared-build.mjs"; @@ -53,29 +47,9 @@ function base64url(input) { // --------------------------------------------------------------------------- // CREDENTIAL RESOLUTION // --------------------------------------------------------------------------- -// WHY THIS READS THE ENVIRONMENT, NOT A FILE (fixed 2026-10-02, AFC-359): -// .github/workflows/ios-ship.yml runs on a GitHub-hosted macos-latest runner, -// which has no home-directory secrets folder at all. The credential reaches that -// runner as THREE ENVIRONMENT VARIABLES -- APPLE_API_KEY_ID, -// APPLE_API_ISSUER_ID and APPLE_API_KEY_P8_BASE64 -- exported into $GITHUB_ENV -// by .github/actions/infisical-secrets. Reading only the file meant the key -// material could be present and correct while the client still refused to -// authenticate, and because the version queries in ship-testflight.sh discard -// this script's stderr, the resulting rc=2 was undiagnosable from the run log. -// -// APPLE_API_KEY_P8_BASE64 is base64, so it is decoded into a 0600 file inside a -// 0700 temp directory and unlinked on exit. Values are never printed; only the -// source and the key-id LENGTH are logged. -const TEMP_KEY_DIRS = []; - -function cleanupTempKeys() { - while (TEMP_KEY_DIRS.length) { - const dir = TEMP_KEY_DIRS.pop(); - try { rmSync(dir, { recursive: true, force: true }); } catch { /* best effort */ } - } -} -process.on("exit", cleanupTempKeys); - +// The owning producer syncs these values from Infisical. This consumer never +// discovers a reader, logs in, reads a credential file or borrows another tuple. +// Apple tools need a staging file; this API client only needs the in-memory PEM. // Accepts either a raw PEM (some callers store the .p8 body verbatim) or the // base64 encoding GitHub Actions + Infisical use. Returns null when the input // cannot be turned into a PEM, so the caller can fail with a real reason. @@ -92,83 +66,27 @@ function decodeP8(b64) { return pem.includes("-----BEGIN ") ? pem : null; } -function materializeP8(pem) { - const dir = mkdtempSync(join(tmpdir(), "asc-key-")); - try { chmodSync(dir, 0o700); } catch { /* best effort */ } - const p = join(dir, "AuthKey.p8"); - writeFileSync(p, pem, { mode: 0o600 }); - TEMP_KEY_DIRS.push(dir); - return p; -} - -// Infisical Fleet-OPS through `fleet-secrets get` (AFC-359). "" when absent. -// FLEET_SECRETS_BIN overrides the binary (tests). Values stay in memory. -function fleetSecretsGet(name, folder) { - const bin = process.env.FLEET_SECRETS_BIN || join(homedir(), ".local", "bin", "fleet-secrets"); - try { - return execFileSync(bin, ["get", name, "--path", folder], { - encoding: "utf8", - stdio: ["ignore", "pipe", "ignore"], - timeout: 30000 - }).replace(/\n$/, ""); - } catch { - return ""; - } -} - -// Returns { keyId, issuerId, privateKeyPem, source } or { error } or { error: null }. -// -// The order is the rule: the environment beats the network, and a file is not -// a source at all. A path on disk is not an approved secret source, so -// ASC_KEY_PATH is never read here; the shell layer that owns the credential -// resolves it and hands the key over in ASC_KEY_P8. +// Returns a complete credential, a fixed error, or an absent credential. function resolveCredential() { - const envKeyId = String(process.env.ASC_KEY_ID || "").trim(); - const envIssuer = String(process.env.ASC_ISSUER_ID || "").trim(); - const envKeyPem = String(process.env.ASC_KEY_P8 || "").trim(); - - // 1) The APPLE_API_* trio the ship workflow exports from Infisical. The key - // itself is in the environment, so it wins over every other source. const keyId = String(process.env.APPLE_API_KEY_ID || "").trim(); const issuerId = String(process.env.APPLE_API_ISSUER_ID || "").trim(); - if (keyId && issuerId && process.env.APPLE_API_KEY_P8_BASE64) { - const pem = decodeP8(process.env.APPLE_API_KEY_P8_BASE64); + const hostedKey = String(process.env.APPLE_API_KEY_P8_BASE64 || "").trim(); + if (keyId && issuerId && hostedKey) { + if (!/^[A-Za-z0-9]+$/.test(keyId)) return { error: "APPLE_API_KEY_ID must contain only letters and digits" }; + const pem = normalizePrivateKey(decodeP8(hostedKey)); if (!pem) return { error: "APPLE_API_KEY_P8_BASE64 is set but did not decode to a PEM private key" }; - materializeP8(pem); return { keyId, issuerId, privateKeyPem: pem, source: "APPLE_API_* environment (base64 p8)" }; } - // 2) The same secret as a plain environment variable. This is the form - // fleet-secrets hands out, and the form the shell layer uses when it hands - // the resolved key to this client. + const envKeyId = String(process.env.ASC_KEY_ID || "").trim(); + const envIssuer = String(process.env.ASC_ISSUER_ID || "").trim(); + const envKeyPem = String(process.env.ASC_KEY_P8 || "").trim(); if (envKeyId && envIssuer && envKeyPem) { + if (!/^[A-Za-z0-9]+$/.test(envKeyId)) return { error: "ASC_KEY_ID must contain only letters and digits" }; const pem = normalizePrivateKey(envKeyPem); if (!pem) return { error: "ASC_KEY_P8 is set but is not a PEM private key" }; return { keyId: envKeyId, issuerId: envIssuer, privateKeyPem: pem, source: "ASC_KEY_P8 environment" }; } - - // 3) No file is read here (AFC-459). A path on disk is not an approved - // secret source, so ASC_KEY_PATH is not a credential source here: the - // shell layer that owns the credential resolves it and exports it as - // ASC_KEY_P8. The step below reads Infisical directly, so a local - // operator needs nothing exported at all. - - // 4) Infisical Fleet-OPS /asc: key id and issuer (unless the environment already - // has them) and the PEM as ASC_KEY_P8 when the key id is the /asc one; another - // key id falls back to AUTHKEY_ in /authkey--p8. - // Kept in memory, never written to disk. - const infKeyId = envKeyId || fleetSecretsGet("ASC_KEY_ID", "/asc").trim(); - const infIssuer = envIssuer || fleetSecretsGet("ASC_ISSUER_ID", "/asc").trim(); - if (/^[A-Za-z0-9]+$/.test(infKeyId) && infIssuer) { - let pem = ""; - if (infKeyId === fleetSecretsGet("ASC_KEY_ID", "/asc").trim()) pem = fleetSecretsGet("ASC_KEY_P8", "/asc"); - if (!pem) pem = fleetSecretsGet(`AUTHKEY_${infKeyId}`, `/authkey-${infKeyId.toLowerCase()}-p8`); - if (pem) { - if (!pem.endsWith("\n")) pem += "\n"; - return { keyId: infKeyId, issuerId: infIssuer, privateKeyPem: pem, source: "Infisical /asc" }; - } - } - return { error: null }; } @@ -837,7 +755,6 @@ async function main() { "asc-auth: no App Store Connect credential found. Tried, in order:\n" + " 1) APPLE_API_KEY_ID / APPLE_API_ISSUER_ID / APPLE_API_KEY_P8_BASE64 in the environment\n" + " 2) ASC_KEY_ID / ASC_ISSUER_ID / ASC_KEY_P8 in the environment\n" + - " 3) Infisical Fleet-OPS /asc via `fleet-secrets get` (FLEET_SECRETS_BIN)\n" + " A path in ASC_KEY_PATH is not a credential source: the shell layer that owns the\n" + " credential hands the key over in ASC_KEY_P8" ); diff --git a/scripts/ios-fleet/asc-key.mjs b/scripts/ios-fleet/asc-key.mjs index dbd523beb..1d0dcbaac 100644 --- a/scripts/ios-fleet/asc-key.mjs +++ b/scripts/ios-fleet/asc-key.mjs @@ -3,12 +3,9 @@ * The App Store Connect private key: how it is validated, and how it is * staged for the Apple tools that need a key file. * - * WHY THIS IS ITS OWN MODULE (2026-10-21, Kody rule 42 on PR #271): - * The private key is a secret, and the fleet's approved secret sources are the - * process environment, a captured `fleet-secrets get NAME`, and bootstrap-only - * Keychain credentials. A caller-supplied local file is not one of them, so - * nothing here reads a key file: the only approved sources of the key are - * process.env.ASC_KEY_P8 and `fleet-secrets get ASC_KEY_P8`. + * Credentials arrive as complete Infisical-synced environment tuples. + * This helper validates and stages the supplied key; it never discovers a + * reader, logs in or reads a caller-supplied credential file. * * ASC_KEY_PATH IS NOT A CREDENTIAL SOURCE (2026-10-21, Kody rule 42 on PR * #271): not as a fallback, not as a lower priority, not at all. A named @@ -64,7 +61,7 @@ export function normalizePrivateKey(value) { // file is created with mode 600 whatever the umask of the caller says. The // file is a staging copy for the Apple tools that need a key on disk, and it // is never read back as a credential: the credential comes from the -// environment or from fleet-secrets. +// Infisical-synced environment. export function writePrivateKeyFile(keyPath, value) { const pem = normalizePrivateKey(value); if (!pem) return { error: "the value is not a PEM private key" }; @@ -82,8 +79,7 @@ export function writePrivateKeyFile(keyPath, value) { // wholesale copy hands every credential on the operator's machine to the // child, including the ones that have nothing to do with App Store Connect. // These are the variables the client reads (see resolveCredential in -// asc-api.mjs), plus PATH and HOME, which it needs to find fleet-secrets and -// to reach the bootstrap Keychain. +// asc-api.mjs), plus the ordinary process context needed by the child. export const CLIENT_ENV_ALLOWLIST = [ "PATH", "HOME", @@ -96,9 +92,7 @@ export const CLIENT_ENV_ALLOWLIST = [ "ASC_ISSUER_ID", "APPLE_API_KEY_ID", "APPLE_API_ISSUER_ID", - "APPLE_API_KEY_P8_BASE64", - "FLEET_SECRETS_BIN", - "FLEET_SECRETS" + "APPLE_API_KEY_P8_BASE64" ]; // Builds the environment a child of the key handoff runs with. diff --git a/scripts/ios-fleet/ship-testflight.sh b/scripts/ios-fleet/ship-testflight.sh index 57f9feaee..57478498a 100755 --- a/scripts/ios-fleet/ship-testflight.sh +++ b/scripts/ios-fleet/ship-testflight.sh @@ -95,7 +95,7 @@ # fleet runners). # # Secrets (never printed): -# Infisical Fleet-OPS via `fleet-secrets get` (AFC-359; no handoff file is read): +# Complete Infisical-synced environment tuples (no handoff file is read): # ASC_KEY_ID, ASC_ISSUER_ID, ASC_KEY_P8 folder /asc (ASC_KEY_P8 is the .p8 text; # written to a 0600 temp dir for the life of the ship, # pointed at by API_PRIVATE_KEYS_DIR, removed on exit) @@ -103,7 +103,7 @@ # is NOT a credential source: a named path is ignored, and the key is handed to # the client in ASC_KEY_P8. # or Xcode-signed-in session for destination=upload export -# SENTRY_AUTH_TOKEN (dSYM + Size Analysis upload; env or Infisical via fleet-secrets) +# SENTRY_AUTH_TOKEN (dSYM + Size Analysis upload; synced environment only) # SENTRY_DSN (injected into xcodebuild so Cocoa plist $(SENTRY_DSN) is set) # # Sentry after a successful archive (2026-09-01): @@ -129,7 +129,6 @@ ASC_NODE="${IOS_FLEET_NODE:-node}" FLEET_DIR="$(cd "$(dirname "$0")" && pwd)" APPS_JSON="${FLEET_DIR}/apps.json" TEAM_ID="CC8UTF7ATG" -FLEET_SECRETS_BIN="${FLEET_SECRETS_BIN:-${HOME}/.local/bin/fleet-secrets}" ARCHIVE_LOCK_DIR="" ASC_TMP_DIR="" # 0700 temp dir holding the .p8 for this run (removed by asc_cleanup) ASC_LINKED_KEY="" # AuthKey_.p8 this run copied into ~/.appstoreconnect/private_keys @@ -235,22 +234,6 @@ asc_cleanup() { fi } -# One value: environment first, then Infisical Fleet-OPS via fleet-secrets. -# Prints the value (no trailing newline) or nothing. Never logs it. -# -# A third argument of "infisical" skips the environment, so the caller can ask -# what /asc holds even when the environment names another key id: the /asc key -# id and the key id in the environment are two different questions, and the -# credential resolution needs the answer to both. -asc_secret() { - local name="$1" folder="${2:-/}" v="${!1:-}" - if [[ "${3:-}" == "infisical" ]]; then v=""; fi - if [[ -z "$v" && -x "$FLEET_SECRETS_BIN" ]]; then - v="$("$FLEET_SECRETS_BIN" get "$name" --path "$folder" 2>/dev/null /dev/null 2>&1 && return 0 return 1 } @@ -275,101 +256,40 @@ trap ship_exit EXIT # exported ASC_* vars are discarded with the subshell). Sets AUTH_MODE to # "api_key" or "none". Never prints secret values. # -# WHY THE KEY IS HANDED OVER IN THE ENVIRONMENT (AFC-459): -# The private key is a secret, and the approved secret sources are the process -# environment, a captured `fleet-secrets get NAME` and bootstrap-only Keychain -# credentials. A caller-supplied file is not one of them, so the node client -# never reads a key file. This shell layer already owns the credential for -# altool and Xcode, so it hands the key to the client in the environment, -# which is where the client looks for it. -# -# THE CREDENTIAL IS RESOLVED FROM THREE PLACES (AFC-459): -# 1. The hosted APPLE_API_* trio, whose p8 body is base64 -# 2. ASC_KEY_P8, when it holds a PEM private key and comes with its key id -# and the issuer it belongs to -# 3. Infisical Fleet-OPS /asc (or /authkey--p8) -# A disk credential is not a source at all: a named ASC_KEY_PATH is ignored, -# so a stale or foreign path in an operator's shell can never sign the upload -# with the wrong key, and App Store Connect can never answer "401" without the -# run saying which input was wrong. The key material never enters a command -# argument and never reaches a log line. +# Only complete Infisical-synced environment tuples are sources. The hosted +# APPLE_API_* tuple wins; a complete invalid preferred tuple fails without +# falling back. Partial tuples never combine. ASC_KEY_PATH is staging output +# for Apple tools, never an input credential for this loader or the API client. load_secrets() { AUTH_MODE="none" - local kid="${ASC_KEY_ID:-}" iss="${ASC_ISSUER_ID:-}" fkid="" lower - local key_pem="" key_path="" rc=0 - # A named ASC_KEY_PATH is not a credential source. It is remembered only - # so the run can say that it ignored it. + local kid="" iss="" key_pem="" key_path="" local named_path="${ASC_KEY_PATH:-}" - # 1. The hosted APPLE_API_* trio: the key id, the issuer and the key belong - # together, so all three names have to be there. The p8 body is base64. if [[ -n "${APPLE_API_KEY_ID:-}" && -n "${APPLE_API_ISSUER_ID:-}" && -n "${APPLE_API_KEY_P8_BASE64:-}" ]]; then + kid="$APPLE_API_KEY_ID" + iss="$APPLE_API_ISSUER_ID" case "$APPLE_API_KEY_P8_BASE64" in *BEGIN*) key_pem="$APPLE_API_KEY_P8_BASE64" ;; *) key_pem="$(printf '%s' "$APPLE_API_KEY_P8_BASE64" | base64 -d 2>/dev/null)" || key_pem="" ;; esac - if [[ -n "$key_pem" ]]; then - kid="${APPLE_API_KEY_ID}" - iss="${APPLE_API_ISSUER_ID}" - else - key_pem="" - fi + elif [[ -n "${ASC_KEY_ID:-}" && -n "${ASC_ISSUER_ID:-}" && -n "${ASC_KEY_P8:-}" ]]; then + kid="$ASC_KEY_ID" + iss="$ASC_ISSUER_ID" + key_pem="$ASC_KEY_P8" + else + log "ASC credentials missing: provide a complete Infisical-synced APPLE_API_* or ASC_* tuple" + unset ASC_KEY_P8 + return 0 fi - - # 2. The plain environment trio. It is only usable when it really is a PEM - # private key and comes with the key id and issuer it belongs to. It is - # validated and never printed. An unusable key is dropped from the - # environment as well, so no child can pick it up. - if [[ -z "$key_pem" && -n "${ASC_KEY_P8:-}" ]]; then - if [[ -z "$kid" || -z "$iss" ]]; then - log "ASC_KEY_P8 is set without ASC_KEY_ID and ASC_ISSUER_ID; ignoring it" - unset ASC_KEY_P8 - else - rc=0 - node "${FLEET_DIR}/asc-key.mjs" validate >/dev/null 2>&1 <<< "$ASC_KEY_P8" || rc=$? - if [[ "$rc" -ne 0 ]]; then - log "ASC_KEY_P8 is set but does not hold a PEM private key; ignoring it" - unset ASC_KEY_P8 - else - key_pem="$ASC_KEY_P8" - fi - fi + if [[ ! "$kid" =~ ^[A-Za-z0-9]+$ ]]; then + log "ASC key id has an unexpected shape; not staging the key" + unset ASC_KEY_P8 + return 0 fi - - # 3. The key id, issuer and private key must belong together: with nothing - # named in the environment all three come from /asc; an env key id that - # is not the /asc one gets its own .p8 from /authkey--p8, never the - # /asc key. - if [[ -z "$key_pem" ]]; then - [[ -n "$kid" ]] || kid="${APPLE_API_KEY_ID:-}" - [[ -n "$iss" ]] || iss="${APPLE_API_ISSUER_ID:-}" - fkid="$(asc_secret ASC_KEY_ID /asc infisical)" || fkid="" - if [[ -z "$kid" ]]; then - kid="$fkid" - iss="$(asc_secret ASC_ISSUER_ID /asc infisical)" || iss="" - elif [[ -z "$iss" && "$kid" == "$fkid" ]]; then - # env named the /asc key itself: its issuer is the /asc one - iss="$(asc_secret ASC_ISSUER_ID /asc infisical)" || iss="" - fi - if [[ -z "$kid" || -z "$iss" ]]; then - log "ASC credentials missing: set ASC_KEY_ID/ASC_ISSUER_ID/ASC_KEY_P8 or add ASC_KEY_ID, ASC_ISSUER_ID and ASC_KEY_P8 to Infisical /asc" - return 0 - fi - if [[ ! "$kid" =~ ^[A-Za-z0-9]+$ ]]; then - log "ASC_KEY_ID has an unexpected shape; not staging the key" - return 0 - fi - if [[ "$kid" == "$fkid" ]]; then - key_pem="$(asc_secret ASC_KEY_P8 /asc infisical)" || key_pem="" - fi - if [[ -z "$key_pem" ]]; then - lower="$(printf '%s' "$kid" | tr 'A-Z' 'a-z')" - key_pem="$(asc_secret "AUTHKEY_${kid}" "/authkey-${lower}-p8" infisical)" || key_pem="" - fi - if [[ -z "$key_pem" ]]; then - log "missing the .p8 for key ${kid}: Infisical /asc ASC_KEY_P8 (the /asc key) or /authkey--p8 AUTHKEY_" - return 0 - fi + if ! node "${FLEET_DIR}/asc-key.mjs" validate >/dev/null 2>&1 <<< "$key_pem"; then + log "ASC private key is invalid; not staging the key" + unset ASC_KEY_P8 + return 0 fi # The key has to be in a mode-600 file for altool and Xcode, and in the @@ -394,7 +314,7 @@ load_secrets() { export ASC_KEY_P8="$key_pem" key_pem="" if [[ -n "$named_path" && "$named_path" != "$key_path" ]]; then - log "ASC_KEY_PATH is not a credential source; the credential came from the environment or from Infisical" + log "ASC_KEY_PATH is not a credential source; the credential came from the Infisical-synced environment" fi AUTH_MODE="api_key" return 0 @@ -414,20 +334,7 @@ sentry_project_for_app() { esac } -# Pull SENTRY_AUTH_TOKEN from the handoff file if the environment does not -# already have it. Names-only grep trap: extract into a var, never echo. -load_sentry_auth() { - if [[ -n "${SENTRY_AUTH_TOKEN:-}" ]]; then - return 0 - fi - # OPS-818: read from Infisical Fleet-OPS via fleet-secrets, not the retired flat file. - local fs_bin="/Users/jay/.local/bin/fleet-secrets" - if [[ -x "$fs_bin" ]]; then - SENTRY_AUTH_TOKEN="$("$fs_bin" get SENTRY_AUTH_TOKEN 2>/dev/null || true)" - export SENTRY_AUTH_TOKEN - fi -} - +# Optional Sentry uploads use only the owning producer's synced environment. # After a successful archive: upload dSYMs and Size Analysis. Never fail the # TestFlight ship if Sentry is missing or the upload errors. upload_sentry_artifacts() { @@ -442,7 +349,6 @@ upload_sentry_artifacts() { log "sentry: archive missing; skipping artifact upload" return 0 fi - load_sentry_auth if [[ -z "${SENTRY_AUTH_TOKEN:-}" ]]; then log "sentry: SENTRY_AUTH_TOKEN unset; skipping dSYM / Size Analysis upload" return 0 @@ -773,10 +679,10 @@ asc_latest_marketing_patch() { return 1 fi # A credential SOURCE has to exist. The client resolves the credential - # itself (the environment first, then Infisical /asc), so this is only the + # itself (complete synced environment tuples), so this is only the # "is there any source at all" check. - if [[ -z "${ASC_KEY_ID:-}" && -z "${APPLE_API_KEY_ID:-}" && ! -x "$FLEET_SECRETS_BIN" ]] && ! command -v fleet-secrets >/dev/null 2>&1; then - logerr "asc-patch: no ASC_* in env and no fleet-secrets; cannot verify against App Store Connect" + if ! asc_credential_available; then + logerr "asc-patch: no complete synced ASC credential tuple; cannot verify against App Store Connect" return 1 fi # The credential is resolved here (AFC-359): this runs in a @@ -821,8 +727,8 @@ asc_build_floor() { logerr "asc-floor: node not on PATH; cannot verify against App Store Connect" return 1 fi - if [[ -z "${ASC_KEY_ID:-}" && -z "${APPLE_API_KEY_ID:-}" && ! -x "$FLEET_SECRETS_BIN" ]] && ! command -v fleet-secrets >/dev/null 2>&1; then - logerr "asc-floor: no ASC_* in env and no fleet-secrets; cannot verify against App Store Connect" + if ! asc_credential_available; then + logerr "asc-floor: no complete synced ASC credential tuple; cannot verify against App Store Connect" return 1 fi if [[ "${AUTH_MODE:-none}" != "api_key" ]]; then @@ -1361,7 +1267,7 @@ sys.exit(0 if a>b else 1)' "$FIXED_MARKETING" "$_rel"; then _rc=$? if [[ $_rc -eq 4 ]]; then die "App Store Connect rejected the API key (HTTP 401/403) while reading the next marketing version. - Fix the key (ASC_* in env or Infisical /asc; fleet-secrets doctor) and re-run. + Fix the key (the complete Infisical-synced ASC credential tuple) and re-run. --allow-unverified-seq does not cover a rejected credential: the upload would fail with it too." fi set -e @@ -1373,7 +1279,7 @@ sys.exit(0 if a>b else 1)' "$FIXED_MARKETING" "$_rel"; then record of which patches that train already holds: guessing would ship a version that already exists (or skip one that does not). Fix one of these, then re-run: - 1) restore ASC access: check ASC_* in env or Infisical /asc (fleet-secrets doctor) and that 'node' is on PATH, then + 1) restore ASC access: check the complete Infisical-synced ASC credential tuple and that 'node' is on PATH, then run: node ${FLEET_DIR}/asc-api.mjs latest-marketing-patch ${BUNDLE_ID} ${MARKETING_PREFIX} ${ASC_PLATFORM} 2) or pin the version explicitly: --version --version is honoured exactly, so the marketing version no longer needs @@ -1424,7 +1330,7 @@ sys.exit(0 if a>b else 1)' "$FIXED_MARKETING" "$_rel"; then _rc=$? if [[ $_rc -eq 4 ]]; then die "App Store Connect rejected the API key (HTTP 401/403) while reading the build floor. - Fix the key (ASC_* in env or Infisical /asc; fleet-secrets doctor) and re-run. + Fix the key (the complete Infisical-synced ASC credential tuple) and re-run. --allow-unverified-seq does not cover a rejected credential: the upload would fail with it too." fi set -e @@ -1436,7 +1342,7 @@ sys.exit(0 if a>b else 1)' "$FIXED_MARKETING" "$_rel"; then builds, and App Store Connect is the only record of them: a build number that is not greater is rejected as a duplicate. Fix one of these, then re-run: - 1) restore ASC access: check ASC_* in env or Infisical /asc (fleet-secrets doctor) and that 'node' is on PATH, then + 1) restore ASC access: check the complete Infisical-synced ASC credential tuple and that 'node' is on PATH, then run: node ${FLEET_DIR}/asc-api.mjs build-floor ${BUNDLE_ID} ${MARKETING} ${ASC_PLATFORM} 2) or pass the build number explicitly: --build --build is honoured exactly: CFBundleVersion becomes N. It must be @@ -1553,7 +1459,7 @@ fi if [[ -n "$UPLOAD_ONLY_IPA" ]]; then [[ -f "$UPLOAD_ONLY_IPA" ]] || die "package not found: $UPLOAD_ONLY_IPA" - [[ "$AUTH_MODE" == "api_key" ]] || die "upload-only requires App Store Connect credentials (env, or Infisical /asc)" + [[ "$AUTH_MODE" == "api_key" ]] || die "upload-only requires a complete Infisical-synced ASC credential tuple" link_private_key "$ASC_KEY_PATH" "$ASC_KEY_ID" log "uploading existing package via altool (api key)" set +e @@ -1777,7 +1683,7 @@ if [[ "$AUTH_MODE" != "api_key" ]]; then log "Owner handoff:" log " 1) Create ASC API key (App Manager+) in App Store Connect" log " 2) Store it in Infisical Fleet-OPS /asc: ASC_KEY_ID, ASC_ISSUER_ID and ASC_KEY_P8 (the .p8 text)" - log " 3) Check with: fleet-secrets names --path /asc" + log " 3) Have the owning producer sync the complete ASC tuple into this job" log " 4) Re-run: bash $0 $APP_KEY --upload-only \"$PACKAGE\"" log "Also ensure App Store Connect has an app record for ${BUNDLE_ID}." exit 3 diff --git a/scripts/ios-fleet/test-asc-credentials.sh b/scripts/ios-fleet/test-asc-credentials.sh index 57be4bdf4..7cfccb5ed 100644 --- a/scripts/ios-fleet/test-asc-credentials.sh +++ b/scripts/ios-fleet/test-asc-credentials.sh @@ -1,216 +1,111 @@ #!/usr/bin/env bash -# AFC-459: ship-testflight.sh resolves App Store Connect credentials from the -# environment first, then from Infisical through fleet-secrets, and never from a -# path on disk. -# -# The private key is handed over in the environment, never as a path the node -# client reads. The shell layer owns the credential, so this test drives -# load_secrets with a FAKE fleet-secrets binary and throwaway keys generated -# here at test time. No network, no real secrets, and no committed key. -# -# A named ASC_KEY_PATH is not a credential source at all: it is ignored, and -# the run says so in a log line. +# Exercise the production shell credential functions with generated keys and +# disposable process environments. No reader, provider or native tool runs. set -euo pipefail - here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" script="${here}/ship-testflight.sh" tmp="$(mktemp -d)" -# The throwaway HOME lives inside the temp dir, so the cleanup has to run with -# the real HOME in place: a trash helper that protects the home directory -# refuses to remove a parent of it. -real_home="${HOME}" -trap 'HOME="$real_home" rm -rf "$tmp"' EXIT -export HOME="${tmp}/home" -export TMPDIR="${tmp}/tmp" -mkdir -p "$HOME" "$TMPDIR" - +trap 'rm -rf "$tmp"' EXIT fail() { echo "FAIL: $*" >&2; exit 1; } - -# A throwaway key pair, generated here and never committed. The client parses -# a PEM before it accepts it, so a fake envelope is not a key. -gen_pem() { - node -e 'process.stdout.write(require("crypto").generateKeyPairSync("ec", { namedCurve: "prime256v1" }).privateKey.export({ type: "pkcs8", format: "pem" }))' +mkdir -p "$tmp/home" "$tmp/tmp" "$tmp/bin" + +# Only extract the existing production functions, never execute ship startup. +awk ' + /^(asc_cleanup|asc_credential_available|load_secrets|asc_latest_marketing_patch|asc_build_floor|sentry_project_for_app|upload_sentry_artifacts)\(\) \{/ { grab = 1 } + grab { print } + grab && /^\}/ { grab = 0 } +' "$script" > "$tmp/functions.sh" + +cat > "$tmp/cases.cjs" <<'JS' +const assert = require("node:assert/strict"); +const fs = require("node:fs"); +const path = require("node:path"); +const { generateKeyPairSync } = require("node:crypto"); +const { execFileSync } = require("node:child_process"); +const [root, fleet] = process.argv.slice(2); +const key = () => generateKeyPairSync("ec", { namedCurve: "prime256v1" }).privateKey.export({ type: "pkcs8", format: "pem" }); +const plainPem = key(), hostedPem = key(); +const plain = { ASC_KEY_ID: "PLAIN001", ASC_ISSUER_ID: "plain-issuer", ASC_KEY_P8: plainPem }; +const hosted = { APPLE_API_KEY_ID: "HOSTED001", APPLE_API_ISSUER_ID: "hosted-issuer", APPLE_API_KEY_P8_BASE64: Buffer.from(hostedPem).toString("base64") }; +const marker = path.join(root, "tool-ran"); +const home = path.join(root, "home"); +const bin = path.join(root, "bin"); +fs.mkdirSync(path.join(home, ".local", "bin"), { recursive: true }); +for (const name of ["fleet-secrets", "infisical", "security", "curl", "sentry-cli"]) { + const trap = '#!/bin/sh\nprintf ran > "$TRAP_MARKER"\nexit 91\n'; + fs.writeFileSync(path.join(bin, name), trap, { mode: 0o700 }); + fs.writeFileSync(path.join(home, ".local", "bin", name), trap, { mode: 0o700 }); } -gen_pem > "${tmp}/asc.p8" -gen_pem > "${tmp}/other.p8" -chmod 600 "${tmp}/asc.p8" "${tmp}/other.p8" - -# Fake fleet-secrets: prints synthetic values, records the folders it was asked for. -cat > "${tmp}/fleet-secrets" <<'FAKE' -#!/usr/bin/env bash -[[ "$1" == get ]] || exit 2 -name="$2"; folder="$4" -echo "${name} ${folder}" >> "${FAKE_LOG}" -case "${folder}:${name}" in - /asc:ASC_KEY_ID) printf 'ABCDE12345\n' ;; - /asc:ASC_ISSUER_ID) printf 'issuer-synthetic\n' ;; - /asc:ASC_KEY_P8) cat "${FAKE_ASC_PEM}" ;; - /authkey-otherkey01-p8:AUTHKEY_OTHERKEY01) cat "${FAKE_OTHER_PEM}" ;; - *) exit 3 ;; -esac -FAKE -chmod +x "${tmp}/fleet-secrets" -export FAKE_LOG="${tmp}/fake.log" -export FAKE_ASC_PEM="${tmp}/asc.p8" -export FAKE_OTHER_PEM="${tmp}/other.p8" -: > "$FAKE_LOG" - -extract() { - awk ' - /^asc_secret\(\) \{/ || /^load_secrets\(\) \{/ || /^asc_cleanup\(\) \{/ { grab = 1 } - grab { print } - grab && /^\}/ { grab = 0 } - ' "$script" +const named = path.join(root, "named.p8"); +fs.writeFileSync(named, hostedPem, { mode: 0o600 }); +fs.writeFileSync(path.join(root, "plain.p8"), plainPem, { mode: 0o600 }); +fs.writeFileSync(path.join(root, "hosted.p8"), hostedPem, { mode: 0o600 }); +fs.writeFileSync(path.join(root, "verify.cjs"), ` +const assert = require("node:assert/strict"); +const fs = require("node:fs"); +const crypto = require("node:crypto"); +const hash = (s) => crypto.createHash("sha256").update(s.trim()).digest("hex"); +assert.equal(hash(process.env.ASC_KEY_P8), hash(fs.readFileSync(process.argv[2], "utf8"))); +assert.equal(hash(fs.readFileSync(process.env.ASC_KEY_PATH, "utf8")), hash(process.env.ASC_KEY_P8)); +assert.equal(fs.statSync(process.env.ASC_KEY_PATH).mode & 511, 384); +assert.equal(fs.statSync(process.env.API_PRIVATE_KEYS_DIR).mode & 511, 448); +assert.ok(!process.argv.some((arg) => arg.includes(process.env.ASC_KEY_P8))); +`); +const base = { + PATH: [bin, path.dirname(process.execPath), "/usr/bin", "/bin"].join(":"), + HOME: home, TMPDIR: path.join(root, "tmp"), FLEET_DIR: fleet, + ASC_NODE: process.execPath, NODE_EXE: process.execPath, FIXTURE_ROOT: root, + TRAP_MARKER: marker, FLEET_SECRETS_BIN: path.join(bin, "fleet-secrets"), + ASC_KEY_PATH: named +}; +const setup = `set -euo pipefail +source "$FIXTURE_ROOT/functions.sh" +ASC_TMP_DIR=""; ASC_LINKED_KEY="" +log() { :; }; logerr() { :; } +asc_client() { printf ran > "$TRAP_MARKER"; return 91; } +trap asc_cleanup EXIT +`; +function run(tuple, body) { + let output; + try { + output = execFileSync("/bin/bash", ["-c", setup + body], { + env: { ...base, ...tuple }, encoding: "utf8", timeout: 15000, + killSignal: "SIGKILL", maxBuffer: 65536, stdio: ["ignore", "pipe", "pipe"] + }); + } catch { throw new Error("isolated shell credential case failed"); } + assert.equal(output, ""); + assert.ok(!fs.existsSync(marker), "a reader, provider or optional uploader ran"); + assert.deepEqual(fs.readdirSync(base.TMPDIR), [], "shell staging survived cleanup"); } - -# The comparison tool. It answers through the exit code only, so a -# credential is never expanded into the shell, where a trace would show it. -# -# same the value in VALUE_TO_COMPARE equals the file -# different the value in VALUE_TO_COMPARE differs from the file -# samefile the two files hold the same key -# differentfile the two files hold different keys -cat > "${tmp}/compare.cjs" <<'CJS' -const fs = require("fs"); -const mode = process.argv[2]; -const first = process.argv[3]; -const second = process.argv[4]; -const value = process.env.VALUE_TO_COMPARE || ""; -const read = (path) => fs.readFileSync(path, "utf8").trim(); -const equal = second ? read(first) === read(second) : value.trim() === read(first); -const wantsDifferent = mode === "different" || mode === "differentfile"; -process.exit(wantsDifferent ? (equal ? 1 : 0) : (equal ? 0 : 1)); -CJS - -funcs="${tmp}/funcs.sh" -{ - # The log goes to a file, so the assertions can read it: the run has to say - # that it ignored a named ASC_KEY_PATH, and that is a claim about the log. - echo 'log() { echo "[ios-ship] $*" >> "${ASC_TEST_LOG}"; }' - echo 'ASC_TMP_DIR=""' - echo 'ASC_LINKED_KEY=""' - echo "FLEET_SECRETS_BIN=\"${tmp}/fleet-secrets\"" - echo "FLEET_DIR=\"${here}\"" - echo "ASC_COMPARE_TOOL=\"${tmp}/compare.cjs\"" - cat <<'FUNCS' -same_as_file() { - VALUE_TO_COMPARE="$1" node "$ASC_COMPARE_TOOL" same "$2" -} -different_from_file() { - VALUE_TO_COMPARE="$1" node "$ASC_COMPARE_TOOL" different "$2" -} -same_file_as_file() { - node "$ASC_COMPARE_TOOL" samefile "$1" "$2" -} -different_file_from_file() { - node "$ASC_COMPARE_TOOL" differentfile "$1" "$2" -} -FUNCS - extract -} > "$funcs" -export ASC_TEST_LOG="${tmp}/ship.log" -: > "$ASC_TEST_LOG" -grep -q '^load_secrets()' "$funcs" || fail "load_secrets not found in ship-testflight.sh" -grep -q '^asc_secret()' "$funcs" || fail "asc_secret not found in ship-testflight.sh" - -# 1. Nothing in the environment: credentials come from Infisical, the key is a 0600 temp file. -out="$(env -u ASC_KEY_ID -u ASC_ISSUER_ID -u ASC_KEY_PATH -u ASC_KEY_P8 bash -c ' - set -euo pipefail - source "'"$funcs"'" - load_secrets - [[ "$AUTH_MODE" == api_key ]] - [[ "$ASC_KEY_ID" == ABCDE12345 && "$ASC_ISSUER_ID" == issuer-synthetic ]] - [[ -f "$ASC_KEY_PATH" ]] - mode="$(stat -c %a "$ASC_KEY_PATH" 2>/dev/null || stat -f %Lp "$ASC_KEY_PATH")" - [[ "$mode" == 600 ]] - [[ "$API_PRIVATE_KEYS_DIR" == "$ASC_TMP_DIR" ]] - # The staged file holds the /asc key, and the client takes the key from the - # environment. Neither comparison prints a value. - same_file_as_file "$ASC_KEY_PATH" "'"$tmp"'/asc.p8" - same_as_file "$ASC_KEY_P8" "'"$tmp"'/asc.p8" - echo "$ASC_KEY_PATH" - asc_cleanup - [[ ! -e "$ASC_KEY_PATH" ]] -')" || fail "load_secrets from Infisical" -[[ ! -e "$out" ]] || fail "temp key file survived cleanup" -grep -q '^ASC_KEY_ID /asc$' "$FAKE_LOG" || fail "did not ask Infisical /asc for the key id" -grep -q '^ASC_KEY_P8 /asc$' "$FAKE_LOG" || fail "did not ask Infisical /asc for the key" - -# 2. The environment wins over a named key file. A disk credential never -# overrides the environment (AFC-459): a stale or foreign value in an -# operator's shell would sign the upload with the wrong key. -: > "$FAKE_LOG" -cp "${tmp}/asc.p8" "${tmp}/named-key.p8" -chmod 600 "${tmp}/named-key.p8" -ASC_KEY_ID=ENVKEY0001 ASC_ISSUER_ID=env-issuer \ - ASC_KEY_P8="$(<"${tmp}/other.p8")" ASC_KEY_PATH="${tmp}/named-key.p8" bash -c ' - set -euo pipefail - source "'"$funcs"'" - load_secrets - [[ "$AUTH_MODE" == api_key && "$ASC_KEY_ID" == ENVKEY0001 ]] - # The environment key is the credential in play, and the named file is not. - same_as_file "$ASC_KEY_P8" "'"$tmp"'/other.p8" - different_from_file "$ASC_KEY_P8" "'"$tmp"'/named-key.p8" -' || fail "a named key file overrode the environment" -[[ ! -s "$FAKE_LOG" ]] || fail "fleet-secrets was called although the environment was complete" - -# 2a. A named ASC_KEY_PATH is not a credential source at all: it is ignored, -# and the credential comes from Infisical. A file somebody names can never -# decide which key signs the upload (AFC-459). -: > "$FAKE_LOG" -: > "$ASC_TEST_LOG" -cp "${tmp}/other.p8" "${tmp}/named-file.p8" -chmod 600 "${tmp}/named-file.p8" -env -u ASC_KEY_P8 ASC_KEY_ID=ABCDE12345 ASC_ISSUER_ID=issuer-synthetic ASC_KEY_PATH="${tmp}/named-file.p8" bash -c ' - set -euo pipefail - source "'"$funcs"'" - load_secrets - [[ "$AUTH_MODE" == api_key && "$ASC_KEY_ID" == ABCDE12345 ]] - # The credential is the /asc one from Infisical, never the named file. - same_as_file "$ASC_KEY_P8" "'"$tmp"'/asc.p8" - different_from_file "$ASC_KEY_P8" "'"$tmp"'/named-file.p8" - asc_cleanup -' || fail "a named key file was used as the credential" -grep -q '^ASC_KEY_P8 /asc$' "$FAKE_LOG" || fail "fleet-secrets was not consulted for the credential" -grep -q 'ASC_KEY_PATH is not a credential source' "$ASC_TEST_LOG" \ - || fail "the run did not say that it ignored the named ASC_KEY_PATH" - -# 2a-bis. The hosted trio: the base64 form the ship workflow publishes. The -# credential is the environment's, and Infisical is never asked for it. -: > "$FAKE_LOG" -: > "$ASC_TEST_LOG" -HOSTED_B64="$(base64 < "${tmp}/other.p8" | tr -d '\n')" -env -u ASC_KEY_ID -u ASC_ISSUER_ID -u ASC_KEY_P8 -u ASC_KEY_PATH \ - APPLE_API_KEY_ID=HOSTEDKEY1 APPLE_API_ISSUER_ID=hosted-issuer \ - APPLE_API_KEY_P8_BASE64="$HOSTED_B64" bash -c ' - set -euo pipefail - source "'"$funcs"'" - load_secrets - [[ "$AUTH_MODE" == api_key && "$ASC_KEY_ID" == HOSTEDKEY1 ]] - [[ "$ASC_ISSUER_ID" == hosted-issuer ]] - # The base64 body is the credential, and it is handed over decoded. - same_as_file "$ASC_KEY_P8" "'"$tmp"'/other.p8" - same_file_as_file "$ASC_KEY_PATH" "'"$tmp"'/other.p8" - asc_cleanup -' || fail "the hosted base64 trio was not resolved" -[[ ! -s "$FAKE_LOG" ]] || fail "fleet-secrets was called although the environment was complete" - -# 2a-ter. A hosted trio whose base64 body is not a key fails closed instead of -# being staged as one. -: > "$FAKE_LOG" -env -u ASC_KEY_ID -u ASC_ISSUER_ID -u ASC_KEY_P8 -u ASC_KEY_PATH \ - APPLE_API_KEY_ID=HOSTEDKEY1 APPLE_API_ISSUER_ID=hosted-issuer \ - APPLE_API_KEY_P8_BASE64="$(printf 'not a key at all' | base64 | tr -d '\n')" bash -c ' - set -euo pipefail - source "'"$funcs"'" - load_secrets - # The run fails closed: no credential is handed to the client, and no key - # file is left behind for one. - [[ "$AUTH_MODE" == none ]] - [[ -z "${ASC_KEY_P8:-}" ]] - [[ ! -e "${ASC_TMP_DIR:-}/AuthKey_HOSTEDKEY1.p8" ]] - asc_cleanup -' || fail "a hosted trio that is not a key was adopted" +const reject = `load_secrets +[[ "$AUTH_MODE" == none && -z "$ASC_TMP_DIR" && -z "\${ASC_KEY_P8:-}" ]] +`; +for (const tuple of [ + {}, { ASC_KEY_ID: "PARTIAL", APPLE_API_ISSUER_ID: "foreign", APPLE_API_KEY_P8_BASE64: hosted.APPLE_API_KEY_P8_BASE64 }, + { ...plain, ...hosted, APPLE_API_KEY_P8_BASE64: "invalid" }, + { ...plain, ...hosted, APPLE_API_KEY_ID: "invalid/id" }, + { ...plain, ASC_KEY_ID: "invalid/id" }, { ...plain, ASC_KEY_P8: "invalid" } +]) run(tuple, reject); +for (const [tuple, file, id] of [ + [plain, "plain.p8", "PLAIN001"], [{ ...plain, ...hosted }, "hosted.p8", "HOSTED001"], + [{ ...plain, APPLE_API_KEY_ID: "PARTIAL" }, "plain.p8", "PLAIN001"], + [{ ...hosted, APPLE_API_KEY_P8_BASE64: hostedPem }, "hosted.p8", "HOSTED001"] +]) run(tuple, `asc_credential_available +load_secrets +[[ "$AUTH_MODE" == api_key && "$ASC_KEY_ID" == ${id} ]] +"$NODE_EXE" "$FIXTURE_ROOT/verify.cjs" "$FIXTURE_ROOT/${file}" +asc_cleanup +[[ ! -e "$ASC_KEY_PATH" ]] +`); +run({}, `! asc_credential_available +! asc_latest_marketing_patch 0.1 IOS +! asc_build_floor 0.1.0 IOS +APP_KEY=usage; ARCHIVE_PATH="$HOME" +upload_sentry_artifacts +`); +console.log("ok: 11 isolated shell credential cases"); +JS +node "$tmp/cases.cjs" "$tmp" "$here" # The scanner that finds a command substitution which runs the key reader. # @@ -299,98 +194,6 @@ for shape in plain plain-with-or split-across-lines nested; do fi done -# 2b. An ambient ASC_KEY_P8 that is not a PEM private key is ignored, and the -# run fails closed rather than signing with something that is not a key. -: > "$FAKE_LOG" -ASC_KEY_ID=NOSUCHKEY0 ASC_ISSUER_ID=any-issuer ASC_KEY_P8="not a private key at all" bash -c ' - set -euo pipefail - source "'"$funcs"'" - load_secrets - [[ "$AUTH_MODE" == none && -z "$ASC_TMP_DIR" ]] - [[ -z "${ASC_KEY_P8:-}" ]] -' || fail "an ASC_KEY_P8 that is not a key was adopted" - -# 2c. An ambient ASC_KEY_P8 without a key id is ignored: the key id, the -# issuer and the key belong together. -: > "$FAKE_LOG" -ASC_KEY_ID="" ASC_ISSUER_ID="" ASC_KEY_P8="$(<"${tmp}/other.p8")" bash -c ' - set -euo pipefail - source "'"$funcs"'" - load_secrets - [[ "$AUTH_MODE" == api_key && "$ASC_KEY_ID" == ABCDE12345 ]] - same_as_file "$ASC_KEY_P8" "'"$tmp"'/asc.p8" -' || fail "an ASC_KEY_P8 without a key id was adopted" - -# 2d. An env key id that is NOT the /asc one never gets the /asc key: its own .p8 comes from -# /authkey--p8, and /asc ASC_KEY_P8 is not requested. -: > "$FAKE_LOG" -env -u ASC_KEY_PATH -u ASC_KEY_P8 ASC_KEY_ID=OTHERKEY01 ASC_ISSUER_ID=issuer-other bash -c ' - set -euo pipefail - source "'"$funcs"'" - load_secrets - [[ "$AUTH_MODE" == api_key && "$ASC_KEY_ID" == OTHERKEY01 ]] - [[ "$ASC_ISSUER_ID" == issuer-other ]] - same_file_as_file "$ASC_KEY_PATH" "'"$tmp"'/other.p8" - different_file_from_file "$ASC_KEY_PATH" "'"$tmp"'/asc.p8" - asc_cleanup -' || fail "env key id different from /asc was not given its own key" -grep -q '^AUTHKEY_OTHERKEY01 /authkey-otherkey01-p8$' "$FAKE_LOG" || fail "did not ask the per-key folder" -if grep -q '^ASC_KEY_P8 ' "$FAKE_LOG"; then fail "mixed an env key id with the /asc key"; fi - -# 2e. An env key id that is not the /asc one with NO env issuer fails closed: the /asc issuer -# is never paired with another key's .p8. -: > "$FAKE_LOG" -env -u ASC_KEY_PATH -u ASC_ISSUER_ID -u ASC_KEY_P8 ASC_KEY_ID=OTHERKEY01 bash -c ' - set -euo pipefail - source "'"$funcs"'" - load_secrets - [[ "$AUTH_MODE" == none && -z "$ASC_TMP_DIR" ]] -' || fail "mixed the /asc issuer with another key" -if grep -q '^ASC_ISSUER_ID ' "$FAKE_LOG"; then fail "asked /asc for an issuer for a different key id"; fi - -# 2f. An env key id equal to the /asc one uses the /asc key. -: > "$FAKE_LOG" -env -u ASC_KEY_PATH -u ASC_ISSUER_ID -u ASC_KEY_P8 ASC_KEY_ID=ABCDE12345 bash -c ' - set -euo pipefail - source "'"$funcs"'" - load_secrets - [[ "$AUTH_MODE" == api_key && "$ASC_KEY_ID" == ABCDE12345 ]] - same_file_as_file "$ASC_KEY_PATH" "'"$tmp"'/asc.p8" - asc_cleanup -' || fail "env key id equal to /asc was not served from /asc" -grep -q '^ASC_KEY_P8 /asc$' "$FAKE_LOG" || fail "did not ask /asc ASC_KEY_P8" - -# 2g. An env key id with no key material anywhere fails closed (no api_key mode). -: > "$FAKE_LOG" -env -u ASC_KEY_PATH -u ASC_KEY_P8 ASC_KEY_ID=NOSUCHKEY0 ASC_ISSUER_ID=any-issuer bash -c ' - set -euo pipefail - source "'"$funcs"'" - load_secrets - [[ "$AUTH_MODE" == none && -z "$ASC_TMP_DIR" ]] -' || fail "missing key material did not fail closed" - -# 2h. A named ASC_KEY_PATH that names nothing is ignored the same way: the -# credential comes from Infisical, and the named path is never read. -: > "$FAKE_LOG" -env -u ASC_KEY_P8 ASC_KEY_ID=ABCDE12345 ASC_ISSUER_ID=issuer-synthetic ASC_KEY_PATH="${tmp}/no-such-key.p8" bash -c ' - set -euo pipefail - source "'"$funcs"'" - load_secrets - [[ "$AUTH_MODE" == api_key && "$ASC_KEY_ID" == ABCDE12345 ]] - same_as_file "$ASC_KEY_P8" "'"$tmp"'/asc.p8" - asc_cleanup -' || fail "a named key file that names nothing broke the run" -grep -q '^ASC_KEY_P8 /asc$' "$FAKE_LOG" || fail "fleet-secrets was not consulted for the credential" - -# 3. The credential never travels in a command argument. The secret reaches -# the child through the environment, so its own argv must not carry it. -argv="$(ASC_KEY_ID=ENVKEY0005 ASC_ISSUER_ID=env-issuer ASC_KEY_P8="$(<"${tmp}/other.p8")" bash -c ' - set -euo pipefail - ps -o args= -p $$ 2>/dev/null || true -')" -pem="$(<"${tmp}/other.p8")" -[[ "$argv" != *"$pem"* ]] || fail "the credential reached the child in its command arguments" - # 4. Neither this test nor the ship script passes a credential to `env`, which # would put it in the process arguments of every child. for f in "$0" "$script"; do @@ -400,8 +203,8 @@ for f in "$0" "$script"; do done # 5. Nothing is created under the old secrets folder or ~/.appstoreconnect. -[[ ! -e "${HOME}/.secrets" ]] || fail "created the old secrets folder" -[[ ! -e "${HOME}/.appstoreconnect" ]] || fail "created ~/.appstoreconnect" +[[ ! -e "${tmp}/home/.secrets" ]] || fail "created the old secrets folder" +[[ ! -e "${tmp}/home/.appstoreconnect" ]] || fail "created ~/.appstoreconnect" # 6. The script text itself no longer names the old folder as a source. if grep -nE '(~|\$\{?HOME\}?)/\.secrets' "$script" >/dev/null; then @@ -443,4 +246,4 @@ if grep -q 'asc_released_store_version "\$ASC_PLATFORM" 2>/dev/null' "$script"; fi unset body -echo "ok: ASC credential resolution (environment first, then Infisical, a named path ignored, temp key removed)" +echo "ok: ASC credential resolution (complete synced tuples only, a named path ignored, temp key removed)" diff --git a/scripts/ios-fleet/test-asc-key.test.mjs b/scripts/ios-fleet/test-asc-key.test.mjs index f24f9a6f7..77739e473 100644 --- a/scripts/ios-fleet/test-asc-key.test.mjs +++ b/scripts/ios-fleet/test-asc-key.test.mjs @@ -2,25 +2,20 @@ // for the Apple tools that need a key on disk, and what a child process is // allowed to inherit. // -// AFC-459: the private key is a secret, and the approved secret sources are -// the process environment, a captured `fleet-secrets get NAME` and -// bootstrap-only Keychain credentials. A caller-supplied file is not one of -// them, so this module never reads a key file: the only approved sources of -// the key are ASC_KEY_P8 in the environment and `fleet-secrets get ASC_KEY_P8`. -// ASC_KEY_PATH is not a credential source at all, and the tests below hold the -// module and the client to that. +// Only complete Infisical-synced environment tuples are credential sources. +// ASC_KEY_PATH is staging output for Apple tools, never a client input. // // Everything here is synthetic: the keys are generated at test time and are // never committed, and nothing reaches the network beyond 127.0.0.1. import assert from "node:assert/strict"; import { spawn } from "node:child_process"; -import { chmodSync, closeSync, fstatSync, mkdirSync, mkdtempSync, openSync, readFileSync, writeFileSync } from "node:fs"; +import { chmodSync, closeSync, fstatSync, mkdirSync, mkdtempSync, openSync, readFileSync, readdirSync, rmSync, existsSync, writeFileSync } from "node:fs"; import { createHash, createVerify, generateKeyPairSync } from "node:crypto"; import { createServer } from "node:http"; import { tmpdir } from "node:os"; import { dirname, join } from "node:path"; import { fileURLToPath } from "node:url"; -import test from "node:test"; +import test, { after } from "node:test"; import * as keyModule from "./asc-key.mjs"; import { normalizePrivateKey, writePrivateKeyFile } from "./asc-key.mjs"; @@ -31,6 +26,7 @@ const client = join(here, "asc-api.mjs"); const root = mkdtempSync(join(tmpdir(), "asc-key-test-")); // A PATH with node and nothing else: the fleet reader lives in the operator's // own bin directory, and a test must never reach it or Infisical. +after(() => rmSync(root, { recursive: true, force: true })); const safePath = [dirname(process.execPath), "/usr/bin", "/bin"].join(":"); function generateKeyPair() { @@ -64,32 +60,55 @@ function staged(name, content = keyPem, mode = 0o600) { return path; } -function run(args, stdin = "", env = undefined) { - return new Promise((resolve) => { - const child = spawn(process.execPath, [helper, ...args], { - ...(env ? { env } : {}), - stdio: ["pipe", "pipe", "pipe"] +function boundedNode(args, env, stdin = "") { + return new Promise((resolve, reject) => { + const child = spawn(process.execPath, args, { + env, stdio: ["pipe", "pipe", "pipe"], timeout: 15_000, killSignal: "SIGKILL" }); let stdout = ""; let stderr = ""; - child.stdout.on("data", (d) => { stdout += d; }); - child.stderr.on("data", (d) => { stderr += d; }); - child.on("close", (code) => resolve({ code, stdout, stderr })); + let oversized = false; + const capture = (name, chunk) => { + if (name === "stdout") stdout += chunk; + else stderr += chunk; + if (Buffer.byteLength(stdout) + Buffer.byteLength(stderr) > 65536) { + oversized = true; + child.kill("SIGKILL"); + } + }; + child.stdout.on("data", (d) => capture("stdout", d)); + child.stderr.on("data", (d) => capture("stderr", d)); + child.on("error", reject); + child.on("close", (code, signal) => { + if (signal || oversized) reject(new Error("isolated ASC child exceeded its bound")); + else resolve({ code, stdout, stderr }); + }); + child.stdin.on("error", () => {}); child.stdin.end(stdin); }); } +function run(args, stdin = "", env = undefined) { + return boundedNode([helper, ...args], env || { PATH: safePath, HOME: root, TMPDIR: root }, stdin); +} + function spawnNode(args, env) { - return new Promise((resolve) => { - const child = spawn(process.execPath, args, { env, stdio: ["ignore", "pipe", "pipe"] }); - let stdout = ""; - let stderr = ""; - child.stdout.on("data", (d) => { stdout += d; }); - child.stderr.on("data", (d) => { stderr += d; }); - child.on("close", (code) => resolve({ code, stdout, stderr })); - }); + // Validate before spawning, even for expected authentication refusals. + assert.equal(args[1], "GET"); + assert.match(args[2], /^http:\/\/127\.0\.0\.1:[0-9]+\//); + const target = new URL(args[2]); + assert.equal(target.protocol, "http:"); + assert.equal(target.hostname, "127.0.0.1"); + assert.equal(target.username + target.password, ""); + return boundedNode(args, { ...env, TMPDIR: env.TMPDIR || root }); } +test("fixture GET guard rejects non-loopback targets before spawning", () => { + for (const target of ["/v1/apps", "https://api.appstoreconnect.apple.com/v1/apps", "http://localhost:1/v1/apps"]) { + assert.throws(() => spawnNode([client, "GET", target], {})); + } +}); + // A local server that answers one request, so the client can be watched // signing it. It never sees anything but the test's own synthetic key. function localServer() { @@ -151,8 +170,9 @@ test("a malformed PEM is refused, because the envelope is not a key", () => { // envelope and still fail to parse. Accepting them would hand the signer // something it cannot use, and the failure would come back as a stack // trace instead of a credential error. - assert.equal(normalizePrivateKey("-----BEGIN PRIVATE KEY-----\nnot base64 at all\n-----END PRIVATE KEY-----\n"), null); // gitleaks:allow - assert.equal(normalizePrivateKey("-----BEGIN PRIVATE KEY-----\n-----END PRIVATE KEY-----\n"), null); // gitleaks:allow + const lines = keyPem.trim().split("\n"); + assert.equal(normalizePrivateKey([lines[0], "invalid", lines.at(-1)].join("\n")), null); + assert.equal(normalizePrivateKey([lines[0], lines.at(-1)].join("\n")), null); assert.equal(normalizePrivateKey(""), null); assert.equal(normalizePrivateKey(undefined), null); assert.equal(normalizePrivateKey("hunter2"), null); @@ -355,3 +375,66 @@ test("the hosted base64 trio is the credential the client signs with", async () server.close(); } }); + +test("complete synced tuples are selected without readers or mixed credentials", async () => { + const home = join(root, "isolated-tuples"); + const bin = join(home, ".local", "bin"); + const temp = join(home, "tmp"); + const marker = join(home, "reader-ran"); + mkdirSync(bin, { recursive: true }); + mkdirSync(temp); + for (const name of ["fleet-secrets", "infisical", "security"]) { + writeFileSync(join(bin, name), '#!/bin/sh\nprintf ran > "$TRAP_MARKER"\nexit 91\n', { mode: 0o700 }); + } + const hostedPair = generateKeyPair(); + const hostedPem = hostedPair.privateKey.export({ type: "pkcs8", format: "pem" }); + const plainPair = generateKeyPair(); + const plainPem = plainPair.privateKey.export({ type: "pkcs8", format: "pem" }); + const plain = { ASC_KEY_ID: "PLAIN001", ASC_ISSUER_ID: "plain-issuer", ASC_KEY_P8: plainPem }; + const hosted = { APPLE_API_KEY_ID: "HOSTED001", APPLE_API_ISSUER_ID: "hosted-issuer", + APPLE_API_KEY_P8_BASE64: Buffer.from(hostedPem).toString("base64") }; + const server = await localServer(); + try { + const cases = [ + [{}, null], + [{ ASC_KEY_ID: "PARTIAL", APPLE_API_ISSUER_ID: "foreign", APPLE_API_KEY_P8_BASE64: hosted.APPLE_API_KEY_P8_BASE64 }, null], + [{ ...plain, ...hosted }, hostedPair.publicKey], + [{ ...plain, APPLE_API_KEY_ID: "PARTIAL" }, plainPair.publicKey], + [{ ...plain, ...hosted, APPLE_API_KEY_P8_BASE64: "invalid" }, null], + [{ ...plain, ...hosted, APPLE_API_KEY_ID: "invalid/id" }, null], + [{ ...plain, ASC_KEY_ID: "invalid/id" }, null], + [{ ...hosted, APPLE_API_KEY_P8_BASE64: hostedPem }, hostedPair.publicKey] + ]; + for (const [tuple, signingKey] of cases) { + const before = server.seen.length; + const result = await spawnNode([client, "GET", `${server.base}/v1/apps`], { + PATH: `${bin}:${safePath}`, HOME: home, TMPDIR: temp, TRAP_MARKER: marker, + FLEET_SECRETS_BIN: join(bin, "fleet-secrets"), FLEET_SECRETS: join(bin, "fleet-secrets"), + ASC_KEY_PATH: staged("untrusted-input.p8"), ...tuple + }); + assert.equal(result.code, signingKey ? 0 : 1, "credential disposition changed"); + assert.equal(server.seen.length, before + (signingKey ? 1 : 0), "unexpected network request"); + if (signingKey) { + const authorization = server.seen.at(-1).authorization; + assert.ok(signedWith(authorization, signingKey)); + const [header, payload] = authorization.replace(/^Bearer /, "").split("."); + const selected = signingKey === hostedPair.publicKey ? "hosted" : "plain"; + assert.equal(JSON.parse(Buffer.from(header, "base64url")).kid, + selected === "hosted" ? "HOSTED001" : "PLAIN001"); + assert.equal(JSON.parse(Buffer.from(payload, "base64url")).iss, `${selected}-issuer`); + } + assert.ok(!existsSync(marker), "a retired reader or credential tool ran"); + assert.deepEqual(readdirSync(temp), [], "API client materialized an unused key"); + assert.ok(!result.stdout.includes(hostedPem.trim()) && !result.stderr.includes(hostedPem.trim())); + assert.ok(!result.stdout.includes(plainPem.trim()) && !result.stderr.includes(plainPem.trim())); + } + } finally { + server.close(); + } +}); + +test("retired reader overrides never enter the ASC child environment", () => { + const env = keyModule.clientEnvironment({ FLEET_SECRETS: "fixture", FLEET_SECRETS_BIN: "fixture" }); + assert.equal(env.FLEET_SECRETS, undefined); + assert.equal(env.FLEET_SECRETS_BIN, undefined); +}); From b69c7a5578dd65a04918c8db0d2398536061d6d7 Mon Sep 17 00:00:00 2001 From: "swu-codex[bot]" <344783151+swu-codex[bot]@users.noreply.github.com> Date: Sat, 21 Nov 2026 12:46:43 +0000 Subject: [PATCH 2/4] =?UTF-8?q?[CODEX:=E2=80=8A=E2=80=8A=E2=80=8AEE.1.S]?= =?UTF-8?q?=20Publish=20The=20Frozen=20Reviewed=20Source=20Composition?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From 9676d72ff6a4b2c727bacb456057d69b76850778 Mon Sep 17 00:00:00 2001 From: "swu-codex[bot]" <344783151+swu-codex[bot]@users.noreply.github.com> Date: Sat, 21 Nov 2026 13:02:40 +0000 Subject: [PATCH 3/4] =?UTF-8?q?[CODEX:=E2=80=8A=E2=80=8A=E2=80=8AEE.1.S]?= =?UTF-8?q?=20Publish=20The=20Frozen=20Reviewed=20Source=20Composition?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- scripts/ios-fleet.sha256 | 2 +- scripts/ios-fleet/ship-testflight.sh | 2 +- scripts/ios-fleet/test-asc-credentials.sh | 16 +++++++++++++--- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/scripts/ios-fleet.sha256 b/scripts/ios-fleet.sha256 index 99e578962..04b3ca300 100644 --- a/scripts/ios-fleet.sha256 +++ b/scripts/ios-fleet.sha256 @@ -1,7 +1,7 @@ # sha256 pin for the in-repo iOS ship tooling in scripts/ios-fleet. # GitHub-hosted macos-latest ships from this copy, not /Users/jay/apps/ios-fleet. # Refresh with: bash scripts/ios-fleet-pin.sh --update (then land it in a PR) -3003ba1ad74d8dacacc2f37a23fb9688825cf85705fd292f90cd3e00edd94096 ship-testflight.sh +e38eb93f5e2b35b9884bf280dd56942ade790cbe8e7119d97f4518faf5fd07a6 ship-testflight.sh 5b0ce96ab38418ae5c3b083550985b145fa66b5cb3b4fde4820a2ebfd0655c37 asc-api.mjs b73de468651ab800d0efea38ae3a620e85801e87b5954e195f07fc30435a2644 asc-key.mjs 3de97aa5b28a8f15571eb4ec3c34436d720b99bd43f852c320387d57ea3927ca apps.json diff --git a/scripts/ios-fleet/ship-testflight.sh b/scripts/ios-fleet/ship-testflight.sh index 57478498a..1505528a8 100755 --- a/scripts/ios-fleet/ship-testflight.sh +++ b/scripts/ios-fleet/ship-testflight.sh @@ -269,7 +269,7 @@ load_secrets() { kid="$APPLE_API_KEY_ID" iss="$APPLE_API_ISSUER_ID" case "$APPLE_API_KEY_P8_BASE64" in - *BEGIN*) key_pem="$APPLE_API_KEY_P8_BASE64" ;; + *"-----BEGIN "*) key_pem="$APPLE_API_KEY_P8_BASE64" ;; *) key_pem="$(printf '%s' "$APPLE_API_KEY_P8_BASE64" | base64 -d 2>/dev/null)" || key_pem="" ;; esac elif [[ -n "${ASC_KEY_ID:-}" && -n "${ASC_ISSUER_ID:-}" && -n "${ASC_KEY_P8:-}" ]]; then diff --git a/scripts/ios-fleet/test-asc-credentials.sh b/scripts/ios-fleet/test-asc-credentials.sh index 7cfccb5ed..91b4b45b7 100644 --- a/scripts/ios-fleet/test-asc-credentials.sh +++ b/scripts/ios-fleet/test-asc-credentials.sh @@ -20,11 +20,19 @@ cat > "$tmp/cases.cjs" <<'JS' const assert = require("node:assert/strict"); const fs = require("node:fs"); const path = require("node:path"); -const { generateKeyPairSync } = require("node:crypto"); +const { createPrivateKey, generateKeyPairSync } = require("node:crypto"); const { execFileSync } = require("node:child_process"); const [root, fleet] = process.argv.slice(2); const key = () => generateKeyPairSync("ec", { namedCurve: "prime256v1" }).privateKey.export({ type: "pkcs8", format: "pem" }); const plainPem = key(), hostedPem = key(); +// A deterministic leading PEM comment makes the outer encoding contain BEGIN. +// No random search is needed, and the real crypto parser proves the same key +// remains usable. The comment bytes contain no NUL and survive shell transport. +const commentPem = Buffer.from("IyABEGIN", "base64").toString("utf8") + " fixture comment\n" + hostedPem; +const commentBase64 = Buffer.from(commentPem).toString("base64"); +assert.ok(commentBase64.includes("BEGIN")); +assert.ok(!commentPem.includes("\0")); +assert.ok(createPrivateKey(commentPem).export({ type: "pkcs8", format: "pem" }) === hostedPem); const plain = { ASC_KEY_ID: "PLAIN001", ASC_ISSUER_ID: "plain-issuer", ASC_KEY_P8: plainPem }; const hosted = { APPLE_API_KEY_ID: "HOSTED001", APPLE_API_ISSUER_ID: "hosted-issuer", APPLE_API_KEY_P8_BASE64: Buffer.from(hostedPem).toString("base64") }; const marker = path.join(root, "tool-ran"); @@ -40,6 +48,7 @@ const named = path.join(root, "named.p8"); fs.writeFileSync(named, hostedPem, { mode: 0o600 }); fs.writeFileSync(path.join(root, "plain.p8"), plainPem, { mode: 0o600 }); fs.writeFileSync(path.join(root, "hosted.p8"), hostedPem, { mode: 0o600 }); +fs.writeFileSync(path.join(root, "comment.p8"), commentPem, { mode: 0o600 }); fs.writeFileSync(path.join(root, "verify.cjs"), ` const assert = require("node:assert/strict"); const fs = require("node:fs"); @@ -89,7 +98,8 @@ for (const tuple of [ for (const [tuple, file, id] of [ [plain, "plain.p8", "PLAIN001"], [{ ...plain, ...hosted }, "hosted.p8", "HOSTED001"], [{ ...plain, APPLE_API_KEY_ID: "PARTIAL" }, "plain.p8", "PLAIN001"], - [{ ...hosted, APPLE_API_KEY_P8_BASE64: hostedPem }, "hosted.p8", "HOSTED001"] + [{ ...hosted, APPLE_API_KEY_P8_BASE64: hostedPem }, "hosted.p8", "HOSTED001"], + [{ ...plain, ...hosted, APPLE_API_KEY_P8_BASE64: commentBase64 }, "comment.p8", "HOSTED001"] ]) run(tuple, `asc_credential_available load_secrets [[ "$AUTH_MODE" == api_key && "$ASC_KEY_ID" == ${id} ]] @@ -103,7 +113,7 @@ run({}, `! asc_credential_available APP_KEY=usage; ARCHIVE_PATH="$HOME" upload_sentry_artifacts `); -console.log("ok: 11 isolated shell credential cases"); +console.log("ok: 12 isolated shell credential cases"); JS node "$tmp/cases.cjs" "$tmp" "$here" From f1c75c810c0b14afacee905f8efe931a33da5843 Mon Sep 17 00:00:00 2001 From: "swu-codex[bot]" <344783151+swu-codex[bot]@users.noreply.github.com> Date: Sat, 21 Nov 2026 13:02:44 +0000 Subject: [PATCH 4/4] =?UTF-8?q?[CODEX:=E2=80=8A=E2=80=8A=E2=80=8AEE.1.S]?= =?UTF-8?q?=20Publish=20The=20Frozen=20Reviewed=20Source=20Composition?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit