You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Never commit `.env`, API keys, `DATABASE_URL`, session secrets, Hackatime/Airtable/CDN credentials, or OAuth tokens.
8
+
- Keep secrets in server `process.env` only; never expose them in client bundles, logs, or JSON responses.
9
+
-`.env.example` may list variable **names** only, not real values.
10
+
11
+
### API exposure
12
+
13
+
-**Admin / staff routes** (`/api/admin/*`, review approve/reject, user PII, journal CSV) must use `requireFullAdmin`, `requireStaffReview`, or `requireSuperAdmin` — never public.
14
+
-**User routes** must use `requireUser` and scope data to `req.session.userId`.
15
+
- Prefer whitelisted DTOs (`toPublicProject`, `toPublicUser`) over spreading DB rows to JSON.
16
+
- Gate dev/debug endpoints behind production checks or admin auth.
17
+
- Third-party calls (Hackatime, Airtable, CDN) stay **server-side**; tokens must not be sent to the browser.
18
+
19
+
### Errors & logging
20
+
21
+
- Production 500 responses: generic message only (`clientErrorMessage` in `server/security.js`).
22
+
- Do not log access tokens, refresh tokens, sync secrets, or full OAuth responses.
23
+
24
+
### Client
25
+
26
+
- Admin `fetch` calls must use `credentials: "include"`.
27
+
- Do not embed private API keys in `client/` code.
0 commit comments