From 987b2af18311d832a560201f9d9c9843e5e716fd Mon Sep 17 00:00:00 2001 From: Devanarayanan Date: Sat, 14 Nov 2026 20:11:50 +0000 Subject: [PATCH 1/2] feat: enhance GitHub Actions logging by adding masking for sensitive values --- .github/dependabot.yml | 8 +---- .github/workflows/codeql.yml | 4 ++- .github/workflows/release.yml | 8 ++++- scripts/fetch-build-time-vars.js | 56 +++++++++++++++++++++++++------- 4 files changed, 56 insertions(+), 20 deletions(-) diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 53419eb9..863512c4 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -17,8 +17,7 @@ updates: directory: "/" schedule: interval: "weekly" - patterns: - - "*" + open-pull-requests-limit: 0 ignore: # ESLint v10 is not yet supported by typescript-eslint # Keep ESLint at v9 until typescript-eslint adds v10 support @@ -26,8 +25,6 @@ updates: update-types: ["version-update:semver-major"] - dependency-name: "@eslint/js" update-types: ["version-update:semver-major"] - multi-ecosystem-group: "all-dependencies" - open-pull-requests-limit: 0 - package-ecosystem: "docker" directory: "/" @@ -36,7 +33,6 @@ updates: patterns: - "*" multi-ecosystem-group: "all-dependencies" - open-pull-requests-limit: 0 - package-ecosystem: "github-actions" directory: "/" @@ -45,7 +41,6 @@ updates: patterns: - "*" multi-ecosystem-group: "all-dependencies" - open-pull-requests-limit: 0 - package-ecosystem: "pub" directory: "/mobile" @@ -54,7 +49,6 @@ updates: patterns: - "*" multi-ecosystem-group: "all-dependencies" - open-pull-requests-limit: 0 - package-ecosystem: "pip" directory: "/.github" diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml index 426d415c..3845c76f 100644 --- a/.github/workflows/codeql.yml +++ b/.github/workflows/codeql.yml @@ -109,7 +109,9 @@ jobs: set -euo pipefail set +x if [ -n "${GOOGLE_SERVICES_JSON_BASE64:-}" ]; then - echo "::add-mask::$GOOGLE_SERVICES_JSON_BASE64" + while IFS= read -r line; do + [ -n "$line" ] && echo "::add-mask::$line" + done <<< "$GOOGLE_SERVICES_JSON_BASE64" printf '%s' "$GOOGLE_SERVICES_JSON_BASE64" | base64 --decode > android/app/google-services.json echo "✓ Recreated android/app/google-services.json from secret" elif [ -f android/app/google-services.json ]; then diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d65f66dc..0d62704f 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -740,7 +740,11 @@ jobs: : "${GOOGLE_SERVICES_JSON_BASE64:?GOOGLE_SERVICES_JSON_BASE64 environment variable or secret is required}" - [ -n "$GOOGLE_SERVICES_JSON_BASE64" ] && echo "::add-mask::$GOOGLE_SERVICES_JSON_BASE64" + if [ -n "$GOOGLE_SERVICES_JSON_BASE64" ]; then + while IFS= read -r line; do + [ -n "$line" ] && echo "::add-mask::$line" + done <<< "$GOOGLE_SERVICES_JSON_BASE64" + fi mkdir -p app printf '%s' "$GOOGLE_SERVICES_JSON_BASE64" | base64 --decode > app/google-services.json @@ -749,6 +753,7 @@ jobs: if [ -z "${FIREBASE_API_KEY_ANDROID:-}" ]; then DERIVED_KEY=$(jq -r '.client[0].api_key[0].current_key // empty' app/google-services.json) if [ -n "$DERIVED_KEY" ]; then + echo "::add-mask::$DERIVED_KEY" echo "FIREBASE_API_KEY_ANDROID=$DERIVED_KEY" >> "$GITHUB_ENV" echo "✓ Derived FIREBASE_API_KEY_ANDROID directly from google-services.json" fi @@ -757,6 +762,7 @@ jobs: if [ -z "${FIREBASE_PROJECT_ID:-}" ]; then DERIVED_PROJECT_ID=$(jq -r '.project_info.project_id // empty' app/google-services.json) if [ -n "$DERIVED_PROJECT_ID" ]; then + echo "::add-mask::$DERIVED_PROJECT_ID" echo "FIREBASE_PROJECT_ID=$DERIVED_PROJECT_ID" >> "$GITHUB_ENV" echo "✓ Derived FIREBASE_PROJECT_ID directly from google-services.json" fi diff --git a/scripts/fetch-build-time-vars.js b/scripts/fetch-build-time-vars.js index c8a4b2f0..d5596e94 100644 --- a/scripts/fetch-build-time-vars.js +++ b/scripts/fetch-build-time-vars.js @@ -109,6 +109,20 @@ async function fetchSecrets( return secrets; } +/** + * Helper to mask single or multi-line values in GitHub Actions logs. + */ +function maskValue(val) { + if (!val) return; + const str = String(val); + for (const line of str.split(/\r?\n/)) { + const trimmed = line.trim(); + if (trimmed.length > 0) { + console.log(`::add-mask::${trimmed}`); + } + } +} + /** * Exports secrets to GITHUB_ENV and registers masks for sensitive values. */ @@ -117,6 +131,11 @@ function exportSecrets(secrets) { // Define exactly which keys should be masked in GitHub logs const keysToMask = [ + "GOOGLE_SERVICES_JSON_BASE64", + "MOBILE_SENTRY_AUTH_TOKEN", + "FIREBASE_API_KEY_ANDROID", + "FIREBASE_API_KEY_IOS", + "NEXT_PUBLIC_MOBILE_SENTRY_DSN", "NEXT_PUBLIC_BACKEND_URL", "NEXT_PUBLIC_SUPABASE_URL", "NEXT_PUBLIC_SUPABASE_PUBLISHABLE_KEY", @@ -125,6 +144,8 @@ function exportSecrets(secrets) { "NEXT_PUBLIC_SENTRY_DSN", "NEXT_PUBLIC_TURNSTILE_SITE_KEY", "NEXT_PUBLIC_GA_ID", + "FIREBASE_PROJECT_ID", + "FIREBASE_STORAGE_BUCKET", ]; // Explicitly omit dev URLs/keys from masking @@ -133,30 +154,43 @@ function exportSecrets(secrets) { "NEXT_PUBLIC_SUPABASE_DEV_PUBLISHABLE_KEY", ]; + // Also mask any key matching sensitive token/secret patterns + const sensitivePattern = /(_KEY|_SECRET|_TOKEN|_PASSWORD|_AUTH|_DSN|_BASE64)$/i; + + function shouldMask(key) { + if (keysToOmitFromMasking.includes(key)) return false; + if (keysToMask.includes(key)) return true; + return sensitivePattern.test(key); + } + if (githubEnvFile) { console.log(`📝 Exporting variables to GITHUB_ENV...`); for (const secret of secrets) { if ( - keysToMask.includes(secret.secretKey) && - !keysToOmitFromMasking.includes(secret.secretKey) && + shouldMask(secret.secretKey) && secret.secretValue ) { - console.log(`::add-mask::${secret.secretValue}`); + maskValue(secret.secretValue); + } + if (secret.secretValue && String(secret.secretValue).includes("\n")) { + const delimiter = `EOF_${Date.now()}_${Math.random().toString(36).substring(2, 8)}`; + fs.appendFileSync( + githubEnvFile, + `${secret.secretKey}<<${delimiter}\n${secret.secretValue}\n${delimiter}\n`, + ); + } else { + fs.appendFileSync( + githubEnvFile, + `${secret.secretKey}=${secret.secretValue || ""}\n`, + ); } - fs.appendFileSync( - githubEnvFile, - `${secret.secretKey}=${secret.secretValue}\n`, - ); console.log(` + ${secret.secretKey}`); } console.log(`🎉 Variables exported successfully!`); } else { console.log(`â„šī¸ GITHUB_ENV is not set. Values loaded:`); for (const secret of secrets) { - if ( - keysToMask.includes(secret.secretKey) && - !keysToOmitFromMasking.includes(secret.secretKey) - ) { + if (shouldMask(secret.secretKey)) { console.log(` ${secret.secretKey}=[MASKED]`); } else { console.log(` ${secret.secretKey}=${secret.secretValue}`); From 1eb12b951f0d5e98b315c338f7dfcf2d9982dae9 Mon Sep 17 00:00:00 2001 From: Devanarayanan Date: Sat, 14 Nov 2026 20:13:58 +0000 Subject: [PATCH 2/2] chore: update version numbers to 4.7.1 across configuration files --- .example.env | 4 ++-- mobile/lib/config/app_config.dart | 2 +- mobile/pubspec.yaml | 2 +- package-lock.json | 4 ++-- package.json | 2 +- public/openapi/openapi.yaml | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.example.env b/.example.env index d7dfecc7..55045c71 100644 --- a/.example.env +++ b/.example.env @@ -44,7 +44,7 @@ NEXT_PUBLIC_APP_NAME=GhostClass # âš ī¸ App version displayed in footer and health checks # 🔨 Build-time (Infisical `/build-time` folder) -NEXT_PUBLIC_APP_VERSION=4.7.0 +NEXT_PUBLIC_APP_VERSION=4.7.1 # âš ī¸ Your production domain WITHOUT https:// # All URL-based variables are derived from this. @@ -379,7 +379,7 @@ REQUEST_SIGNATURE_MAX_AGE=600 # âš ī¸ Minimum supported app version required to bypass forced update # 🚀 Runtime (Infisical `/runtime` folder → Server Env Var) -MIN_APP_VERSION=4.7.0 +MIN_APP_VERSION=4.7.1 # â„šī¸ Enforce Firebase App Check for all mobile clients in production # Valid: "true", "false" (default: false in dev, true recommended in prod) diff --git a/mobile/lib/config/app_config.dart b/mobile/lib/config/app_config.dart index be5934f8..df964827 100644 --- a/mobile/lib/config/app_config.dart +++ b/mobile/lib/config/app_config.dart @@ -89,7 +89,7 @@ class AppConfig { /// Current application version static String get appVersion => - const String.fromEnvironment('APP_VERSION', defaultValue: '4.7.0'); + const String.fromEnvironment('APP_VERSION', defaultValue: '4.7.1'); /// Commit SHA injected by CI for release builds. static String get appCommitSha => diff --git a/mobile/pubspec.yaml b/mobile/pubspec.yaml index b483bdc1..b3b0d6a0 100644 --- a/mobile/pubspec.yaml +++ b/mobile/pubspec.yaml @@ -16,7 +16,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev # https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html # In Windows, build-name is used as the major, minor, and patch parts # of the product and file versions while build-number is used as the build suffix. -version: 4.7.0+1 +version: 4.7.1+1 environment: sdk: ^3.11.4 diff --git a/package-lock.json b/package-lock.json index fbca8048..d85e7c92 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "ghostclass", - "version": "4.7.0", + "version": "4.7.1", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "ghostclass", - "version": "4.7.0", + "version": "4.7.1", "dependencies": { "@hookform/resolvers": "^7.0.6", "@radix-ui/react-alert-dialog": "^1.1.23", diff --git a/package.json b/package.json index dc4b1d6b..9f34989e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ghostclass", - "version": "4.7.0", + "version": "4.7.1", "private": true, "engines": { "node": ">=22.12.0", diff --git a/public/openapi/openapi.yaml b/public/openapi/openapi.yaml index 8a140661..aaa1f428 100644 --- a/public/openapi/openapi.yaml +++ b/public/openapi/openapi.yaml @@ -6,7 +6,7 @@ openapi: 3.1.0 info: title: GhostClass API - version: 4.7.0 + version: 4.7.1 description: | **GhostClass API** provides endpoints for authentication, profile synchronization, attendance integrations with EzyGo, telemetry, and build provenance.