fix: address performance and security findings
- Add PostgreSQL-backed backend and frontend tests to CI - Harden Android API logging and disable app backups - Update the performance report with resolved findings
This commit is contained in:
1 parent
a84a36349b
commit
937f51b4fb
35 files changed
+2566
-332
No files matched your search
@@ -49,10 +49,13 @@ The device-sync API token (generated from the dashboard's Settings page, used by
|
||||
| `AUTHGUARD_URL` | No | unset (pending) | Optional bootstrap/override base URL of the AuthGuard identity service. Leaving it unset does not disable authentication — it leaves the service "pending" until ProjectConfigurator pushes a URL, failing closed on auth calls until then. Use `AUTH_DISABLED` to actually turn auth off. |
|
||||
| `AUTH_DISABLED` | No | `false` | Set `true` to disable authentication entirely (no login screen, nothing gated, every request treated as authenticated) — for local development or a standalone deployment with no AuthGuard integration at all. |
|
||||
| `CARRIERNODE_URL` | No | unset | Base URL of a CarrierNode instance. Bootstrap fallback only — see below; not used by any feature here yet. |
|
||||
| `SECRET` | No | unset (push endpoint refuses every caller) | Shared secret, the same value CarrierNode/ProjectConfigurator were configured with, checked against `X-Internal-Auth` on `PUT /api/core-services/internal`. |
|
||||
| `SECRET` | Yes, unless `AUTH_DISABLED=true` | unset | Shared secret, the same value CarrierNode/ProjectConfigurator were configured with, checked against `X-Internal-Auth` on `PUT /api/core-services/internal` and `PUT /api/auth/access/internal`. Without it, `GET /api/auth/status` reports `SECRET environment variable is not set.` and every auth-gated route returns 500, and the internal endpoints refuse every caller. |
|
||||
| `ALLOWED_ORIGINS` | No | unset | Comma-separated browser origins that may call the API cross-origin with credentials. Leave unset: the dashboard is same-origin and needs no CORS. |
|
||||
| `PORT` | No | `8080` | HTTP listen port |
|
||||
| `APP_VERSION` | No | `dev` | Version label shown on the dashboard's About page |
|
||||
| `COOKIE_SECURE` | No | `false` | Set `true` once served over HTTPS, to mark cookies `Secure` |
|
||||
| `COOKIE_SECURE` | No | `false` | Set `true` once served over HTTPS. It marks only the cookies CollabTable clears on logout as `Secure`; the session cookie's `Secure`, `SameSite` and `Domain` attributes are set by AuthGuard. |
|
||||
| `TRUSTED_PROXIES` | No | unset | Comma-separated IPs or CIDR ranges of reverse proxies. `X-Forwarded-For` (client IP for rate limits) and `X-Forwarded-Proto` are read only from these peers. |
|
||||
| `PRODUCTION` | No | `false` | Set `true` to refuse plain HTTP: requests must arrive over TLS or through a `TRUSTED_PROXIES` proxy sending `X-Forwarded-Proto: https`. Requires `TRUSTED_PROXIES`. With `false`, the server logs a warning that TLS is off. |
|
||||
| `DB_INIT_RETRY_INTERVAL_MS` | No | `5000` | Delay between database-connection retry attempts at startup |
|
||||
| `DB_INIT_RETRY_MAX_ATTEMPTS` | No | `0` (retry forever) | Max database-connection retry attempts at startup |
|
||||
| `SYNC_MAX_FUTURE_SKEW_MS` | No | `0` | Client clock skew tolerated in sync timestamps, to avoid re-sending future-dated rows in hot loops |
|
||||
@@ -73,6 +76,7 @@ docker run -d \
|
||||
-p 8080:8080 \
|
||||
-e DATABASE_URL="postgresql://user:password@host:5432/collabtable" \
|
||||
-e AUTHGUARD_URL="https://auth.example.com" \
|
||||
-e SECRET="<long-random-shared-secret>" \
|
||||
collabtable:local
|
||||
```
|
||||
|
||||
@@ -120,8 +124,12 @@ Open `CollabTableAndroid` in Android Studio, let Gradle sync, and run on an emul
|
||||
```bash
|
||||
cd backend
|
||||
go test ./...
|
||||
# The handler and sync tests need a disposable PostgreSQL and are skipped without one.
|
||||
# Never point this at your real DATABASE_URL: each test creates and drops its own schema.
|
||||
TEST_DATABASE_URL='postgres://postgres:postgres@localhost:5432/collabtable_test?sslmode=disable' go test ./...
|
||||
|
||||
cd ../frontend
|
||||
npm test
|
||||
npm run check
|
||||
npm run lint
|
||||
```
|
||||
@@ -136,7 +144,7 @@ Every push runs three GitHub Actions workflows against the backend and frontend
|
||||
|
||||
- **`docker.yml`** — builds a multi-arch image (`linux/amd64` + `linux/arm64` on `main`, `linux/amd64` otherwise) from `docker/Dockerfile` and pushes `${DOCKERHUB_USERNAME}/collabtableserver` to Docker Hub on pushes to `main`, tagged by branch name, `sha-<short-sha>`, and `latest`.
|
||||
- **`lint.yml`** — runs `npm run lint` (ESLint) against `frontend`.
|
||||
- **`tests.yml`** — runs `go test ./...` against `backend` and `npm run check` against `frontend`.
|
||||
- **`tests.yml`** — runs `go test ./...` against `backend` (with a PostgreSQL service container, so the database-backed tests run) and `npm test` and `npm run check` against `frontend`.
|
||||
|
||||
**Required secrets / variables in your GitHub repository settings:**
|
||||
|
||||
|
||||
Reference in new issue
Block a user