diff --git a/.zenodo.json b/.zenodo.json
index d81d47bd..2b6c65fa 100644
--- a/.zenodo.json
+++ b/.zenodo.json
@@ -1,8 +1,8 @@
{
- "title": "Catalog of Second Chances (CSC) - Digital Database and Corresponding Interfaces for ReUse of Architectural Components (v0.6.2.1)",
- "version": "0.6.2.1",
+ "title": "Catalog of Second Chances (CSC) - Digital Database and Corresponding Interfaces for ReUse of Architectural Components (v0.6.3.0)",
+ "version": "0.6.3.0",
"upload_type": "software",
- "description": "
The Catalog of Second Chances (CSC) is a prototypical digital component database. It catalogs digital representations of uniquely identifiable architectural components for reuse. Furthermore, it provides corresponding interfaces and tools to leverage them via a backend REST-API, a web-frontend as well as a interface for direct interaction within Rhino Grasshopper.
Changes in v0.6.2.1 (unreleased)
Changed
- Similarity Map: the component map is now called \"Similarity Map\" in the navigation, on the page and in the admin logs, so it is not mistaken for a location map. Its address is
/components/similarity-map; the old /components/map is not redirected. - Grasshopper sign-ins last 6 hours (decision 8.166) instead of 30 minutes, so longer sessions no longer need the Refresh input; the web keeps 30 minutes.
Server notes
CSC_GH_TOKEN_HOURS (optional, 1 to 24, default 6) sets the lifetime of Grasshopper sign-ins; no change is needed for the default.
Full history: CHANGELOG.md
",
+ "description": "The Catalog of Second Chances (CSC) is a prototypical digital component database. It catalogs digital representations of uniquely identifiable architectural components for reuse. Furthermore, it provides corresponding interfaces and tools to leverage them via a backend REST-API, a web-frontend as well as a interface for direct interaction within Rhino Grasshopper.
Changes in v0.6.3.0 (2026-10-21)
Added
- Access tokens (decision 8.167): admins create personal access tokens in Settings (30 days, 90 days or one year; shown once, stored only as a hash, at most 10 active), renew and revoke them; admins see and revoke every token on a new admin page. A token reads the catalog only where its scope allows;
GET /auth/token-check tests one. The ground for the MCP layer and the Grasshopper device sign-in of this release. - Using CSC from Claude (decision 8.168): an MCP endpoint at
https://<api host>/mcp with nine read-only tools (search, components, versions, evidence, datasets, timeline, similar components). Add it as a custom connector in Claude; a browser window opens the consent page on the website, where an admin allows read access to the catalog as they see it in the web app. The connection renews itself for up to 90 days and can be revoked in the token list. Answers carry no e-mail addresses and mark everything that is not public. - Grasshopper signs in without a password (decision 8.168): the Session component has a
SignIn button (Windows). It opens the browser, you allow \"Grasshopper on this computer\" on the website, and the sign-in is stored for your Windows user (encrypted with DPAPI, one per server), outside every Grasshopper file. Later runs sign in by themselves and renew their token; SignOut ends the sign-in on the computer and the server. Each sign-in appears in the token list in Settings, where it can be revoked.
Changed
- Session component: new inputs
SignIn and SignOut; Refresh is gone, because the sign-in renews itself. Connected Username and Password still win and stay the way to sign in on macOS; with them the component signs in again by itself when its 6-hour token runs out. Update the components with CSC_Update. - Viewer: a \"Piece opacity\" slider in the Overlay panel fades the mesh, proxy or point cloud so reinforcement and other overlays show through. The Mesh and Point cloud switches are labelled and have an \"Off\" choice instead of the \"Show mesh\" and \"Show point cloud\" checkboxes; \"Show edges\" moved to the overlays.
Security
- A password change or reset ends every access token of the account: personal access tokens, Claude connections and Grasshopper sign-ins. Afterwards create a new token, allow Claude again and press
SignIn again.
Server notes
CSC_PAT_ROLES (optional, default admin) names the roles that may create access tokens.- The new collections
access_tokens, oauth_clients, oauth_requests, oauth_codes and oauth_used_refresh need the same database rights as the others; their indexes are created at the start. - Set
CSC_PUBLIC_API_URL=https://<api host> (no path) in the backend environment: it turns on /mcp and the OAuth server and is the address the connector is given. It also becomes the base of the links in the JSON-LD export (if it was unset so far, those links took the request's own address). After the restart, check that https://<api host>/.well-known/oauth-protected-resource/mcp answers, then add the connector once in claude.ai. - The deploy installs the MCP Python SDK (
mcp) and its dependencies (cryptography among them). - In read-only mode
/mcp and the token renewal keep working; a code issued just before the switch can still be exchanged once. New consents are refused until the flag is gone.
Full history: CHANGELOG.md
",
"creators": [
{
"name": "Eschenbach, Max Benjamin",
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 06f74a97..ee2f04fc 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,7 +5,61 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
-## [0.6.2.1] - unreleased
+## [0.6.3.0] - 2026-10-21
+
+### Added
+
+- **Access tokens** (decision 8.167): admins create personal access tokens in Settings (30 days,
+ 90 days or one year; shown once, stored only as a hash, at most 10 active), renew and revoke
+ them; admins see and revoke every token on a new admin page. A token reads the catalog only
+ where its scope allows; `GET /auth/token-check` tests one. The ground for the MCP layer and the
+ Grasshopper device sign-in of this release.
+- **Using CSC from Claude** (decision 8.168): an MCP endpoint at `https:///mcp` with
+ nine read-only tools (search, components, versions, evidence, datasets, timeline, similar
+ components). Add it as a custom connector in Claude; a browser window opens the consent
+ page on the website, where an admin allows read access to the catalog as they see it in the
+ web app. The connection renews itself for up to 90 days and can be revoked in the token
+ list. Answers carry no e-mail addresses and mark everything that is not public.
+- **Grasshopper signs in without a password** (decision 8.168): the Session component has a
+ `SignIn` button (Windows). It opens the browser, you allow "Grasshopper on this computer" on
+ the website, and the sign-in is stored for your Windows user (encrypted with DPAPI, one per
+ server), outside every Grasshopper file. Later runs sign in by themselves and renew their
+ token; `SignOut` ends the sign-in on the computer and the server. Each sign-in appears in the
+ token list in Settings, where it can be revoked.
+
+### Changed
+
+- **Session component:** new inputs `SignIn` and `SignOut`; `Refresh` is gone, because the sign-in
+ renews itself. Connected `Username` and `Password` still win and stay the way to sign in on
+ macOS; with them the component signs in again by itself when its 6-hour token runs out.
+ Update the components with `CSC_Update`.
+- **Viewer:** a "Piece opacity" slider in the Overlay panel fades the mesh, proxy or point
+ cloud so reinforcement and other overlays show through. The Mesh and Point cloud switches are
+ labelled and have an "Off" choice instead of the "Show mesh" and "Show point cloud"
+ checkboxes; "Show edges" moved to the overlays.
+
+### Security
+
+- **A password change or reset ends every access token of the account**: personal access
+ tokens, Claude connections and Grasshopper sign-ins. Afterwards create a new token, allow
+ Claude again and press `SignIn` again.
+
+### Server notes
+
+- `CSC_PAT_ROLES` (optional, default `admin`) names the roles that may create access tokens.
+- The new collections `access_tokens`, `oauth_clients`, `oauth_requests`, `oauth_codes` and
+ `oauth_used_refresh` need the same database rights as the others; their indexes are created
+ at the start.
+- Set `CSC_PUBLIC_API_URL=https://` (no path) in the backend environment: it turns on
+ `/mcp` and the OAuth server and is the address the connector is given. It also becomes the
+ base of the links in the JSON-LD export (if it was unset so far, those links took the request's own address).
+ After the restart, check that `https:///.well-known/oauth-protected-resource/mcp`
+ answers, then add the connector once in claude.ai.
+- The deploy installs the MCP Python SDK (`mcp`) and its dependencies (`cryptography` among them).
+- In read-only mode `/mcp` and the token renewal keep working; a code issued just before the
+ switch can still be exchanged once. New consents are refused until the flag is gone.
+
+## [0.6.2.1] - 2026-10-20
### Changed
diff --git a/README.md b/README.md
index c3e209cb..242bd877 100644
--- a/README.md
+++ b/README.md
@@ -29,8 +29,8 @@ framework
## Current Versions
-- **CSC**: 0.6.2.1 --- backend, web frontend and Grasshopper interface are released together
- under one version (tag `v0.6.2.1`); the single source is the `VERSION` file.
+- **CSC**: 0.6.3.0 --- backend, web frontend and Grasshopper interface are released together
+ under one version (tag `v0.6.3.0`); the single source is the `VERSION` file.
See `CHANGELOG.md` for release notes.
@@ -229,10 +229,41 @@ The CSC Grasshopper Interface consists of Python 3 components that can be used d
- **Location**: `grasshopper_userobjects_src/` - Source files for development
- **Installation**: Copy `.ghuser` files from `grasshopper_userobjects/` to your Grasshopper UserObjects folder
- **Requirements**: Python 3 with packages: requests, numpy, scipy, scikit-learn
-- **Authentication**: Use `CSC_SignIn` component first to authenticate with the backend
+- **Authentication**: Use the `CSC_Session` component first to sign in (see "Signing in from Grasshopper" below)
- **Documentation**: Component reference, copy-to-clipboard XML, and release download on the frontend at `/gh-interface`
- **Backend routes**: Release download, sources, XML and updater assets are served under `/ghinterface/` (e.g. `version`, `download`, `src/{name}`, `xml/{name}`, `userobject/{name}`). They come from the GitHub release of the running backend (tag `v`); a `channel` query param (GitHub branch or tag) overrides that for testing.
+### Signing in from Grasshopper
+
+The `CSC_Session` component has two button inputs, `SignIn` and `SignOut`.
+
+- **SignIn (Windows, Rhino 8)**: press it, the browser opens on the CSC
+ consent page ("Sign in Grasshopper on this computer"), press Allow, and
+ Grasshopper is signed in; no password goes into a document or an input. The
+ component listens for the answer on your own computer only (`127.0.0.1`, a
+ random port, at most 10 minutes, once) and Grasshopper stays usable while it
+ waits. The sign-in is kept for your Windows user, encrypted with DPAPI, in
+ `%APPDATA%\DDU_CSC\signin.json` (one entry per server address): after a
+ restart of Rhino the component signs in again by itself. The access token is
+ good for an hour and renews itself through that sign-in, also when a call
+ answers 401; the stored sign-in is good 30 days after its last use and at
+ most 90 days from your consent, then press SignIn again. Every account with a
+ verified address may do it (it is no role).
+- **SignOut**: deletes the stored sign-in on this computer and revokes it on the
+ server.
+- **Revoke from the website**: Settings, "Access tokens" lists every
+ sign-in as "Grasshopper on" the name of that computer; "Revoke" ends it (the
+ hour of the current access token runs out; the sign-in cannot renew).
+- **Username and Password** stay as the fallback (and the only way on macOS):
+ when both are connected they win over the stored sign-in. That path renews
+ itself too: when a call answers 401 the component signs in once more with
+ them and repeats the call.
+- **Pressing SignIn without Windows** says that the sign-in without a password is
+ Windows only.
+- **Changing or resetting your password** ends every Grasshopper sign-in of the
+ account too (and every other token and connection): the stored sign-in cannot
+ renew any more, so press SignIn again afterwards.
+
## Releases and deployment
Backend, web frontend and Grasshopper interface are one product with one
@@ -430,6 +461,99 @@ browser wrote itself stands on the left of that chain and is never believed.
share a limit (the Uberspace manual does not state which headers its proxy
sets or from which address it connects).
+## Access tokens
+
+A personal access token lets a tool other than the web app (for instance an AI
+assistant through the MCP layer) read the catalog as its owner, and nothing
+more. It is not the JWT of a sign-in: a token only works where its scope says,
+and a JWT does not work in place of it.
+
+- **Who.** Administrators at first. `CSC_PAT_ROLES` (default `admin`, a comma
+ list of the global roles `admin` and `user`) opens it to more; the role is
+ checked again on every request, so an account that loses it stops working at
+ once. Everyone sees and revokes the tokens they hold in Settings, "Access
+ tokens"; administrators see every token under Admin, "Access tokens", and can
+ revoke any.
+- **Create.** Settings, "Access tokens": a name and a lifetime of 30 days, 90
+ days (the default) or 1 year; there is no token without an expiry. The token
+ (`csc_pat_` and 43 characters) is shown once, with a copy button; copy it
+ then. The list shows only its first 8 characters, name, scope, created, last
+ used and expiry. At most 10 active tokens per account.
+- **Renew.** Within 14 days of the expiry (and after it) the list offers
+ "Renew": a new token with the same name is made and shown once, the old one
+ is revoked.
+- **Revoke.** "Revoke" in the list stops the token at once. Revoked and expired
+ tokens, a lost role, an unverified, disabled or deleted account all stop it
+ at once: the database is asked on every request, nothing is cached.
+- **Try a token.** `curl -H "Authorization: Bearer csc_pat_..."
+ https:///auth/token-check` answers the owner, the scope and the
+ expiry; every other answer is the same 401, whatever the reason. This path
+ and `/mcp` need no `X-CSC-Client` header (the connectors of Claude cannot
+ send one); every other route still does.
+- **Limits and the log.** 120 requests a minute per token (counted per worker,
+ like the read limits); the last use is written at most once a minute and not
+ at all while the maintenance flag is set; creating, renewing and revoking are
+ writes and get the 503 of that flag. The log has one line per use: the first
+ 8 characters of the token and the route, no personal data.
+- **Stored.** Only the SHA-256 of a token is stored (collection
+ `access_tokens`), so a leaked database holds no usable token.
+- **Password.** Changing your password (Settings) and resetting it by mail end
+ every token and connection of the account at once, of every kind: personal
+ access tokens, Claude connections and Grasshopper sign-ins, their refresh
+ tokens included. Afterwards make a new token, press Allow in Claude again and
+ press SignIn in Grasshopper again.
+
+## Using CSC from Claude
+
+Claude can read the catalog as you: ask it to find components, show one with its
+versions and measurements, compare, or look at what happened to a piece. It
+only reads, and it sees what you see on the website; nothing it can reach is
+private to anybody else. Administrators can connect it for now (the roles are
+`CSC_PAT_ROLES`).
+
+**Connect.** In Claude, add a custom connector (claude.ai: Settings, Connectors,
+Add custom connector; Claude Code: `claude mcp add --transport http csc
+https:///mcp`) and give it the address `https:///mcp`, for
+the production server `https://api.2ndchances.build/mcp`. Claude opens the CSC
+consent page: sign in if asked, check the address it says you will be sent back
+to (for Claude on the web that is `claude.ai`), and press Allow. Deny, or closing
+the page, connects nothing. Nothing is remembered: every connection asks again.
+Allow only connections you started yourself: anyone can start an authorization
+and send you the link, so look at the large address line (the host you will be
+sent back to) before you press Allow, and press Deny when it is not the tool you
+just connected.
+
+**What it can do.** Nine read-only tools: `search_components` (the filters of
+Browse, a page at a time), `get_component`, `list_versions`, `get_version`
+(geometry as counts and a link, never the meshes), `get_evidence`,
+`list_datasets`, `get_dataset`, `get_timeline` and `similar_components` (the
+nearest neighbours on the similarity map, with their distance). Every answer
+carries the web link of the record, and a record that is not public is marked
+(`visibility` private, `status` other than published). There are no write tools
+and no tool for users, invitations or tokens; no answer holds an e-mail address
+or an account id.
+
+**How long it lasts.** The connection gives Claude an access token of one hour
+and a refresh token that Claude renews by itself: the refresh token is good for
+30 days after its last use and is replaced on every use (using an old one ends
+the connection), and a connection never lasts more than 90 days from your
+consent, then Allow again. Each connection is a line under Settings, "Access
+tokens" (and under Admin for administrators): "Revoke" ends it at once, access
+and refresh. An account that loses its role, is disabled or is deleted stops
+working at once, because every call asks the database.
+
+**For scripts and other clients.** A personal access token (Settings, "Access
+tokens") works on `/mcp` too, as `Authorization: Bearer csc_pat_...`, for a
+client that sends a header and cannot sign in through a browser.
+
+**On the server.** `CSC_PUBLIC_API_URL` must be the API address (`https://`); the MCP endpoint and the OAuth server (`/.well-known/...`, `/register`,
+`/authorize`, `/token`, `/revoke`, `/mcp`) are served by the backend and are off
+without it. During maintenance (the read-only flag) `/mcp` and the refreshing of
+tokens keep working; a new connection, a new registration and a revoke wait. The
+limits: 120 requests a minute per token, and per address on registering,
+authorizing and the token endpoint.
+
## Custom domain (`2ndchances.build`)
`2ndchances.build` is the canonical frontend origin; The old address `ddu.uber.space`
diff --git a/VERSION b/VERSION
index af7f6f3d..1e40a508 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-0.6.2.1
+0.6.3.0
diff --git a/docs/adr/DESIGN_DECISIONS.md b/docs/adr/DESIGN_DECISIONS.md
index f43280cf..fcee1b51 100644
--- a/docs/adr/DESIGN_DECISIONS.md
+++ b/docs/adr/DESIGN_DECISIONS.md
@@ -258,7 +258,7 @@ into one **metadata object**.
| 8.121 | **P12 preparation review: sweep only on request, map distance to the face plane, outline cap** (user 2026-10-07, after the review of the P12 preparation and the incident in which a local geometry run deleted one derived preview in the local asset original). (a) `main_geometry.py` sweeps orphaned previews only with an explicit `--sweep` flag, default off; only the production cron (`uberspaceconfig/crontab`) sets it; the guard "no snapshot in the database" stays. On the server the asset folder is the one the production database describes, so the sweep there is right (P12 checklist). Local `dev.env` points every `SNAPSHOT_*_DIR` at `.dev/assets/` (a copy of the assets, gitignored), never at an original. (b) The deviation maps' distance channel measures the signed distance to the plane (or surface) of the face the point is assigned to (8.119 a), so a recess shows its full depth on the face it is drawn on; the residual figures (`rms`, `p95`, `max`, `inlier_ratio`) stay the distance to the nearest proxy surface. (c) The planar prism's outline input is capped at 50 000 points (strided before `_thin`); the outline does not need the map density; measure the largest flat piece (the aerated concrete wall) once. (d) **A planar accept check with a box fallback** (user 2026-10-07, from the measurement of (c)): a plain rectangular scanned slab fitted a ragged prism with p95 about 1.5 m, because `_accept` only guarded linear prisms. A planar prism is accepted only when its p95 is at most one thickness (`PRISM_PLANAR_TOLERANCE` 1.0; the 11 planar prisms of dump 261001 sit at 0.07--0.39, notched slabs at 0.003--0.006, the broken plain wall at 7.6) and its rms is not worse than the frame's box on the same sample (the rms, not the p95: a notch covers too little surface for the p95 to tell box and prism apart); otherwise the box is the primary proxy. On 261001 none of the 11 planar pieces switches. | Rejected: a sweep on every full pass whatever the stages; the map distance to the nearest surface (understates recesses on the face they belong to). |
| 8.122 | **Cutover runbook: one offline day, restore until reopening, fixed smoke list** (user 2026-10-07; closes O12). (a) The whole cutover runs on one day with the site offline: the 0.5.1.0 backend is stopped and both crons (`geometry_cronjob`, `geometrymaintenance_cronjob`) are paused from the dump until reopening. No write freeze while 0.5.1.0 runs (it has no read-only mode), no announcement, teaching dates are not considered. (b) `CSC_MIN_CLIENT_VERSIONS` is set in the 0.6 deploy itself, so old UserObjects are refused from the first minute; two update passes (the old `CSC_Update` installs the 0.6 UserObjects, the new one `csc_gh`, each followed by a Rhino restart) and broken old definitions are accepted. The user tests the old update path against 0.6 with the minimum set before the day (`/auth/token` and `/ghinterface/` are exempt, so it should work) and again on production in the day. (c) Rollback: a dirty rehearsal on the cutover dump aborts before production is touched (restart 0.5.1.0, nothing to restore); a failure from the deploy on that cannot be fixed the same day restores everything --- `mongorestore --drop` of the cutover dump, `csc_release_deploy.sh --rollback`, `rsync --delete` of the asset folders from the morning backup (0.6 adds maps, previews, capture copies and import files there, and the 0.5.1.0 maintenance cron would sweep a mixed folder), restart 0.5.1.0. Reopening is the point of no return; after it, fix forward with 0.6.0.x. (d) The day runs in the order of plan P12 "Cutover day"; the geometry runner and the external catalogue import run inside the offline window; the map cache is rebuilt once, after the runner. The maintainer's personal account already exists on production, so the import needs no account step; the other personal accounts and 11b (plan step 6) follow after the cutover. (e) Reopening needs `check_invariants` with 0 errors, `GET /geometry/stale` empty, checks 4b and 4c, and the fixed smoke list of plan P12, ticked line by line. (f) Geometry result cache (user 2026-10-07): before the day, one full local pass of the geometry runner on the latest rehearsal database and a local asset copy writes every result (result JSON, deviation maps, `preview.webp`) to a cache directory, keyed by snapshot id, the chosen PLY per mesh / cloud with its size, the stage versions and the context; on the day `main_geometry.py --remote --cache-dir ` uploads a cached result through `POST /geometry/results/{sid}` when the key matches what `GET /geometry/work/{sid}` returns (no PLY download, no computation) and computes as today otherwise. A refresh pass on the last rehearsal before the day keeps the cache current. Copying derived fields or files directly is rejected: the stamps hold the PLYs' `st_mtime_ns` (`geometry_source.py:84`), which a copy changes (NTFS keeps 100 ns), so the server would mark every snapshot stale; with the remote route the server recomputes the stamps itself and a wrong key can only cost time (409, then compute). | Rejected: a 0.5.1.x read-only release for a freeze window; reopening before the geometry runner finished; a free smoke check; copying geometry results into the database or by FTP. Plan P12. |
| 8.123 | **Older versions: fill empty capture fields once, corrections that keep their place, edit any version** (user 2026-10-07; question: an escape hatch to add information to the first scan). No force or hard edit, for any role: the freeze of published claims stays (I21, CPR integrity); a real emergency stays a reviewed script. (a) **Fill once:** a frozen `capture` field (`method`, `device`, `software`, `captured_at`, `coordinate_system`, `markers`, `fixtures`) that is empty on a published snapshot may be set in place by `moderator(D)`, once, through the ordinary PATCH (change history records it); changing a value that is set stays a correction. (b) **Corrections keep their place:** a correction still gets the next `version` number and its predecessor's `effective_from`, but I3 orders it at the position of the first record of its `supersedes` chain, and the timeline shows it as that version, corrected; today the I3 check refuses to publish a correction of v0 while a later v1 is live (`snapshot_lifecycle.py:165`). A published correction becomes current only when its predecessor was current; the server ignores `promote` otherwise (today both publish buttons send `?promote=1`, `SnapshotLifecycleActions.tsx:133`, `SnapshotQueue.tsx:97`). Test: correct v0 while v1 is current. (c) **Edit any version:** "Edit details" offers a version choice (`?snapshot=`) and gains the fields `capture.notes`, `effective_from` and, with (a), the empty capture fields; the API already allows these edits on any version. | Rejected: an admin hard edit of frozen fields; filling empty `fragment` / `quantity` in place (they change what the piece is). Spec section 3.2.2, I3, I21; CONTEXT Correction. |
-| 8.124 | **Mail: password reset, visible send failures, one monitored sender, one template** (user 2026-10-07; closes O4). (a) **Self-service password reset:** "Forgot password" on the sign-in page; `POST /auth/password-reset {email}` always answers 202 (no account enumeration) and mails a single-use token (stored as a hash, 1 h, rate-limited: 3 mails per hour per address, 20 requests per hour per client address so a seminar room behind one NAT is not refused); `POST /auth/password-reset/confirm {token, new_password}`. The user document gains `password_changed_at`; a token issued (`iat`) before it is refused (`lookup_user_from_token` loads the user on every request, so this is cheap); `change-password` sets it too, so both sign out every other device and the GH Session. No admin-set passwords. As built: confirming a reset also sets `email_verified` (the link reached the mailbox, the same proof as the verification mail); a password change signs the web client out instead of returning a fresh token. (b) **Send failures are visible:** `POST /invitations` reports `result: 'mail_failed'` per address and the UI offers **Resend** (a new code, the old one invalid in the same write, a new expiry of `expires_days` from the resend, default 14); the member editor shows `mail_failed` for the "added to dataset" notice (the membership stands). The link is never shown to the inviter: a code sign-up is verified at once (`auth.py:271`, 8.14), so the code must reach only the mailbox. The reset stays 202 when its mail fails; the failure goes to the server log. Mails are sent off the event loop (`run_in_threadpool`), a bulk invitation over one SMTP connection; every inserted value is HTML-escaped (today inviter and dataset names go in raw). (c) **Sender:** a new, monitored mailbox on Uberspace (the production SMTP) is the `From` of every mail, so SPF / DKIM / DMARC align and bounces and auto-replies are seen; `Reply-To` the acting moderator for the invitation and the "added to dataset" notice, none for verification and reset *(amended 2026-10-08: mails are sent from a noreply mailbox, a real mailbox that receives the bounces; verification and reset carry `Reply-To` = `SMTP_REPLY_TO`, the support address; invitation and member notice keep the moderator)*. Before the cutover one test mail each to a TU and to a gmail.com / outlook.com address, with SPF / DKIM / DMARC "pass" in the headers (plan P12). (d) **One template** for the four mails (verification, reset, invitation, member notice): plain text + HTML, escaped, the blue CI colour; English only (8.40); subject prefix `[CSC]`; a footer saying why the address got the mail and linking `/imprint`; "Please do not reply" goes (replies reach the `Reply-To` or the monitored sender). | Rejected: admin-set temporary passwords; showing the registration link to the inviter on a failed send; a `noreply` sender nobody reads; German mails. Spec section 3.6 (Mail), section 7 routes. |
+| 8.124 | **Mail: password reset, visible send failures, one monitored sender, one template** (user 2026-10-07; closes O4). (a) **Self-service password reset:** "Forgot password" on the sign-in page; `POST /auth/password-reset {email}` always answers 202 (no account enumeration) and mails a single-use token (stored as a hash, 1 h, rate-limited: 3 mails per hour per address, 20 requests per hour per client address so a seminar room behind one NAT is not refused); `POST /auth/password-reset/confirm {token, new_password}`. The user document gains `password_changed_at`; a token issued (`iat`) before it is refused (`lookup_user_from_token` loads the user on every request, so this is cheap); `change-password` sets it too, so both sign out every other device and the GH Session. No admin-set passwords. As built: confirming a reset also sets `email_verified` (the link reached the mailbox, the same proof as the verification mail); a password change signs the web client out instead of returning a fresh token. (b) **Send failures are visible:** `POST /invitations` reports `result: 'mail_failed'` per address and the UI offers **Resend** (a new code, the old one invalid in the same write, a new expiry of `expires_days` from the resend, default 14); the member editor shows `mail_failed` for the "added to dataset" notice (the membership stands). The link is never shown to the inviter: a code sign-up is verified at once (`auth.py:271`, 8.14), so the code must reach only the mailbox. The reset stays 202 when its mail fails; the failure goes to the server log. Mails are sent off the event loop (`run_in_threadpool`), a bulk invitation over one SMTP connection; every inserted value is HTML-escaped (today inviter and dataset names go in raw). (c) **Sender:** a new, monitored mailbox on Uberspace (the production SMTP) is the `From` of every mail, so SPF / DKIM / DMARC align and bounces and auto-replies are seen; `Reply-To` the acting moderator for the invitation and the "added to dataset" notice, none for verification and reset *(amended 2026-10-08: mails are sent from a noreply mailbox, a real mailbox that receives the bounces; verification and reset carry `Reply-To` = `SMTP_REPLY_TO`, the support address; invitation and member notice keep the moderator)*. Before the cutover one test mail each to a TU and to a gmail.com / outlook.com address, with SPF / DKIM / DMARC "pass" in the headers (plan P12). (d) **One template** for the four mails (verification, reset, invitation, member notice): plain text + HTML, escaped, the blue CI colour; English only (8.40); subject prefix `[CSC]`; a footer saying why the address got the mail and linking `/imprint`; "Please do not reply" goes (replies reach the `Reply-To` or the monitored sender). **Amended by 8.168 f (user 2026-10-20):** a password change or reset also revokes every access token of the account (kinds `pat`, `oauth`, `device`), so stored Grasshopper sign-ins and Claude connections end with it; a still-running access token lasts at most its hour. | Rejected: admin-set temporary passwords; showing the registration link to the inviter on a failed send; a `noreply` sender nobody reads; German mails. Spec section 3.6 (Mail), section 7 routes. |
| 8.125 | **Private means private: asset files out of the web root, one admin, 11b only for migrated datasets** (user 2026-10-08; the external catalogues are imported without the operators' consent, so they must be visible to the maintainer only, also by explicit id). The leak audit found the API tight (every read by id answers 401 / 403 to non-members; lists, counts, stats and evidence queries are filtered) and four gaps. (a) **Asset files:** the six `SNAPSHOT_*_DIR` folders (previews, photos, meshes, point clouds, proxies / deviation maps, capture fixtures) lie under the Apache document root (`~/html/csc_assets/`) and are served without sign-in to anyone who knows a snapshot id --- for every members-only dataset, not only the external catalogues. At the cutover they move to `~/csc_assets_private/` (next to the evidence attachments, which are already private) and the env follows; `~/html/csc_assets/.htaccess` gets `Require all denied` as a second guard; before the day every direct `csc_assets` URL user (frontend image config, `lib/utils.ts`, Grasshopper library and components, exports) moves to the authenticated `/snapshots/...` routes, which already serve public pieces to anonymous callers. (b) **Admins:** admins keep the implicit membership of every dataset (emergency hatch, no per-dataset exception), so production has exactly two admin accounts, both held by the maintainer: the shared `admin` account and the maintainer's personal account. The `ddu_aggregations` project lead loses the global admin role at the cutover (amends the last clause of 8.26) and keeps contributor + moderator of that dataset. (c) **Step 11b:** the mapping's global `moderators` are added only to the datasets the migration created (step 11), never to a dataset created later; a later dataset gets members from 11b only when the mapping names it under `members`. Today a rerun after the import would make the second moderator a moderator of the two external catalogue datasets. (d) **Map count:** the cached map payload's `total` counts hidden pieces, so anyone can derive how many there are; `total` is computed from the points the caller may see. Accepted, not fixed: the existence oracles (an id of a hidden piece answers 401 / 403, not 404; the imported uuid5 ids need the untracked namespace to guess) and the gap the import leaves in `catalog_number`. Whether a private copy of the files without consent is acceptable is the maintainer's call, outside this decision; the fallback stays 8.110 d (cite by `url` + `retrieved_at`). | Rejected: a per-dataset exclusion of admins; keeping the files in the web root behind unguessable ids; a 404 for hidden ids (breaks the 8.11 "not public" page). Plan P12; spec section 3.6, section 8 step 11b. |
| 8.126 | **A student's spherical harmonics descriptor may be read and integrated** (user 2026-10-08). The author of the student repository `00_Trajectory_Vault_Reuse` has agreed that CSC reads the repository and integrates its spherical harmonics (SH) shape descriptor (`M4_SHGoal.py`). Credit in committed files by role ("student contribution"), never by name (8.27); URL and contact stay in untracked notes. The repository has no licence file yet: the maintainer asks the author to commit a permissive one (MIT, Apache-2.0 or similar). | Findings in `SH_DESCRIPTOR_SOURCE_2026-10-08.md`. No code is copied before the licence is committed; the copied file keeps the author's licence header. Integration details are open topics O19--O25. |
| 8.127 | **Grasshopper supplies drafts; submitting happens in the web, also in bulk** (user 2026-10-08, from the reinforcement layout review). The `Submit` input leaves `AddEvidence`, `AddComponentIdentity` and `AddComponentSnapshot`: everything written from Grasshopper lands as a **draft** of its author and is completed (attachments such as the archival drawing, checks) and submitted in the web. My work gains a **bulk submit** (select own drafts, snapshots and evidence alike --> Submit; per-record results, a refused record does not stop the others), because a robot-scan or layout run creates many drafts at once. **Evidence drafts are editable in the web** (found in the demo, 2026-10-08: a saved rebound draft could not be edited): an **Edit** action on a draft (author or `moderator(D)`) and on a pending record (`moderator(D)`) opens the evidence form with `?edit=`, prefilled as for a correction, and saves with `PATCH /evidence/{id}` (the backend already allows it, `evidence_lifecycle.py:459`); the record keeps its status and attachments. Several reinforcement layouts per piece (a drawing and a covermeter / Ferroscan survey) already work: no uniqueness per method, the fold ranks ndt above archival. Built before the cutover; the other items of the reinforcement-layout review (viewer colour-coding by layout or diameter, attachments carried over on a correction, fill once for empty `document` fields, `url` / `retrieved_at` in the GH builder, one `position.kind`, a `rebar_spec` claim) follow in 0.6.0.1 (plan, backlog RL3--RL8). | Rejected: keeping `Submit` in GH next to the web path (two ways, and a pending record cannot take the author's files). Builds on 8.120. Plan P12 backlog. |
@@ -299,8 +299,10 @@ into one **metadata object**.
| 8.162 | **Per-account limit of failed sign-ins** (user 2026-10-17; 0.6.2.0 T5, from 8.144 a). `POST /auth/token` counts failed sign-ins per identifier: at most 10 in 15 minutes, then 429 with `Retry-After` until the window moves on; a successful sign-in is not counted; no permanent lock, nothing for an admin to unlock. The key is an HMAC-SHA256 of the lowercased identifier with a key derived from `JWT_SECRET`, so the counter collection holds no username or address (8.144 h). An unknown identifier is counted and answered exactly like a known one (no account test). The counters live in the shared MongoDB store of 8.152. The per-address limit (10 a minute) stays. The 429 text points to the password reset, which keeps its own limit (3 an hour per address). | Rotating addresses defeat a per-address limit alone; a targeted 15-minute lock-out of one account is accepted at CSC's size. |
| 8.163 | **Request bodies rejected before they are read** (user 2026-10-17; 0.6.2.0 T5, from 8.144 a). An ASGI middleware in front of every route caps the body per route group from the settings: the mesh and point cloud uploads `GEOMETRY_UPLOAD_LIMIT_MB`, evidence attachments `EVIDENCE_UPLOAD_LIMIT_MB`, photos `SNAPSHOT_PHOTO_UPLOAD_LIMIT_MB`, each plus 1 MB for the multipart overhead; every other route (JSON) 16 MB through a new `CSC_JSON_BODY_LIMIT_MB`; the remote runner's result route keeps its own limits. A `Content-Length` above the cap answers 413 before any byte is read; without one (chunked) the middleware counts the bytes and answers 413 as soon as the cap is passed. `read_upload_limited` stays as the second check. | Starlette spools a whole multipart body to a temporary file before the route runs, and JSON bodies had no cap; Uberspace's web backend passes requests straight to gunicorn, so the web server cannot cap them per route. |
| 8.164 | **Content-Security-Policy: scripts by nonce, styles inline allowed** (user 2026-10-17; 0.6.2.0 T6, completes 8.144 g). The web app sends one CSP header, built per request in `proxy.ts` (its matcher then covers every page path, auth gated inside the function): `default-src 'self'`; `script-src 'self' 'nonce-' 'strict-dynamic' 'wasm-unsafe-eval'` (wasm for the meshopt decoder drei always sets up; local development adds `'unsafe-eval'` and `ws:` for HMR); `style-src 'self' 'unsafe-inline'`; `img-src 'self' blob: data:` (plus the static host when `NEXT_PUBLIC_STATIC_BASE_URL` is set); `connect-src 'self'`; `font-src 'self'`; `worker-src 'self' blob:`; `media-src 'self' blob:`; `frame-src https://maps.google.com https://www.google.com`; `object-src 'none'`; `base-uri 'none'`; `form-action 'self'`; `frame-ancestors 'none'`. The nonce goes to Next's own scripts (automatic) and to next-themes (`nonce` prop from the request headers). The static `frame-ancestors` CSP of `lib/securityHeaders.ts` is merged into it (one CSP header); `X-Frame-Options` and the other headers of 8.144 g stay. Rollout (user, same day): enforced at once, no Report-Only phase and no report endpoint. Before the release the implementer walks the production build (`next build` + `next start`, not dev) through the main pages in a browser with the console checked for violations (home, Browse, map, component page with mesh, point cloud and proxy overlay, History with the swimlane PNG export, photos, QR scanner, the Google map, sign-in, registration, admin, mail preview, GH interface); a test checks one CSP header, a fresh nonce per request and the directives. Emergency switch: `CSC_CSP_REPORT_ONLY=1` in the frontend environment sends the same policy as `Content-Security-Policy-Report-Only` (restart of the frontend). | Every page already renders per request (`force-dynamic`), the app has no inline script of its own and talks to its own origin only, so a strict script policy costs little; styles stay inline-allowed because sonner, Radix's scroll lock, styled-jsx and the mail preview inject un-nonced `