Skip to content

About

tocsin - offline, dependency-free EU incident-notification clock: computes every CRA / NIS2 / GDPR / DORA reporting deadline one incident starts, resolves report-anchored clocks, and shows the spread between two defensible readings of Reg. 1182/71

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

Development Experiment 052 — tocsin

The EU incident-notification clock. One security incident can start four independent statutory clocks — CRA, NIS2, GDPR and DORA — that disagree about when they start, how long they run, who they report to and what they want in the envelope. tocsin computes all of them offline and deterministically from a single facts file, resolves the ones that are anchored to other reports you have not filed yet, and shows how much of your remaining time rests on a contested reading of the EU time-limit rules.

Pure Python 3.11+ standard library. No dependencies, no network, no API keys, no LLM. Every number it prints is derived and the derivation is printable.


Thesis

On 11 September 2026 — ten days before this experiment was built — Article 14 of the EU Cyber Resilience Act went live, and ENISA's Single Reporting Platform opened. From that date, anyone who places software, firmware or a connected device on the EU market must report an actively exploited vulnerability within 24 hours of becoming aware of it. That includes one-person companies and companies outside the EU. It is the fourth EU instrument to put a sub-72-hour reporting clock on the same kind of event, and the four do not agree with each other: DORA wants an initial notification within 4 hours of classification and no later than 24 hours from awareness, NIS2 wants an early warning in 24 hours (but a full notification in 24, not 72, if you are a trust service provider), GDPR wants the supervisory authority in 72 hours, and each has a follow-on report anchored not to the incident but to the moment you filed the previous one.

The insight from the research is that the hard part is not knowing the numbers — every law firm published a table — it is that the numbers are not computable from a table. They depend on civil-month arithmetic, on national public-holiday calendars, on which of two readings of Regulation (EEC, Euratom) No 1182/71 governs a given time limit, on an entity-type test buried in a DORA technical standard, and on a dependency graph between reports. Commercial GRC platforms compute this behind a login. Nothing free and offline does.

tocsin is the smallest thing that proves the idea: a declarative obligation catalogue plus a deadline engine that resolves anchors, computes both defensible readings of every limit, grades the current position, and hands you the calendar file and the pre-filled drafts. It is about 80 lines of law expressed as data and a deadline engine that does not guess.

Lane and difference from the recent streak. This is the business, compliance and real-world utility lane. Experiments 046–051 ran through spreadsheets, internationalisation, e-invoicing, energy, accessibility and transit; experiments 001–044 were a long run of offline static auditors for the agent/MCP ecosystem. tocsin is neither: it audits no artifact and lints no file. It is a temporal reasoning engine over statutory obligations — its unit of analysis is a clock, not a document. The nearest neighbour in the ledger, #048 quittance, reconciles arithmetic inside an e-invoice under EN 16931; tocsin computes when a legal duty falls due, which shares no machinery with it.


Install and run

Nothing to install. Python 3.11 or newer.

python main.py check examples/solo-vendor-exploited-vuln.json

make run does the same thing; make test runs the suite.

Because a compliance tool that prints "now" is untestable, every command takes --now to evaluate the position at a fixed instant:

python main.py check examples/bank-major-ict-weekend.json --now 2026-09-19T10:00:00Z

Commands

Command What it does
check FACTS Compute every clock and grade the current position
check FACTS --json The same assessment as a stable JSON document
check FACTS --ics out.ics Write the deadlines as calendar events with one-hour alarms
check FACTS -v Print the full derivation of every deadline, article by article
drafts FACTS --out DIR One Markdown notification skeleton per obligation, gaps marked [MISSING]
regimes The whole obligation catalogue
explain OBLIGATION-ID One obligation: limits, anchors, required content
schema Every accepted field of the facts file
init [--out PATH] A blank facts file to start from
holidays ES 2026 The working-day calendar tocsin will actually use

Exit codes

Code Meaning
0 Clear — nothing overdue, nothing filed late
1 Breach — at least one obligation is overdue or was filed late
2 tocsin could not answer (bad arguments, unreadable or invalid facts)

So tocsin check incident.json drops straight into a cron job or an incident channel bot: non-zero means someone needs to move.


Sample run

$ python main.py check examples/solo-vendor-exploited-vuln.json --now 2026-09-21T13:00:00Z

==============================================================================
tocsin -- EU incident notification clock
==============================================================================
Incident    INC-2026-0042   Marea Firmware S.L.
Calendar    ES / Europe/Madrid
Awareness   2026-09-18 16:42 CEST (UTC+02:00)
Now         2026-09-21 15:00 CEST (UTC+02:00)

REGIMES TRIGGERED
  [x] CRA   Cyber Resilience Act - Regulation (EU) 2024/2847
          actively exploited vulnerability in a product with digital elements

REGIMES NOT TRIGGERED
  [ ] DORA  entity is not a financial entity in scope of DORA
  [ ] GDPR  no personal data breach recorded
  [ ] NIS2  entity is neither an essential nor an important entity under NIS2

CLOCKS  (deadline column is the strict reading -- plan to these)
  STATUS    OBLIGATION         DUE (local)       REMAINING    SLACK
  --------------------------------------------------------------------------
  FILED     CRA-VULN-EW        2026-09-19 16:42  --           +00h 18m
  DUE SOON  CRA-VULN-NOTIF     2026-09-21 16:42  +01h 42m     +00h 18m
  PENDING   CRA-VULN-FINAL     2026-10-04 11:00  +12d 20h 00m +1d 13h 00m
  ~ = deadline is provisional: it is anchored to a report you have not filed yet.

DUTIES WITHOUT A COMPUTABLE CLOCK
  [OWED ] CRA-USERS          Inform impacted users of the vulnerability or incident
             No fixed clock: 'without undue delay' and, where necessary, with
             the risk mitigation and corrective measures users can deploy.

NEXT ACTION
  CRA-VULN-NOTIF -- Vulnerability notification
  Due   2026-09-21 16:42 CEST (UTC+02:00)   (+01h 42m from now)
  Basis CRA Art. 14(2)(b)
  To    CSIRT designated as coordinator and ENISA
  Via   ENISA Single Reporting Platform -> CSIRT designated as coordinator + ENISA

INTERPRETIVE SPREAD
  These deadlines move if Regulation (EEC, Euratom) No 1182/71 governs the
  time limit. The strict column above is the earliest defensible instant; the
  figure below is the latest. tocsin never plans to the latest -- it shows you
  how much of your comfort rests on a reading no authority has confirmed.
    CRA-VULN-EW        strict 2026-09-19 16:42  ->  lenient 2026-09-19 17:00  (00h 18m apart)
      non-working days inside the window: 2026-09-19
    CRA-VULN-NOTIF     strict 2026-09-21 16:42  ->  lenient 2026-09-21 17:00  (00h 18m apart)
      non-working days inside the window: 2026-09-19, 2026-09-20
    CRA-VULN-FINAL     strict 2026-10-04 11:00  ->  lenient 2026-10-05 24:00  (1d 13h 00m apart)
      non-working days inside the window: 2026-09-20, 2026-09-26, 2026-09-27, 2026-10-03, 2026-10-04

==============================================================================
CLEAR -- no obligation is currently overdue
==============================================================================

$ echo $?
0

And the same engine on a Saturday-morning incident at a bank, where three regimes fire at once and the tightest clock has already run out:

$ python main.py check examples/bank-major-ict-weekend.json --now 2026-09-19T10:00:00Z

CLOCKS  (deadline column is the strict reading -- plan to these)
  STATUS    OBLIGATION         DUE (local)       REMAINING    SLACK
  --------------------------------------------------------------------------
  OVERDUE   DORA-INITIAL       2026-09-19 09:40  -02h 20m     +00h 20m
  PENDING   NIS2-EW            2026-09-20 02:15  +14h 15m     +00h 45m
  PENDING   GDPR-33            2026-09-22 02:15  +2d 14h 15m  +00h 45m
  PENDING   NIS2-NOTIF         2026-09-22 02:15  +2d 14h 15m  +00h 45m
  PENDING   DORA-INTERMEDIATE  2026-09-22 09:40  +2d 21h 40m  +00h 20m~
  PENDING   NIS2-FINAL         2026-10-22 02:15  +32d 14h 15m +21h 45m~
  PENDING   DORA-FINAL         2026-10-22 09:40  +32d 21h 40m +14h 20m~

BREACH
  !! DORA-INITIAL (DORA Art. 19(4)(a); RTS (EU) 2025/301 Art. 5(1)) overdue by 02h 20m
     To: Competent authority. Via: Supervisory reporting channel.

STATUTORY EXTENSIONS CONSIDERED
  - the weekend/holiday extension is not available to credit institutions

CONTENT GAPS  (facts the article requires that you have not recorded)
  NIS2-FINAL (NIS2 Art. 23(4)(d))
    - Type of threat or likely root cause  <- set `incident.root_cause`
  ...

==============================================================================
BREACH -- 1 obligation(s) missed or filed late
==============================================================================

$ echo $?
1

Note what happened on that second run without anyone asking for it: the 4-hour DORA limb beat the 24-hour one, the weekend extension was correctly withheld because a credit institution is excluded from it, and DORA-INTERMEDIATE and DORA-FINAL were computed provisionally off a report that has not been filed — flagged ~, and they will move earlier the moment it is.


Architecture

facts.json ──► facts.py ──────► Facts (validated, typed, strict)
                                   │
catalog.py ──► Obligation[] ───────┤   declarative: who / what / to whom /
  (CRA, NIS2, GDPR, DORA)          │   which article / which anchor / which period
                                   ▼
                               engine.py
                    topological anchor resolution
                    (fact | predecessor submission | predecessor deadline)
                                   │
                                   ▼
                              periods.py  ──► strict bound  ─┐
                    two readings of every limit              ├─► ObligationState
                              lenient bound ─┘                    status, slack,
                                   │                               gaps, derivation
              euclock.py ──────────┤
       EU civil time, no tzdata    │
              calendrics.py ───────┘
       civil months, Easter, national holidays
                                   │
                                   ▼
                               render.py
                  text  |  json  |  ics  |  Markdown drafts

Six modules, each with one job:

  • euclock.py — EU civil time computed from first principles.
  • calendrics.py — civil-month arithmetic, Easter, national holiday tables, working days.
  • periods.py — the two readings of a time limit, plus the DORA extension.
  • catalog.py — the law as data: 20 obligations across 4 regimes.
  • engine.py — anchor resolution, binding-constraint selection, grading.
  • render.py — four output surfaces over one assessment.

The three decisions worth explaining

1. Two readings, not one.

A statute says "within 24 hours of becoming aware". Two computations are defensible. The strict one — 24 hours, wall clock, nothing moves for a weekend — is what every client alert and CSIRT playbook assumes. The lenient one applies Regulation (EEC, Euratom) No 1182/71, the Council regulation on how periods and time limits in Union law are computed: Art. 3(1) does not count the hour in which the event fell (so the clock starts at the top of the next hour), Art. 3(2) makes a period in days or months expire at the last hour of the final day rather than at the same clock time, Art. 3(3) counts weekends and holidays towards the period, and Art. 3(4) rolls a period expressed otherwise than in hours forward when its last day is a Saturday, Sunday or public holiday.

Whether 1182/71 reaches the CRA's and NIS2's 24h/72h clocks is genuinely unsettled. The alternative designs were (a) pick one and print a single number, or (b) compute both.

  • (a) is what everyone else does. It is smaller and reads better, and it is wrong in one of two directions: pick strict and you may be leaving real hours on the table during an incident when hours are the scarcest thing you have; pick lenient and you may be encouraging someone to miss a deadline on the strength of a reading no authority has confirmed.
  • (b) costs a second computation per constraint and one extra column, and it lets the tool be honest: plan to the strict instant, and see the spread.

Chose (b). The spread is not noise — it is the answer to "how much trouble am I in if I am wrong about this?", and it is sometimes large: in the sample run above, the CRA 14-day final-report clock differs by 1 day 13 hours between the two readings, entirely because the 14th day lands on a Sunday. Costs: roughly double the deadline arithmetic (still microseconds) and a report that is longer than a single-number tool's.

2. Provisional anchors instead of a blank.

DORA's final report is due one month after the intermediate report, which is due 72 hours after the initial notification. Until you file, those deadlines do not exist as facts. The options were to hide them until the predecessor is filed, or to compute them against the predecessor's own deadline and mark them provisional.

Hiding them is defensible and simpler, but it produces a calendar that is empty exactly when planning matters most — at hour zero. So they are computed as a worst case, marked ~ in every surface, and they move earlier automatically the moment a submission is recorded. Cost: a topological pass over the catalogue with cycle detection, and a concept the reader has to absorb.

3. No tzdata, and no zoneinfo.

zoneinfo is standard library, but on Windows there is no system IANA database, so ZoneInfo("Europe/Madrid") raises unless the third-party tzdata wheel is installed. The alternatives were to depend on tzdata (breaking "dependency-free" and making offline installs fragile), or to implement the subset of civil time actually needed.

The subset is small because Directive 2000/84/EC harmonises summer time across the entire EU: every Member State switches at the same instant — 01:00 UTC on the last Sunday of March and of October — and every EU base offset is a whole number of hours. A zone is therefore two integers plus one shared rule, about forty lines. Cost: tocsin is not a general-purpose timezone library and refuses anything outside EU civil time from 1996 onwards, by design and loudly.

Details that turned out to matter

  • "One month" is not 30 days. One month after 31 January is 28 February. add_months clamps to the end of the target month.
  • A month-long clock can cross a DST change. The strict reading preserves the local clock time, so one month after 22 October 09:40 CEST is 22 November 09:40 CET — a different instant by one hour, which is the right answer.
  • Art. 3(4) does not reach periods expressed in hours. A 24-hour clock is never extended over a weekend even under the lenient reading; only day and month periods roll.
  • DORA's weekend extension is conditional on who you are. RTS (EU) 2025/301 Art. 5(4) allows filing by 12:00 on the next working day when a deadline falls on a weekend or bank holiday — but expressly not for credit institutions, central counterparties, operators of trading venues, or entities that are essential or important under NIS2. tocsin applies the eligibility test and says which way it went.
  • Two constraints, earliest wins. DORA's initial notification has two concurrent limits (4 hours from classification, 24 hours from awareness). Classifying late does not buy time, and tocsin names which limb is binding.
  • false is an answer, not a gap. "No malicious act is suspected" is a recorded fact; only unset strings and zero counts become [MISSING].

The facts file

One JSON document describes the entity, the incident and the timeline. python main.py init writes a blank one; python main.py schema lists every accepted field. Validation is deliberately unforgiving — a typo in actively_exploited_vulnerability would otherwise switch off a whole regime in silence — so unknown keys are errors, enums are closed, and every timestamp must carry an explicit UTC offset.

{
  "incident_id": "INC-2026-0042",
  "jurisdiction": "ES",
  "entity": {
    "name": "Marea Firmware S.L.",
    "manufacturer_of_pde": true,
    "places_pde_on_eu_market": true,
    "nis2_status": "none",
    "financial_entity": false,
    "gdpr_role": "none"
  },
  "incident": {
    "actively_exploited_vulnerability": true,
    "description": "Unauthenticated command injection in the OTA update endpoint...",
    "mitigations": "Emergency firmware 3.4.2 published..."
  },
  "timeline": {
    "awareness": "2026-09-18T16:42:00+02:00",
    "corrective_measure_available_at": "2026-09-20T11:00:00+02:00"
  },
  "submissions": {
    "CRA-VULN-EW": "2026-09-19T14:00:00+02:00"
  }
}

submissions is the log of what you have actually filed. It turns provisional deadlines firm, marks obligations satisfied, and — if a timestamp there is past the deadline — is what makes tocsin report LATE rather than quietly closing the item.

Four worked examples ship in examples/: a one-person firmware vendor under the CRA, a bank where DORA + NIS2 + GDPR all fire on a Saturday, a SaaS processor whose own GDPR duty has no fixed clock, and a Portuguese trust service provider whose NIS2 notification is compressed from 72 hours to 24.


The obligation catalogue

20 obligations across 4 regimes. python main.py regimes prints it; python main.py explain NIS2-EW expands one.

Regime Obligations Clocks
CRA (Reg. (EU) 2024/2847 Art. 14) CRA-VULN-EW, CRA-VULN-NOTIF, CRA-VULN-FINAL, CRA-INC-EW, CRA-INC-NOTIF, CRA-INC-FINAL, CRA-USERS 24h, 72h, 14 days from a fix being available, 1 month from the notification
NIS2 (Dir. (EU) 2022/2555 Art. 23) NIS2-EW, NIS2-NOTIF, NIS2-NOTIF-TSP, NIS2-FINAL, NIS2-RECIPIENTS 24h, 72h (24h for trust service providers), 1 month from the notification
GDPR (Reg. (EU) 2016/679 Arts. 33–34) GDPR-33, GDPR-33-PROCESSOR, GDPR-34, GDPR-33-5 72h; the rest without undue delay
DORA (Reg. (EU) 2022/2554 Art. 19; RTS (EU) 2025/301 Art. 5) DORA-INITIAL, DORA-INTERMEDIATE, DORA-FINAL 4h from classification / 24h from awareness, 72h, 1 month

Adding a regime means adding records to catalog.py; the engine knows no law.


Tests

make test          # or: python -m unittest discover -s tests -t .

143 tests, stdlib unittest (they also run under pytest if you prefer). They cover, among other things: both EU summer-time transitions and the two pathological wall-clock hours of the year; civil-month clamping across leap years; Easter for six known years and the invariant that it is always a Sunday in March or April; both readings of every period unit and the property that the lenient bound is never earlier than the strict one; the DORA eligibility test in all three excluded categories; anchor resolution in its firm, provisional, transitive, alternative and unresolvable forms; every status transition and the exit code that follows from it; RFC 5545 line folding and escaping in the calendar output; and every CLI command end to end on every shipped example.


Assumptions and limitations

This is a prototype and an engineering artefact, not legal advice. It computes deadlines from facts you supply against a catalogue a human wrote. A lawyer must review anything you file.

  1. The catalogue is a reading of the instruments, not the instruments. The articles are cited on every obligation so you can check them. Where a provision is a judgement call (is this incident "significant"? is this vulnerability "actively exploited"?) tocsin does not decide — it takes the answer as a fact and tells you which fact drove which conclusion.
  2. jurisdiction selects one Member State's calendar and one set of authorities. A genuinely cross-border incident has more than one notification path; tocsin models a single primary jurisdiction. The member_states_affected field is carried into the drafts but does not fan out the clocks.
  3. National public holidays only. Regional days — Spanish autonomous communities, German Länder — are out of scope. A regional holiday can only ever make a deadline later, so omitting one keeps tocsin conservative.
  4. EU civil time only, from 1996 onwards. The harmonised summer-time rule is assumed to hold; if the EU ever abolishes the clock change, euclock.py needs a new rule (and the code refuses years before 1996 rather than guessing).
  5. The strict reading is the plan. tocsin will never tell you that you have until the lenient instant. It shows the spread so you can see the exposure.
  6. Sector-specific overlays are not modelled. eIDAS, the AI Act's serious incident reporting, PSD2 and national telecom rules also put clocks on incidents; only the four regimes above are in the catalogue.
  7. The CRA cut-off is hard-coded at 11 September 2026; an incident whose awareness predates it produces no CRA obligation, with that stated as the reason.
  8. submissions is trusted. tocsin has no way to verify that a filing actually reached ENISA or a supervisory authority; it records what you tell it.
  9. No network, ever. There is no lookup of the correct national single entry point, no ENISA API, no CVE enrichment. That is the point: this has to work from an incident bridge with the VPN down.

License

MIT — see LICENSE.

About

tocsin - offline, dependency-free EU incident-notification clock: computes every CRA / NIS2 / GDPR / DORA reporting deadline one incident starts, resolves report-anchored clocks, and shows the spread between two defensible readings of Reg. 1182/71

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages