Delete unused login and invite tokens on a daily job, and keep their URLs out of logs.
Expired sign-in, save-progress, email-change, and invitation tokens (and any draft they carry) are cleared by a Cloudron scheduler task. Page timing logs record the path without the query string, and mail failures log a request id instead of an address.
This commit is contained in:
1 parent
73d0856004
commit
46c34a6323
28 files changed
+636
-45
No files matched your search
@@ -246,6 +246,8 @@ persist across image updates unless changed:
|
||||
| `SMTP_FROM` | Visible From on sign-in emails (e.g. `Community Rule <hello@communityrule.info>`). |
|
||||
| `NEXT_PUBLIC_ENABLE_BACKEND_SYNC` | `true` in staging/production — Postgres draft persistence. |
|
||||
| `UPLOAD_ROOT` | `/app/data/uploads` on Cloudron — required for file uploads. |
|
||||
| `OPS_PRUNE_TOKEN` | Bearer token for `POST /api/ops/prune`. Unset hides the route. Optional; the daily scheduler runs the prune inside the container without it. |
|
||||
| `WORKSHOP_INQUIRY_PURGE_TOKEN` | Bearer token for `POST /api/workshop-inquiries/purge`. Unset hides that route. |
|
||||
|
||||
Full detail: [`ops-backend-deploy.md` §3](ops-backend-deploy.md#3-environment-variables).
|
||||
|
||||
@@ -279,8 +281,70 @@ That is expected. Recipients still authenticate the visible `From:` (`staging.ap
|
||||
|
||||
`SMTP_FROM` should stay the Cloudron mailbox (`staging.app@communityrule.info` on staging, `hello@communityrule.info` on the apex app). The app falls back to `CLOUDRON_MAIL_FROM` if `SMTP_FROM` is unset.
|
||||
|
||||
## 9. Related docs
|
||||
## 9. Retention (logs, backups, unused links)
|
||||
|
||||
Periods the privacy policy states. Source of truth:
|
||||
[`docs/privacy-policy-facts.md`](../privacy-policy-facts.md) and
|
||||
[`lib/privacyRetention.ts`](../../lib/privacyRetention.ts).
|
||||
|
||||
### 9.1 Unused links and sessions
|
||||
|
||||
[`CloudronManifest.json`](../../CloudronManifest.json) registers a
|
||||
**scheduler** task `prune-expired` at **07:20 UTC** daily. It runs
|
||||
`node /app/prune-expired.bundle.cjs` (the production bundle of
|
||||
[`scripts/prune-sessions.ts`](../../scripts/prune-sessions.ts)) and
|
||||
deletes expired sessions, unused login / save-progress / email-change
|
||||
tokens and the drafts they carry, unused invitation tokens, and workshop
|
||||
inquiries older than 12 months.
|
||||
|
||||
Manual runs:
|
||||
|
||||
```bash
|
||||
# inside the container (no token)
|
||||
cloudron exec --app staging.communityrule.info -- \
|
||||
node /app/prune-expired.bundle.cjs
|
||||
|
||||
# from outside, if OPS_PRUNE_TOKEN is set
|
||||
curl -sS -X POST \
|
||||
-H "Authorization: Bearer $OPS_PRUNE_TOKEN" \
|
||||
https://staging.communityrule.info/api/ops/prune
|
||||
```
|
||||
|
||||
Local:
|
||||
|
||||
```bash
|
||||
node --env-file=.env --import tsx scripts/prune-sessions.ts
|
||||
```
|
||||
|
||||
If the scheduler addon is missing after an image update, add the same
|
||||
command under the app **Cron** tab (`20 7 * * *`, UTC).
|
||||
|
||||
### 9.2 Logs
|
||||
|
||||
App logs (stdout) and Cloudron request logs are deleted after **14
|
||||
days**. That is the platform default and the shortest period Cloudron
|
||||
allows.
|
||||
|
||||
Page timing logs (`POST /api/web-vitals` in `external` mode) record
|
||||
origin + path only. Query strings are stripped before the line is
|
||||
written, so invitation and login tokens never land in app logs.
|
||||
|
||||
Cloudron's reverse-proxy request logs still include the query string.
|
||||
They follow the same 14-day window. Do not export those logs off the
|
||||
host for longer than 14 days.
|
||||
|
||||
Sign-in mail failures log a request id, not the email address.
|
||||
|
||||
### 9.3 Backups
|
||||
|
||||
Set the Cloudron backup site to **`30 daily`** (*Backups* → *Schedule &
|
||||
Retention*). Confirm this on staging and production. Cloudron also keeps
|
||||
a pre-update snapshot for up to three weeks.
|
||||
|
||||
## 10. Related docs
|
||||
|
||||
- [`../privacy-policy-facts.md`](../privacy-policy-facts.md) — periods
|
||||
and hosting facts for the privacy policy.
|
||||
- [`ops-backend-deploy.md`](ops-backend-deploy.md) — first install, cutover
|
||||
plan, legacy rules archive, build/push deep dive.
|
||||
- [`backend-roadmap.md`](backend-roadmap.md) — migrations policy (§8),
|
||||
|
||||
Reference in new issue
Block a user