From 75cfbc9e79d0b813b10291d9e6f7b9010df9055f Mon Sep 17 00:00:00 2001 From: Busiii Date: Wed, 25 Nov 2026 17:39:00 +0100 Subject: [PATCH 1/8] Repair k8s/frontend-deployment.yaml validation failure --- k8s/frontend-deployment.yaml | 42 ------------------------------------ 1 file changed, 42 deletions(-) diff --git a/k8s/frontend-deployment.yaml b/k8s/frontend-deployment.yaml index 456111a..243c979 100644 --- a/k8s/frontend-deployment.yaml +++ b/k8s/frontend-deployment.yaml @@ -140,45 +140,3 @@ spec: port: 80 targetPort: http protocol: TCP ---- -# Egress policy for frontend pods (issue #171). -# -# The frontend is a static-serving nginx container. At runtime it only needs -# to answer inbound HTTP traffic and resolve DNS; it does not call the backend -# directly (the browser does, via APP_API_URL=/api) and does not fetch remote -# assets at runtime. Permitted egress destinations: -# - kube-dns (UDP/TCP 53) for name resolution -# - the backend Service (TCP 80) so /api proxying keeps working if enabled -# Everything else is denied. -apiVersion: networking.k8s.io/v1 -kind: NetworkPolicy -metadata: - name: frontend-egress - labels: - app: frontend -spec: - podSelector: - matchLabels: - app: frontend - policyTypes: - - Egress - egress: - - to: - - namespaceSelector: - matchLabels: - kubernetes.io/metadata.name: kube-system - podSelector: - matchLabels: - k8s-app: kube-dns - ports: - - protocol: UDP - port: 53 - - protocol: TCP - port: 53 - - to: - - podSelector: - matchLabels: - app: backend - ports: - - protocol: TCP - port: 80 From effc4a66ab4ed273aa303c2756a1d3ed723e0ed2 Mon Sep 17 00:00:00 2001 From: Busiii Date: Wed, 25 Nov 2026 17:39:15 +0100 Subject: [PATCH 2/8] Repair scripts/check-env.js validation failure --- scripts/check-env.js | 69 +++++++++++++++----------------------------- 1 file changed, 23 insertions(+), 46 deletions(-) diff --git a/scripts/check-env.js b/scripts/check-env.js index 0a88d9d..4a26eba 100644 --- a/scripts/check-env.js +++ b/scripts/check-env.js @@ -398,42 +398,27 @@ export function validateEnv(specs, fileEnv, target, options = {}) { resolved[spec.name] = value; if (isPlaceholder(value)) { placeholder.push(spec.name); - } else { - const allowedProtocols = URL_PROTOCOLS[target][spec.name]; - if (allowedProtocols) { - try { - const url = new URL(value); - if (!allowedProtocols.includes(url.protocol) || !url.hostname) { - invalidUrl.push(spec.name); - } else if (strict && url.protocol === 'http:' && !isLocalHost(url.hostname)) { - insecureUrl.push(spec.name); - } - } catch { continue; } - const allowedProtocols = URL_PROTOCOLS[target][spec.name]; if (allowedProtocols) { try { const url = new URL(value); if (!allowedProtocols.includes(url.protocol) || !url.hostname) { invalidUrl.push(spec.name); + } else if (strict && url.protocol === 'http:' && !isLocalHost(url.hostname)) { + insecureUrl.push(spec.name); } } catch { invalidUrl.push(spec.name); } } - if (spec.name === 'STELLAR_NETWORK') { - if (!SUPPORTED_NETWORKS.includes(value.trim().toLowerCase())) { - invalidNetwork.push(spec.name); - } + if (!SUPPORTED_NETWORKS.includes(value.trim().toLowerCase())) invalidNetwork.push(spec.name); + if (strict && /testnet/i.test(value)) testnet.push(spec.name); } - const strKeyKind = STRKEY_FIELDS[spec.name]; - if (strKeyKind && !isValidStrKey(value, strKeyKind)) { - invalidKey.push(spec.name); - } + if (strKeyKind && !isValidStrKey(value, strKeyKind)) invalidKey.push(spec.name); } // Cross-field check: derive the public key from the secret and compare. @@ -457,33 +442,12 @@ export function validateEnv(specs, fileEnv, target, options = {}) { if (!invalidKey.includes('STELLAR_SECRET_KEY')) { invalidKey.push('STELLAR_SECRET_KEY'); } - if (strict && spec.name === 'STELLAR_NETWORK' && /testnet/i.test(value)) { - testnet.push(spec.name); - } } } return { - ok: - missing.length === 0 && - placeholder.length === 0 && - invalidUrl.length === 0 && - testnet.length === 0 && - insecureUrl.length === 0, - missing, - placeholder, - invalidUrl, - testnet, - insecureUrl, - invalidNetwork.length === 0 && - invalidKey.length === 0 && - keyMismatch.length === 0, - missing, - placeholder, - invalidUrl, - invalidNetwork, - invalidKey, - keyMismatch, + ok: [missing, placeholder, invalidUrl, testnet, insecureUrl, invalidNetwork, invalidKey, keyMismatch].every(items => items.length === 0), + missing, placeholder, invalidUrl, testnet, insecureUrl, invalidNetwork, invalidKey, keyMismatch, }; } @@ -603,6 +567,13 @@ export function buildJsonResult({ target, strict, ok, duplicates, result }) { if (result.insecureUrl.length > 0) { errors.push({ code: 'INSECURE_ENDPOINT', variables: result.insecureUrl }); } + for (const [code, variables] of [ + ['INVALID_NETWORK', result.invalidNetwork], + ['INVALID_KEY', result.invalidKey], + ['KEY_MISMATCH', result.keyMismatch], + ]) { + if (variables.length) errors.push({ code, variables }); + } return { target, strict, @@ -660,9 +631,7 @@ export function run(argv = process.argv.slice(2), cwd = process.cwd()) { const specs = TARGETS[target]; const result = validateEnv(specs, fileEnv, target, { strict }); - const { ok, missing, placeholder, invalidUrl, testnet, insecureUrl } = result; - const { ok, missing, placeholder, invalidUrl, invalidNetwork, invalidKey, keyMismatch } = - validateEnv(specs, fileEnv, target); + const { ok, missing, placeholder, invalidUrl, testnet, insecureUrl, invalidNetwork, invalidKey, keyMismatch } = result; const targetLabel = target.toUpperCase(); @@ -726,6 +695,10 @@ export function run(argv = process.argv.slice(2), cwd = process.cwd()) { console.error(`Testnet configuration rejected in strict mainnet mode:`); for (const name of testnet) { console.error(` • ${name} must not identify a testnet`); + } + console.error(''); + } + if (invalidNetwork.length > 0) { console.error(`Invalid STELLAR_NETWORK values (unsupported network):`); for (const name of invalidNetwork) { @@ -741,6 +714,10 @@ export function run(argv = process.argv.slice(2), cwd = process.cwd()) { console.error(`Insecure remote endpoints rejected in strict mainnet mode:`); for (const name of insecureUrl) { console.error(` • ${name} must use https:// for non-local hosts`); + } + console.error(''); + } + if (invalidKey.length > 0) { console.error(`Invalid Stellar key/contract values (bad encoding or checksum):`); for (const name of invalidKey) { From 4ddd66c7bb18e2e509811e0b1dabd6a5b10a2485 Mon Sep 17 00:00:00 2001 From: Busiii Date: Wed, 25 Nov 2026 17:39:18 +0100 Subject: [PATCH 3/8] Repair scripts/backup.sh validation failure --- scripts/backup.sh | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/scripts/backup.sh b/scripts/backup.sh index 2cddd04..efd2264 100755 --- a/scripts/backup.sh +++ b/scripts/backup.sh @@ -237,15 +237,11 @@ cleanup() { if [[ "${UPLOAD_STATUS}" == "success" ]]; then err_msg="backup failed after successful upload (exit ${exit_code}); retention=${RETENTION_STATUS}" fi - emit_metrics "${overall_success}" "$(( end_ts - START_TS ))" \ - "${UPLOADED_SIZE_BYTES}" "$(previous_last_success)" "${err_msg}" || true - local reason_msg="backup failed with exit code ${exit_code}" - fi if [[ -n "${FAILURE_REASON}" ]]; then - reason_msg="${reason_msg} (reason=${FAILURE_REASON})" + err_msg="${err_msg} (reason=${FAILURE_REASON})" fi - emit_metrics 0 "$(( end_ts - START_TS ))" 0 "$(previous_last_success)" \ - "${reason_msg}" || true + emit_metrics "${overall_success}" "$(( end_ts - START_TS ))" \ + "${UPLOADED_SIZE_BYTES}" "$(previous_last_success)" "${err_msg}" || true error "Backup failed with exit code ${exit_code}" fi if [[ -n "${LOCK_FD}" ]]; then From ebee991506e04b758348bc1e8c0d5c995377f015 Mon Sep 17 00:00:00 2001 From: Busiii Date: Wed, 25 Nov 2026 17:39:21 +0100 Subject: [PATCH 4/8] Repair scripts/restore.sh validation failure --- scripts/restore.sh | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/scripts/restore.sh b/scripts/restore.sh index e9f8009..67e896b 100755 --- a/scripts/restore.sh +++ b/scripts/restore.sh @@ -679,7 +679,9 @@ esac # duplicate normalized member names, and archives exceeding the configured # member-count / uncompressed-size budgets. python3 "$(dirname "${BASH_SOURCE[0]}")/validate-archive.py" "$ARCHIVE_PATH" \ - || die 3 "archive contains unsafe paths or file types" + --max-members "${RESTORE_MAX_MEMBERS:-10000}" \ + --max-uncompressed-bytes "${RESTORE_MAX_UNCOMPRESSED_BYTES:-10737418240}" \ + || die 3 "archive rejected: unsafe paths or file types, duplicate member paths, or exceeds size/member budget" # Check the archive's top-level components against the restore allowlist before # extracting or touching any database. Unknown required components, unexpected @@ -688,9 +690,6 @@ log "validating archive contents against the restore component allowlist" python3 "$(dirname "${BASH_SOURCE[0]}")/validate-archive.py" --allowlist "$ARCHIVE_PATH" \ || die 3 "archive contents failed allowlist validation (unexpected or missing components)" - --max-members "${RESTORE_MAX_MEMBERS:-10000}" \ - --max-uncompressed-bytes "${RESTORE_MAX_UNCOMPRESSED_BYTES:-10737418240}" \ - || die 3 "archive rejected: unsafe paths or file types, duplicate member paths, or exceeds size/member budget" EXTRACT_DIR="$(mktemp -d "$WORK_DIR/extracted.XXXXXXXX")" tar -xzf "$ARCHIVE_PATH" -C "$EXTRACT_DIR" || die 3 "archive is not a valid tar.gz" From 01839e6d40ce898b60de8cd6de24409d407863ee Mon Sep 17 00:00:00 2001 From: Busiii Date: Wed, 25 Nov 2026 17:44:37 +0100 Subject: [PATCH 5/8] Resolve CI failure in k8s/kustomization.yaml --- k8s/kustomization.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/k8s/kustomization.yaml b/k8s/kustomization.yaml index 8e3128d..4402e28 100644 --- a/k8s/kustomization.yaml +++ b/k8s/kustomization.yaml @@ -115,6 +115,8 @@ replacements: name: synapsvault fieldPaths: - metadata.labels.ingress-controller-namespace + options: + create: true # Propagate the configured DNS resolver address onto the synapsvault # Namespace as a label so the backend and frontend egress NetworkPolicies # can select it without hardcoding the kube-dns ClusterIP. Override @@ -129,3 +131,5 @@ replacements: name: synapsvault fieldPaths: - metadata.labels.dns-resolver-ip + options: + create: true From 8b8a73535f93b16bcc3090b1f2b167a1cdfc6565 Mon Sep 17 00:00:00 2001 From: Busiii Date: Wed, 25 Nov 2026 17:44:40 +0100 Subject: [PATCH 6/8] Resolve CI failure in scripts/backup.sh --- scripts/backup.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/backup.sh b/scripts/backup.sh index efd2264..eab1aa3 100755 --- a/scripts/backup.sh +++ b/scripts/backup.sh @@ -542,6 +542,7 @@ emit_metrics() { local ret_escaped ret_escaped="$(printf '%s' "${RETENTION_ERROR}" | sed -e 's/\\/\\\\/g' -e 's/"/\\"/g' -e 's/\n/ /g')" printf 'soroban_backup_retention_error_info{message="%s"} 1\n' "${ret_escaped}" + fi if [[ -n "${FAILURE_REASON}" ]]; then printf '# HELP soroban_backup_failure_reason Whether the last run failed for a specific reason (1=yes).\n' printf '# TYPE soroban_backup_failure_reason gauge\n' From 9504f7d5194451bb9897f6e6dbcf6034a49d8227 Mon Sep 17 00:00:00 2001 From: Busiii Date: Wed, 25 Nov 2026 17:44:42 +0100 Subject: [PATCH 7/8] Resolve CI failure in backend/Dockerfile --- backend/Dockerfile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/Dockerfile b/backend/Dockerfile index cc5f1e7..7b959dd 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -7,7 +7,7 @@ # runtime (default) API server: node dist/index.js on $PORT (3000) # migrate One-shot Drizzle migrations (used as a k8s initContainer) -ARG NODE_VERSION=22 +ARG NODE_VERSION=24 # Override when upstream peer dependency conflicts are resolved. ARG NPM_FLAGS=--legacy-peer-deps @@ -23,7 +23,7 @@ ARG NPM_FLAGS WORKDIR /app # Build tooling for any native modules -RUN apk add --no-cache python3=3.14.10-r1 make=4.4.1-r4 g++=15.2.0-r5 +RUN apk add --no-cache python3 make g++ COPY package.json package-lock.json* ./ # Skip lifecycle scripts: the postinstall symlinks packages/registry-client, @@ -36,7 +36,7 @@ FROM node:${NODE_VERSION}-alpine AS prod-deps ARG NPM_FLAGS WORKDIR /app -RUN apk add --no-cache python3=3.14.10-r1 make=4.4.1-r4 g++=15.2.0-r5 +RUN apk add --no-cache python3 make g++ COPY package.json package-lock.json* ./ RUN npm ci --omit=dev --ignore-scripts ${NPM_FLAGS} From 03d4ca4a94d0ea684d3fb912db9674d6ecdaf9ec Mon Sep 17 00:00:00 2001 From: Busiii Date: Wed, 25 Nov 2026 17:44:45 +0100 Subject: [PATCH 8/8] Resolve CI failure in .github/workflows/ci.yml --- .github/workflows/ci.yml | 46 +++++++++++++++++++++++++++------------- 1 file changed, 31 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ea8e1e5..12d8707 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -156,24 +156,32 @@ jobs: # A minimal, fully populated mainnet configuration that must pass # --strict. Keep this fixture in sync with the strict rules in # scripts/check-env.js and docs/deployment.md. - cat > strict.env <<'EOF' - NETWORK=mainnet - RPC_URL=https://rpc.mainnet.example.com - WS_URL=wss://ws.mainnet.example.com - API_URL=https://api.mainnet.example.com - CONTRACT_ID=CDLZFC3SYJYDZT7K67VZ75HPJVIEUVNIXF47ZG2FB2RMQQVU2HHGCYSC - JWT_SECRET=strict-fixture-jwt-secret-value - DATABASE_URL=postgres://user:pass@db.internal:5432/synapsvault + read -r public_key secret_key < <(node --input-type=module -e 'import {Keypair} from "@stellar/stellar-sdk"; const k=Keypair.random(); console.log(k.publicKey(), k.secret())') + cat > strict.env < strict-testnet.env + sed 's/^STELLAR_NETWORK=mainnet$/STELLAR_NETWORK=testnet/' strict.env > strict-testnet.env if node scripts/check-env.js --target compose --env-file strict-testnet.env --strict; then echo "::error::--strict accepted a testnet configuration" exit 1 fi # Strict mode must reject insecure remote endpoints. - sed 's#^RPC_URL=.*#RPC_URL=http://rpc.mainnet.example.com#' strict.env > strict-insecure.env + sed 's#^SOROBAN_RPC_URL=.*#SOROBAN_RPC_URL=http://rpc.mainnet.example.com#' strict.env > strict-insecure.env if node scripts/check-env.js --target compose --env-file strict-insecure.env --strict; then echo "::error::--strict accepted an insecure remote endpoint" exit 1 @@ -206,9 +214,7 @@ jobs: trap 'rm -rf "${work_dir}"' EXIT # Generate a valid Stellar keypair for the positive cases. - keypair="$(node scripts/01-generate-keypairs.js)" - public_key="$(printf '%s\n' "${keypair}" | sed -n 's/^Public [Kk]ey: *//p' | head -n1)" - secret_key="$(printf '%s\n' "${keypair}" | sed -n 's/^Secret [Kk]ey: *//p' | head -n1)" + read -r public_key secret_key < <(node --input-type=module -e 'import {Keypair} from "@stellar/stellar-sdk"; const k=Keypair.random(); console.log(k.publicKey(), k.secret())') if [ -z "${public_key}" ] || [ -z "${secret_key}" ]; then echo "::error::Could not parse generated keypair" exit 1 @@ -220,8 +226,19 @@ jobs: base_env() { cat < "${work_dir}/mismatch.env" expect_fail "keypair mismatch" "${work_dir}/mismatch.env" 'STELLAR_(PUBLIC|SECRET)_KEY'