Skip to content

Open-source document signature platform. Not affiliated with DocuSign.

TypeScript

Docs: recovering two-step sign-in after a secret change, legal holds, what AUDIT_LOG=off stops

Claude047d063cb484
diff --git a/docs/backup-and-restore.md b/docs/backup-and-restore.md
index 8f31fca..654b87c 100644
--- a/docs/backup-and-restore.md
+++ b/docs/backup-and-restore.md
@@ -25,6 +25,8 @@ From then on Vercel calls `/api/internal/backup` every day at 08:00 UTC (see `ve
- copies every file that is new or changed since the last run to `files/<same path>`. A run copies for up to four minutes; a first backup of a large install may take a few days to catch up, and each later run only copies what changed;
- keeps the copy of a file that was deleted from the install (by the retention rules, for example) for `BACKUP_KEEP_DAYS` more days, then removes it, so the backup does not hold a document much longer than your retention rules allow.
+To run one by hand (while cron jobs are paused, for example), call the same address with the secret: `curl -H "Authorization: Bearer $CRON_SECRET" https://<your install>/api/internal/backup`.
+
Each run writes a `backup_finished` line to the function logs (with the counts), or `backup_failure` if it failed. With a log drain, alert on those. The app refuses a token for its own store, because that backup would not survive what it is for.
**Cost.** The backup store holds about as much as the install's store, plus the database copies. On a Vercel Hobby account, a second store in the same account counts against the same free Blob storage, so it halves how much your install can hold for $0. A store in another team has its own allowance. Each copied file is one upload to the backup store.
@@ -52,7 +54,7 @@ You need a computer with Node.js 24 and a copy of this repository at the same ve
`--backup database/<name>` restores an older one instead. The script applies the migrations, loads the database in one transaction (so a failed restore leaves nothing half done), then copies the files back to their own paths. It refuses a database that already has accounts in it, and a backup made by a newer SignuDoc than the copy you are running. If copying the files stops part way (a network error, or you stopped it), run `npm run restore-backup -- --files-only` to finish: it skips the database and every file that is already there.
-4. Connect the new database and Blob store to the install's Vercel project (or a new one) in place of the old ones, keep `BETTER_AUTH_SECRET` the same as before, and deploy. Two-step sign-in keys are encrypted with that secret, and session cookies are signed with it; if it changes, everyone signs in again and sets up two-step sign-in again.
+4. Connect the new database and Blob store to the install's Vercel project (or a new one) in place of the old ones, keep `BETTER_AUTH_SECRET` the same as before, and deploy. Two-step sign-in keys are encrypted with that secret, and session cookies are signed with it; if it changes, everyone is signed out, and nobody who used two-step sign-in can finish signing in until their setup is cleared (see the note on two-step sign-in in [self-hosting](self-hosting.md#sign-in-security)).
5. Sign in, open a finished document, and check its audit trail and download.
What a restore brings back: everything in the database at the time of the backup, and every file as of the last run. A document sent after the last backup is not in it. The hash chains in both audit trails come back exactly as they were, so they still verify.
diff --git a/docs/self-hosting.md b/docs/self-hosting.md
index affae25..1aef0cf 100644
--- a/docs/self-hosting.md
+++ b/docs/self-hosting.md
@@ -161,7 +161,15 @@ The first time you open a new install it takes you to `/setup`. There you name y
These cover the people with an account (senders and administrators). Signers who are only sent a document open it from their emailed link and are not affected.
-- **Two-step sign-in.** Anyone can turn it on under Settings, Two-step sign-in: after the password, the site asks for a 6-digit code from an authenticator app such as 1Password, Google Authenticator or Microsoft Authenticator. Setting it up gives ten single-use backup codes for when the phone is not at hand. The key and the backup codes are stored encrypted with `BETTER_AUTH_SECRET`, so keep that secret the same: a new one makes every authenticator stop working.
+- **Two-step sign-in.** Anyone can turn it on under Settings, Two-step sign-in: after the password, the site asks for a 6-digit code from an authenticator app such as 1Password, Google Authenticator or Microsoft Authenticator. Setting it up gives ten single-use backup codes for when the phone is not at hand. The key and the backup codes are stored encrypted with `BETTER_AUTH_SECRET`, so keep that secret the same: a new one makes every authenticator stop working. If it has to change (it leaked, or it was derived from a database password that changed), clear everyone's two-step setup in the same step, or nobody who used it can sign in, administrators included. In the Neon console's SQL editor, run:
+
+ ```sql
+ update "user" set "twoFactorEnabled" = false;
+ delete from "twoFactor";
+ ```
+
+ Then change the secret and deploy. Everyone signs in with their password alone once, and sets up two-step sign-in again (an install that requires it asks at once). The site audit trail does not show this reset, so record it with the incident.
+
- **Requiring it.** An administrator can require two-step sign-in of everyone under Settings, Organization, Sign-in security. They have to use it themselves first. From then on anyone who has not set it up sees only the setup page until they have, the API refuses their requests too, and nobody can turn theirs off.
- **Lost phone.** If someone loses their phone and their backup codes, an administrator can reset their two-step sign-in under People. That turns it off and signs them out everywhere at once; they sign in with their password and set it up again (at once, if it is required).
- **Sessions.** A session lasts 7 days by default. Under Settings, Organization, Sign-in security an administrator can sign people out after 15 minutes to 8 hours without use, and at the latest 8 hours to 3 days after they signed in. A change applies to sessions that are already open, from their next click. Anyone can sign out on every device at once under Settings, Signed-in devices.
diff --git a/docs/soc2/control-map.md b/docs/soc2/control-map.md
index c82e546..645cac9 100644
--- a/docs/soc2/control-map.md
+++ b/docs/soc2/control-map.md
@@ -83,10 +83,10 @@ Where a row says "evidence", it names what you can show an auditor.
## C1 Confidentiality
-| Criterion | SignuDoc | Vendors | Yours |
-| -------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------- | ------------------------------------------------------------------------ |
-| C1.1 Identifying and protecting confidential information | Documents are stored in a private store and only shown to their sender, their signers (through their own link) and, for finished records handed over, administrators. Download links expire. `AUDIT_LOG=off` keeps email and IP addresses out of function logs. | Encryption at rest (Vercel Blob, Neon). | Classify the documents you send, and decide who may be an administrator. |
-| C1.2 Disposal | Retention rules (see CC6.5). | | Set them to your schedule. |
+| Criterion | SignuDoc | Vendors | Yours |
+| -------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------- | ------------------------------------------------------------------------ |
+| C1.1 Identifying and protecting confidential information | Documents are stored in a private store and only shown to their sender, their signers (through their own link) and, for finished records handed over, administrators. Download links expire. `AUDIT_LOG=off` stops the copies of audit entries in function logs; security events (rate limits, refused requests, lockouts) are still logged, with IP addresses. | Encryption at rest (Vercel Blob, Neon). | Classify the documents you send, and decide who may be an administrator. |
+| C1.2 Disposal | Retention rules (see CC6.5). | | Set them to your schedule. |
## PI1 Processing integrity
diff --git a/docs/soc2/policies/data-retention.md b/docs/soc2/policies/data-retention.md
index 390ad11..5e90c0c 100644
--- a/docs/soc2/policies/data-retention.md
+++ b/docs/soc2/policies/data-retention.md
@@ -7,6 +7,6 @@
3. A closed account is deleted 30 days after it is closed, once its owner has had the chance to export. Its finished documents pass to an administrator first, because they are the organization's records.
4. Backups keep copies of deleted files for `[30]` days more, then remove them.
5. Copies outside the app (downloads, files in `[record system]`, SIEM logs) follow `[our records schedule]`.
-6. A legal hold stops deletion: `[role]` turns retention off for the period and records why.
+6. A legal hold stops deletion: `[role]` turns retention off for the period (Settings, Organization) and records why. That keeps finished documents only. The daily cleanup still deletes drafts never sent after 30 days and accounts whose closure is due, so for a hold that covers those, `[role]` also pauses the project's cron jobs in Vercel (Settings, Cron Jobs). That pauses the daily backup too; run it by hand while the hold lasts ([Backup and restore](../../backup-and-restore.md)).
**Evidence:** the retention setting, the daily job's summary, the site audit trail.
diff --git a/docs/soc2/policies/incident-response.md b/docs/soc2/policies/incident-response.md
index eca6f0b..b97902a 100644
--- a/docs/soc2/policies/incident-response.md
+++ b/docs/soc2/policies/incident-response.md
@@ -7,7 +7,7 @@
3. **Contain**, as fits:
- a misused account: remove it in the identity provider, or reset its two-step sign-in under People (which signs it out everywhere); change break-glass passwords;
- a document sent wrongly: void it;
- - a leaked secret: rotate it in Vercel (`BETTER_AUTH_SECRET` signs everyone out and resets two-step sign-in, so rotate it only when it leaked), and deploy;
+ - a leaked secret: rotate it in Vercel and deploy. `BETTER_AUTH_SECRET` signs everyone out and makes every authenticator unreadable, so rotate it only when it leaked, and clear two-step setups first as [self-hosting](../../self-hosting.md#sign-in-security) describes, or nobody who used two-step sign-in can get back in;
- a bad deployment: promote the previous one.
4. **Assess** which records and people are affected, using both audit trails and the SIEM.
5. **Notify** affected customers within `[72 hours]` of confirming an incident that affects their data, and regulators where the law requires.