Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .devcontainer/init_workspace.sh
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,11 @@ if [ -z "$CURRENT_NAME" ] || [ -z "$CURRENT_EMAIL" ]; then
fi
fi

# --- 5. GIT SAFE DIRECTORY ---
# --- 5. GIT SAFE DIRECTORY & PUSH DEFAULTS ---
git config --global --add safe.directory "$TARGET_DIR" 2>/dev/null || true
git config --global --add safe.directory /workspaces/GhostClass 2>/dev/null || true
git config --global --add safe.directory /ghostclass 2>/dev/null || true
git config --global push.autoSetupRemote true 2>/dev/null || true

# --- 6. MONOREPO DEPENDENCIES SYNCHRONIZATION ---
if [ -f "$TARGET_DIR/package.json" ]; then
Expand Down
19 changes: 9 additions & 10 deletions .example.env
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,10 @@
# ============================================================================

# ----------------------------------------------------------------------------
# App identity
# App identity & domains
# ----------------------------------------------------------------------------

# ⚠️ Application name displayed in UI and emails
# 🔨 Build-time (Infisical `/build-time` folder)
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.2
# Note: APP_NAME ("GhostClass") and Web APP_VERSION (from package.json) are
# centralized in code/build config — they do not belong in Infisical.

# ⚠️ Your production domain WITHOUT https://
# All URL-based variables are derived from this.
Expand Down Expand Up @@ -377,10 +371,15 @@ REQUEST_SIGNATURE_MAX_AGE=600
# Mobile Security & Attestation (Zero-Trust)
# ----------------------------------------------------------------------------

# ⚠️ Minimum supported app version required to bypass forced update
# ⚠️ Minimum supported mobile app version required to bypass forced update
# 🚀 Runtime (Infisical `/runtime` folder → Server Env Var)
MIN_APP_VERSION=4.7.2

# ⚠️ Latest published mobile app version advertised by /api/security/attestation
# Manage independently of Web releases whenever a new mobile binary ships.
# 🚀 Runtime (Infisical `/runtime` folder → Server Env Var)
LATEST_APP_VERSION=4.7.2

# ℹ️ Enforce Firebase App Check for all mobile clients in production
# Valid: "true", "false" (default: false in dev, true recommended in prod)
# 🚀 Runtime (Infisical `/runtime` folder → Server Env Var)
Expand Down
45 changes: 22 additions & 23 deletions .github/copilot-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -263,34 +263,34 @@ Important mocking patterns:

### Version bumping

Version bumping is automated via workflows (see
`.github/workflows/auto-version-bump.yml`).
Version bumping is handled locally in `.husky/pre-push` (`scripts/pre-push-bump.js`)
on a per-component basis (`web`, `mobile`, `backup`) using Conventional Commits
and the rollover-at-9 rules in `docs/VERSIONING.md`, or manually via:

- Same-repo PRs: workflow handles bump
- Fork PRs: run bump script manually, then commit versioned artifacts
```bash
npm run version:bump -- --component web --type patch
```

Files that must stay in sync for version bumps:
Files that stay in sync per component:

- `package.json`
- `package-lock.json` (or `pnpm-lock.yaml` / `yarn.lock`)
- `.example.env` (`NEXT_PUBLIC_APP_VERSION`)
- `public/openapi/openapi.yaml`
- **Web**: `package.json`, `package-lock.json`, `public/openapi/openapi.yaml`
- **Mobile**: `mobile/pubspec.yaml`, `mobile/lib/config/app_config.dart`
- **Backup**: `backup/VERSION`

When updating core dependency versions, update `package.json` and run the
install command for the chosen package manager.

### Main workflows

| Workflow | Purpose |
| --------------------------- | -------------------------------------- |
| `test.yml` | Web unit coverage + web Playwright E2E |
| `pipeline.yml` | Guard + auto-tag on merge to main |
| `auto-version-bump.yml` | PR version bump automation |
| `release.yml` | Signed release build + deploy pipeline |
| `deploy-egress-proxies.yml` | Deploy CF/AWS proxies |
| `deploy-supabase.yaml` | Supabase migration deployment |
| `provenance.yml` | Build provenance attestations |
| `scorecard.yml` | OpenSSF scorecard checks |
| Workflow | Purpose |
| ----------------- | --------------------------------------------------------------- |
| `build-guard.yml` | Trivy FS scan + commit signature & Dependabot schema checks |
| `test.yml` | Path-gated Web unit coverage + Playwright E2E |
| `mobile-test.yml` | Path-gated Flutter format, analyze & unit coverage |
| `codeql.yml` | Path-gated CodeQL analysis (JS/TS, GitHub Actions, Android) |
| `release.yml` | Decoupled component builds, Cosign/SLSA signing & GitHub Releases |
| `deploy.yml` | Supabase migrations, CF/AWS proxies & Coolify digest deployment |
| `scorecard.yml` | OpenSSF Scorecard checks |

Dependabot PRs do not have repository secrets; secret-dependent jobs must stay
guarded.
Expand Down Expand Up @@ -325,10 +325,9 @@ guarded.

## Where to update versions and references

- Web: update `package.json` and `tsconfig.json` as needed
- Mobile: update `mobile/pubspec.yaml`
- OpenAPI: update `public/openapi/openapi.yaml` and run any generation scripts
in `scripts/`
- Web: `npm run version:bump -- --component web --type patch` (updates `package.json`, `package-lock.json`, `public/openapi/openapi.yaml`)
- Mobile: `npm run version:bump -- --component mobile --type patch` (updates `mobile/pubspec.yaml`, `mobile/lib/config/app_config.dart`)
- Backup: `npm run version:bump -- --component backup --type patch` (updates `backup/VERSION`)

---

Expand Down
85 changes: 85 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,70 +16,148 @@ permissions:
contents: read

jobs:
changes:
name: Detect CodeQL Targets
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
outputs:
js: ${{ steps.decide.outputs.js }}
actions: ${{ steps.decide.outputs.actions }}
android: ${{ steps.decide.outputs.android }}
steps:
- name: Checkout
if: github.event_name == 'pull_request'
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1
with:
fetch-depth: 0

- name: Filter PR paths
if: github.event_name == 'pull_request'
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: filter
with:
filters: |
js:
- 'src/**'
- 'e2e/**'
- 'scripts/**'
- 'workers/**'
- '*.ts'
- '*.js'
- '*.mjs'
- 'package.json'
- 'package-lock.json'
actions:
- '.github/workflows/**'
- '.github/actions/**'
android:
- 'mobile/**'

- name: Decide CodeQL targets
id: decide
run: |
if [ "${{ github.event_name }}" != "pull_request" ]; then
echo "js=true" >> "$GITHUB_OUTPUT"
echo "actions=true" >> "$GITHUB_OUTPUT"
echo "android=true" >> "$GITHUB_OUTPUT"
else
echo "js=${{ steps.filter.outputs.js }}" >> "$GITHUB_OUTPUT"
echo "actions=${{ steps.filter.outputs.actions }}" >> "$GITHUB_OUTPUT"
echo "android=${{ steps.filter.outputs.android }}" >> "$GITHUB_OUTPUT"
fi

codeql-js:
name: CodeQL JavaScript/TypeScript
needs: changes
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
steps:
- name: Skip notice
if: needs.changes.outputs.js != 'true'
run: echo "⏭️ Skipping JS/TS CodeQL (no JS/TS files changed in PR)."

- name: Checkout
if: needs.changes.outputs.js == 'true'
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1

- name: Initialize CodeQL (JS/TS)
if: needs.changes.outputs.js == 'true'
uses: github/codeql-action/init@52cf1852265d99e9bea071b03366fc777a602909
with:
languages: javascript-typescript

- name: Autobuild (JS/TS)
if: needs.changes.outputs.js == 'true'
uses: github/codeql-action/autobuild@52cf1852265d99e9bea071b03366fc777a602909

- name: Run CodeQL analysis (JS/TS)
if: needs.changes.outputs.js == 'true'
uses: github/codeql-action/analyze@52cf1852265d99e9bea071b03366fc777a602909
with:
category: "/language:javascript-typescript"

codeql-actions:
name: CodeQL Actions
needs: changes
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
actions: read
steps:
- name: Skip notice
if: needs.changes.outputs.actions != 'true'
run: echo "⏭️ Skipping Actions CodeQL (no workflow/action files changed in PR)."

- name: Checkout
if: needs.changes.outputs.actions == 'true'
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1

- name: Initialize CodeQL (Actions)
if: needs.changes.outputs.actions == 'true'
uses: github/codeql-action/init@52cf1852265d99e9bea071b03366fc777a602909
with:
languages: actions

- name: Autobuild (Actions)
if: needs.changes.outputs.actions == 'true'
uses: github/codeql-action/autobuild@52cf1852265d99e9bea071b03366fc777a602909

- name: Run CodeQL analysis (Actions)
if: needs.changes.outputs.actions == 'true'
uses: github/codeql-action/analyze@52cf1852265d99e9bea071b03366fc777a602909
with:
category: "/language:actions"

codeql-android:
name: CodeQL Android (Java/Kotlin)
needs: changes
runs-on: ubuntu-latest
permissions:
contents: read
security-events: write
steps:
- name: Skip notice
if: needs.changes.outputs.android != 'true'
run: echo "⏭️ Skipping Android CodeQL (no mobile files changed in PR)."

- name: Checkout
if: needs.changes.outputs.android == 'true'
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1

- name: Download Gradle Wrapper
if: needs.changes.outputs.android == 'true'
run: |
mkdir -p mobile/android/gradle/wrapper
curl -fSL -o mobile/android/gradle/wrapper/gradle-wrapper.jar https://raw.githubusercontent.com/gradle/gradle/v9.6.1/gradle/wrapper/gradle-wrapper.jar
echo "497c8c2a7e5031f6aa847f88104aa80a93532ec32ee17bdb8d1d2f67a194a9c7 mobile/android/gradle/wrapper/gradle-wrapper.jar" | sha256sum -c -

- name: Set up JDK
if: needs.changes.outputs.android == 'true'
uses: actions/setup-java@d1374f8ac74474200d16ef8ecee22c7ae7a51880
with:
distribution: "temurin"
Expand All @@ -88,20 +166,24 @@ jobs:
cache-dependency-path: "mobile/android/gradle/wrapper/gradle-wrapper.properties"

- name: Set up Flutter
if: needs.changes.outputs.android == 'true'
uses: ./.github/actions/flutter-action
with:
channel: stable
cache: true

- name: Fetch Flutter dependencies
if: needs.changes.outputs.android == 'true'
working-directory: mobile
run: flutter pub get

- name: Prepare app_secrets.dart
if: needs.changes.outputs.android == 'true'
working-directory: mobile
run: cp lib/config/app_secrets.dart.example lib/config/app_secrets.dart

- name: Prepare google-services.json
if: needs.changes.outputs.android == 'true'
working-directory: mobile
env:
GOOGLE_SERVICES_JSON_BASE64: ${{ env.GOOGLE_SERVICES_JSON_BASE64 || secrets.GOOGLE_SERVICES_JSON_BASE64 }}
Expand Down Expand Up @@ -132,16 +214,19 @@ jobs:
fi

- name: Initialize CodeQL (Java + Kotlin)
if: needs.changes.outputs.android == 'true'
uses: github/codeql-action/init@52cf1852265d99e9bea071b03366fc777a602909
with:
languages: java-kotlin
build-mode: manual

- name: Build Android Kotlin source (Triggers CodeQL extraction)
if: needs.changes.outputs.android == 'true'
working-directory: mobile/android
run: ./gradlew :app:compileDebugSources --no-daemon

- name: Run CodeQL analysis (Android)
if: needs.changes.outputs.android == 'true'
uses: github/codeql-action/analyze@52cf1852265d99e9bea071b03366fc777a602909
with:
category: "/language:java-kotlin"
Loading
Loading