Machine-translated – improvements welcome. Suggest an improvement
Data to the outside¶
Routes to the outside¶
Ablago never opens a connection to the internet on its own. Every route to the outside is switched off until a person triggers it or the administration switches it on. The overview for users is in the administration handbook under What leaves your library.
| Route | Who switches it on | What goes out | Where in the code |
|---|---|---|---|
| Package catalogue | Administration at the push of a button, setup assistant in the "Packages" step | only the request to the catalogue | server/src/pakete/verwaltung/kataloge.ts, katalogsignatur.ts |
| Version check | Administration at the push of a button (Workbench → Technology) | commit identifier, no data from the Library | server/src/system/system.ts |
| Administration sets up the mail server; users send | sent folders and documents, daily summary (titles, links), invitations, data protection requests, info email to emergency contacts (#812: text only, no link, only three names; at most 20 per day) | server/src/mail/mail.ts, aufgabenmail.ts, notfallkontakte/ |
|
| Mailbox | Administration sets it up | fetching from your own mail server | server/src/post/postfach.ts, postfach-oauth.ts |
| Sign-in via a provider | Administration | sign-in process with the provider | server/src/anmeldung/oidc.ts |
| Package network | Administration confirms on installation | only to the addresses from the manifest or service address | package runner, right netzwerk |
| Retrieval links (data protection request) | Administration creates the link | the request, only after the retrieval code | server/src/datenschutz/abruf.ts |
| Automation: Call URL (#671) | managers of Automations approve a destination (fresh sign-in) and set up the card | depending on the content level notification, IDs or values (POST only, after confirmation) – only to approved destinations | server/src/automatisierung/ausleitung.ts, sicherer-abruf.ts, server/src/automatisierung/automatisierung-aussen.ts |
| Automation: Send e-mail (#671) | managers of Automations | subject and text with placeholders, to people, roles, fields or any addresses; limited per day | the same, sending via mail.ts |
Download (also a letter from template, #1040), email, export and the WebDAV drive ask one shared checkpoint in server/src/ausgang/ (#723, outgoing): read and export permission per folder, through dienst.ausgang.pruefeAusgang or dienst.ausgang.mitnehmbar. "With enclosures?" (#998, default yes) only widens the selection afterwards via dienst.ausgang.mitAnlagen – only by enclosures of the same folder, so with the same permissions; originalEmail: false (#999) leaves the original email out unless it is chosen itself; downloading with enclosures (dokumentMitAnlagenFuerAusgabe) hands out each file as it would singly (stamp, archive version) and packs them into a ZIP.
Rule for new routes: a new route to the outside needs an approved issue, is switched off until someone explicitly switches it on, sends as little as possible (numbers instead of content where that's enough), is listed in this table and in the overview in the administration handbook, and gets a security review.
Counter endpoint and key levels (#625)¶
Other programs (home automation, wall tablet, clients) often only want to know whether there is something new. For that there is GET /api/v1/ich/zaehler (internally /api/ich/zaehler, SichtenDienst.zaehlerAbruf):
curl -i -H "Authorization: Bearer dms_…" https://dms.example.org/api/v1/ich/zaehler
# HTTP/1.1 200 OK
# ETag: "z42-mJ3x0Qe7Kq9VZ1aB2cD3eF"
# {"neuePost":2,"zuErledigen":5,"ueberfaellig":1,"stand":42,"geaendert":"2026-11-03T07:15:00.000Z"}
curl -i -H "Authorization: Bearer dms_…" -H 'If-None-Match: "z42-mJ3x0Qe7Kq9VZ1aB2cD3eF"' https://dms.example.org/api/v1/ich/zaehler
# HTTP/1.1 304 Not Modified (no content)
- Numbers only. The response never contains titles, names, senders or content – not even in future fields. The OpenAPI schema
ZaehlerstandhasadditionalProperties: false; the testserver/test/zaehler-api.test.tschecks the keys and that no texts slip through. - Where the numbers come from.
zuErledigeniseingangfromSichtenDienst.zaehler(#512),ueberfaelligcounts your own overdue entries fromFristen.termine(#528, #725;anstehendwas dropped with #725),neuePostcounts post with the status "New" and "For" = me or empty viazaehleKlauseln– with its ownZaehlerspeicherkeyed to the household version. All within the user's rights (read filter); nothing is recomputed for the endpoint as long as nothing in the household changes. - Version in the database (table
zaehlerstaende, migration 056). For each request the server builds a hash of the numbers (fingerabdruck), compares it with the stored one and only incrementsstandif they differ (Repo.setzeZaehlerstand, anINSERT … ON CONFLICT DO UPDATE … WHERE abdruck IS DISTINCT FROM …: concurrent requests count a change once). Unchanged means: read only. The household version from #512 only lives in memory and starts at 0 after every restart – so it isn't suitable as an ETag. The ETag is"z<stand>-<hash>": the same ETag means the same numbers, even after a restart or a restore. - ETag and 304.
passtEtag(http/routen-hilfen.ts) understands lists,W/…and*. A route sets its own headers viaAntwort.koepfe; it reads request headers viaAnfrage.kopf(name).Cache-Control: private, no-cacheinstead ofno-store, so that programs may revalidate. - Key level "counters only" (
recht = 'zaehler',NUR_ZAEHLERandZAEHLER_PFADinapischluessel.ts).pruefeZugangonly lets it through toGET /api/v1/ich/zaehler; every other route under/api/v1and – explicitly – every internal route with such a key in the header gets403(api.schluessel.nur-zaehler), and so does the drive (webdav/webdav.ts). "Read passwords" doesn't exist for this level. A new interface that accepts API keys must reject this level in the same way. - Limits. The overload protection (#544) counts these requests too. There is no limit per key; a request answered from the cache costs a few milliseconds. If Ablago runs on several servers, each has its own cache (as with #512, at most 5 or 30 minutes old) – until then two servers may briefly return different numbers, and the version then increments more often than necessary.
Adding another number: add a field to Zaehlerzahlen (dienst.ts) and to the OpenAPI schema, and to ZAHLEN in the test – and only numbers. If the meaning of an existing number changes, increase v in the hash so that every client reads once more.
Reporting to the outside¶
Ablago does not report changed numbers on its own: clients query GET /api/v1/ich/zaehler with If-None-Match (see above). The separate counter webhook (#627: server/src/webhook.ts, tables webhooks and webhook_meldungen, setting webhook_ziele, Workbench → Webhooks, My account) was removed with #991 – two ways for the same thing contradict "the same thing in one place" (pattern C9). Migration 106 drops the tables and the setting; old backups can still be restored, because the restore runs the migrations afterwards.
Whoever wants to report something to the outside uses an automation with the Then card "Call URL" or "Send e-mail" (#671, below). It brings its own protection for destinations; nothing from the old webhook is reused – only the signature scheme is the same.
Cards to the outside (#671)¶
Model, cleaning, checking and short form in shared/src/automatisierung-aussen.ts (DannUrl, DannEmail, AussenZiel, zielProblem, zielFuer, urlProbleme, emailProbleme, platzhalterErlaubt); executed in server/src/automatisierung/automatisierung-aussen.ts (DANN_AUSFUEHRER.url / .email, under the system account); outbox, destinations and secrets in server/src/automatisierung/ausleitung.ts, the request in sicherer-abruf.ts (both via the door index.ts). The engine holds the Ausleitung as Automatisierungen.ausleitung and starts its delivery in the leader.
- No API client (scope 08.11.2026): only
GETorPOST, no own headers or credentials, no JSON templates; the response is read (at mostAUSSEN_ANTWORT_MAX) and discarded – only the status counts. - Destinations (setting
automatisierung_ziele,GET/PUT /api/werkbank/automatisierungen/ziele, sensitive actionaussen): prefix of scheme, host, port and path.zielFuercompares vianew URL()(hostname,port, path at a/boundary), never as a string.http://and non-public addresses only withheimnetz: true. Checked when saving (problem on the card; without a destination the automation turns red and pauses), when queueing and when delivering. - SSRF protection (
sichererAbruf):node:http(s)with its ownlookupon the connection – the name is resolved exactly once, all addresses checked (adressArt: public / home network / never; IPv4 in IPv6 and NAT64 as IPv4), one blocked address blocks the name. IP addresses in the URL are checked beforehand (Node calls nolookupthere). Never: metadata addresses (169.254.169.254, fd00:ec2::254 …),0.0.0.0/8, multicast, broadcast. No redirects (3xx = persistent error),agent: false, time limitAUSSEN_GRENZEN.zeitlimitS. - Content levels enforced technically:
meldung(event, event ID, time, name of the automation),kennungen(+ folder ID, type key, changed field keys, link…/ablage/typ:<type>/<folder>),werte(+ title and values as text, onlyPOSTand withbestaetigt; fields as the system account sees them, neverpasswort,tabelleor values withdms1$; withfelderin the event only those). Placeholders in parameters at the first two levels only fromPLATZHALTER_OHNE_INHALT(and parameters of a call from outside) – otherwise a problem when saving, the engine pauses before the run, andparameter()leaves them empty as well. - Outbox (table
automatisierung_ausgang, migration 115): unique per automation, card, event and recipient (schluessel= hash), fetched withFOR UPDATE SKIP LOCKEDand a lease, retried perwiederholungNach(1, 5, 30 minutes, 2, 6 hours). Persistent errors (last attempt, 3xx, 4xx except 408/429, blocked address, destination withdrawn, secret unreadable) →aufgegeben, the automation pauses (angehalten.grund = 'ziel', notice via the technical tasks), open ones are discarded. The job (body, subject, text) isNULLonce finished (CHECK in the migration); the history (GET …/:id/zustellungen) only has destination, state, status, error, attempts, times. Not in the full export. - Signature:
X-DMS-Zeit,X-DMS-Signatur: v1=<hex>(HMAC-SHA256 over<time>.<content>, withGETpath and query –signierterInhalt), plusX-DMS-EreignisandX-DMS-Zustellung. Secret per card inautomatisierung_geheimnisse(encrypted, secret kindaussen, re-encrypted inrepo/pg/geheimnisse.ts), only in the response toPOST …/:id/geheimnis/:karte(sensitive actionaussen). Without a secret unsigned. If the card is removed, its secret goes too. - E-mail: one e-mail per recipient (text only) with a note (
automatisierung.karte.email.fuss). People via their user folder (active, real address), roles viamitgliederDerRolle, fields as a link to users or text withformat: email, any addresses (decision "To is free", 03.11.2026). Placeholders for people withfuelleFuer(#795), otherwise with the system account's permissions. LimitsmailsJeAutomatisierungJeTagandmailsJeTagover 24 hours, counted in the table (across all processes) – above them the run fails with 429. - Packages never bring these cards (
werkbankKartenFehlerinpakete/verwaltung/inhalt-pruefen.ts,ausPaketskips them): a package's permission preview cannot show where data goes – that remains a deliberate decision of the administration. - Visible: destinations on the emergency sheet (
zieleZeile, hosts only); paused automations in the overview and in the e-mail about technical tasks.
Triggering from outside (#679)¶
Something comes in without signing in only via the If card Call from outside ({ art: 'aufruf', parameter: [...] }, shared/src/automatisierung-aufruf.ts). Address, signature and brake live in the subject folder server/src/automatisierung/ (aufruf.ts, door index.ts); the engine calls Aufrufe via Automatisierungen.aufrufe:
- Route
POST /api/aufruf/:kennung(zugang: 'offen', inOFFENofrouten-liste.test.tswith a reason). It hasrohKoerper: AUFRUF_KOERPER_MAX(16 KB,grenzen.ts):http.tsreads such routes in a separate scope where every content type – JSON too – arrives as a buffer; the signature applies to the bytes as they arrived.X-DMS: 1is needed as with every changing request. - Signature as with the former webhook (#627):
X-DMS-Zeit(Unix seconds),X-DMS-Signatur: v1=<hex>= HMAC-SHA256 over<zeit>.<body>with the secret (whsec_…); several separated by commas, one matching is enough (signaturPasst, alwaystimingSafeEqual). Time windowAUFRUF_GRENZEN.fensterS(300 s). - Order in
annehmen: brake per IP range (aufrufBereich– IPv4 /24, IPv6 /64 –,AUFRUF_JE_BEREICH) → address and automation (on, not paused, If cardaufruf) → time and signature (computed even without an address, with a throw-away secret) → replay protection (belegeon the hash of identifier, time and signature, twice as long as the window) → brake for accepted calls per address (AUFRUF_ANGENOMMEN_JE_ADRESSE; above it the marker is released again) → body as JSON object →aufrufParameter(only names of the card, only text, shortened) →reiheoutside the request with a fixed event id from the marker. Every rejection looks the same from outside (401); only the log contains the reason, without identifier and signature. - Brake (security review, PR #1160; limits in
grenzen.ts, all in the short-term state across all processes): up front only the IP range counts. The check is cheap (index and HMAC), so the limit per address (AUFRUF_FEHLVERSUCHE_JE_ADRESSE, hash of the identifier, unknown ones too) and the emergency brake (AUFRUF_FEHLVERSUCHE_GESAMT) only count rejected calls (abgelehnt()); above them Ablago answers429, without further counting or logging. A validly signed call is always checked and only counts againstAUFRUF_ANGENOMMEN_JE_ADRESSE– so without the secret nobody can shut down one address or all of them. - Storage: table
automatisierung_aufrufe(migration 112), at most one row per automation,ON DELETE CASCADE; the secret encrypted (dienst.verschluesseleGeheimnis), locationquelle: 'aufruf'and secret typeaufrufingeheimnisse.ts, re-encrypted inrepo/pg/geheimnisse.ts(umschluesseln). Not in versions and full export – only the card with its parameter names. - Creating only via
POST /api/werkbank/automatisierungen/:id/aufruf(was: adresse | geheimnis, sensitive actionaufrufinverwaltungsbereiche.ts→ fresh sign-in); the secret is only in this response. Not for automations supplied by packages;liesPaketrejects packages withwenn.art: aufruf,ausPaketskips them. If the If card changes or the automation is deleted, the address is gone. - Placeholders:
fuelleMitsets{zeitpunkt}and the parameters as text in one pass (a value containing{titel}is not replaced again;Object.hasOwn). Run data:laufFuer→aufrufLaufFueromitsparameterif the person does not manage Automations. - Visible:
warnungen().aufrufefor the overview (messageautomatisierung.aufrufewith "Switch all off" viaPOST /api/werkbank/uebersicht/erledigt→aufrufeAbschalten),aufrufListe()for the emergency sheet (aufrufZeile, identifier shortened).
More background in the administration handbook: Technology and Decisions.