Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>
<PropertyGroup>
<Version>1.7.8.138</Version>
<AssemblyVersion>1.7.8.138</AssemblyVersion>
<FileVersion>1.7.8.138</FileVersion>
<Version>1.7.8.144</Version>
<AssemblyVersion>1.7.8.144</AssemblyVersion>
<FileVersion>1.7.8.144</FileVersion>
</PropertyGroup>
</Project>
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,10 @@ Die [lesbare Vertragsbeschreibung](docs/contracts/tui/README.md) und die
- ROUND rundet Halbwerte weg von null. Nichtnegative Präzision wird abgeschnitten:
0..15 sind zulässig, 15.9 wird 15; 16 und negative Rohwerte sind Fehler.
- Numerische Ergebnisse müssen endlich sein. Fehlerhafte Load-Daten ersetzen kein Teilblatt.
Save/Load nutzen JSON, Print exportiert Text; `.MCS`-Import bleibt außerhalb des Umfangs.
Load akzeptiert höchstens 128 KiB JSON mit maximal 16 Verschachtelungsebenen.
Eine Neuberechnung speichert Zellwerte nur für diesen Lauf zwischen und beendet
übermäßige Referenzarbeit mit einem Fehler. Save/Load nutzen JSON, Print exportiert
Text; `.MCS`-Import bleibt außerhalb des Umfangs.

English: Feature 006 is implemented locally and still awaits acceptance. Follow
the linked readable contract and migrated help for individual interaction paths.
Expand All @@ -148,7 +151,10 @@ the linked readable contract and migrated help for individual interaction paths.
- ROUND rounds midpoints away from zero. Truncate nonnegative precision to 0–15:
15.9 becomes 15; 16 and negative raw precision are errors.
- Numeric results must be finite. Invalid loads never partially replace a sheet.
Save/Load use JSON and Print exports text; `.MCS` import remains out of scope.
Load accepts at most 128 KiB of JSON with at most sixteen nesting levels.
Recalculation caches cell values only for that run and rejects excessive
reference work. Save/Load use JSON and Print exports text; `.MCS` import
remains out of scope.

### Commands (TUI)

Expand Down
42 changes: 42 additions & 0 deletions docs/documentation-impact/security-resource-bounds.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"schemaVersion": "1.1",
"feature": "security-resource-bounds",
"entries": [
{
"changeId": "CHG001",
"scope": "Formula recalculation and spreadsheet JSON loading resource boundaries",
"decision": "UpdateRequired",
"rationale": "The security fix introduces observable fail-safe limits for JSON bytes, JSON depth, and formula-reference work while preserving valid saved sheets and per-run recalculation semantics.",
"documents": [
"README.md",
"docs/help/microcalc-help.md",
"src/MicroCalc.Tui/Resources/CALC.HLP",
"docs/security/threat-model.md",
"docs/security/gsdb-intensive-review/open-findings.md",
"docs/project-statistics.md"
],
"owner": "Repository Maintainer",
"audiences": [
"TinyCalc users",
"Maintainers and security reviewers",
"Learners"
],
"readerPaths": [
"README interaction contract -> migrated help -> runtime help",
"Threat model -> GSDB open finding -> focused regression tests"
],
"canonicalSource": "src/MicroCalc.Core/IO/SpreadsheetJsonStorage.cs and src/MicroCalc.Core/Formula/FormulaEvaluator.cs",
"navigationImpact": "Existing README, help, and security-document paths are updated; no new navigation surface is introduced.",
"documentClass": "ActiveSemantic",
"languageStrategy": "German first and English second at CEFR B2; runtime help keeps matching German and English pages.",
"languagePartners": [],
"platformAndExampleProof": "Focused Core tests cover oversized and deeply nested JSON, maximum application-generated sheets, forward-compatible unknown fields, repeated-reference DAGs, work-budget exhaustion, cycles, and dependency refresh.",
"distributionClass": "sourceOnly",
"homeSyncRequired": false,
"evidence": "docs/documentation-impact/security-resource-bounds.json",
"risk": "Low residual risk: valid application-generated sheets remain loadable; small unknown JSON fields remain allowed; broader filesystem error-message handling is explicitly out of scope.",
"criticality": "Security",
"reevaluationTrigger": "Grid dimensions, cell-input limits, JSON format, formula grammar, public evaluator contract, or load error handling changes."
}
]
}
10 changes: 8 additions & 2 deletions docs/help/microcalc-help.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ Lernreferenz erhalten. Für den aktuellen Port gelten diese Präzisierungen:
- ROUND: Halbwerte weg von null; nichtnegative Präzision abschneiden, dann 0..15.
15.9 ist zulässig; 16, -0.5 und -1 scheitern verständlich, ohne Clamp.
- Ungültiges Load verändert weder vorhandene Zellen noch Auswahl/AutoCalc.
Print exportiert Text; Abbruch des Randprompts schreibt keine Datei.
Load akzeptiert höchstens 128 KiB JSON und 16 Verschachtelungsebenen.
Neuberechnung nutzt einen Cache nur für den aktuellen Lauf und meldet
übermäßige Referenzarbeit als Fehler. Print exportiert Text; Abbruch des
Randprompts schreibt keine Datei.

English: Feature 006 is implemented locally; platform and product acceptance
remain open. Historical English pages below remain learning references, with
Expand All @@ -55,7 +58,10 @@ these binding clarifications for the current port:
- ROUND uses midpoint-away-from-zero and truncates nonnegative precision to
0–15. 15.9 is valid; 16, -0.5 and -1 fail clearly without clamping.
- Invalid Load preserves cells, selection and AutoCalc. Print exports text;
cancelling its margin prompt writes no file.
Load accepts at most 128 KiB of JSON and sixteen nesting levels.
Recalculation uses a cache only for the current run and reports excessive
reference work as an error. Print exports text; cancelling its margin prompt
writes no file.

## Page 1 - Introduction

Expand Down
8 changes: 8 additions & 0 deletions docs/project-statistics.config.json
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,14 @@
"labelEn": "Storage check-only Make hardening",
"netLines": 187,
"activeDays": 1
},
{
"slot": 17,
"id": "security-resource-bounds",
"labelDe": "Formel- und JSON-Ressourcengrenzen",
"labelEn": "Formula and JSON resource bounds",
"netLines": 414,
"activeDays": 1
}
],
"excludedPaths": [
Expand Down
86 changes: 58 additions & 28 deletions docs/project-statistics.md
Original file line number Diff line number Diff line change
Expand Up @@ -950,6 +950,35 @@ passed. Documentation Impact: UpdateRequired; the man page documents the safe
mode boundary. Statistics provide Git-based transparency, not measured AI
productivity.

### 2026-10-30 - Formel- und JSON-Ressourcengrenzen / Formula and JSON resource bounds

DE: Zwei Standard-Scan-Befunde werden gemeinsam an der Datei-/Formelgrenze
adressiert. JSON-Load liest maximal 128 KiB bei hoechstens 16 Ebenen und
uebernimmt erst nach vollstaendiger Validierung. Die Neuberechnung memoisiert
Zellwerte nur fuer den aktuellen Lauf und begrenzt Referenz- sowie
Bereichsarbeit deterministisch. Vor diesem Statistik-Selbstnachweis umfasst
der Kandidat netto 153 Produktionscode-, 180 Test- und 81 Dokumentationszeilen,
insgesamt 414 Zeilen. Das entspricht 5,2 konservativen beziehungsweise 3,3
Thorsten-Solo-Arbeitstagen oder etwa 40,4 beziehungsweise 25,8 Stunden. Gegen
einen sichtbaren Aktivtag sind 5,2x und 3,3x reine Lieferdichte, keine
Stoppuhrmessung. 97 fokussierte Core-Regressionen sowie die vollstaendige
Solution mit 226 Core- und 461 TUI-Tests bestanden. DocFX baute die
Dokumentation ohne Warnung oder Fehler; die geaenderten Seiten blieben in der
textorientierten Stichprobe nutzbar.

EN: Two Standard Scan findings are addressed together at the file/formula
boundary. JSON Load reads at most 128 KiB with no more than sixteen levels and
replaces state only after complete validation. Recalculation memoizes cell
values for one run and deterministically bounds reference and range work.
Before this statistics self-record, the candidate contains 153 net production,
180 test and 81 documentation lines, 414 lines in total. This corresponds to
5.2 conservative or 3.3 Thorsten-solo workdays, about 40.4 or 25.8 hours.
Against one visible active day, 5.2x and 3.3x describe delivery density, not
stopwatch time. Ninety-seven focused Core regressions and the complete solution
with 226 Core and 461 TUI tests pass. DocFX built the documentation without a
warning or error, and the changed pages remained usable in the text-oriented
spot check.

## Gesamtstatistik / Overall Statistics

Deutsch: Feature 006 ist in PR #104 vollständig implementiert, menschlich
Expand Down Expand Up @@ -990,25 +1019,25 @@ Profil 2 verwendet Git-getrackte Textdateien und sichtbare Git-Aktivitaet. Die W

| Kennzahl / Metric | Wert / Value |
|---|---:|
| Textbasis / Text base | 354718 lines |
| Textdateien / Text files | 1991 |
| Beobachtbarer Zeitraum / Observable period | 2025-11-02..2026-10-29 |
| Aktivtage / Active days | 101 |
| Relevante Commits / Relevant commits | 314 |
| Zeilen je Aktivtag / Lines per active day | 3512.1 |
| Textbasis / Text base | 355132 lines |
| Textdateien / Text files | 1993 |
| Beobachtbarer Zeitraum / Observable period | 2025-11-02..2026-10-30 |
| Aktivtage / Active days | 102 |
| Relevante Commits / Relevant commits | 316 |
| Zeilen je Aktivtag / Lines per active day | 3481.7 |
| Peak-Tag im Fenster / Peak day in window | 2026-10-24 / 58461 |
| Peak-Woche im Fenster / Peak week in window | 2026-10-18 / 106574 |
| Laengste Serie / Longest streak | 8 days |
| Speedup vs. 80 lines/day | 43.9x |
| Speedup vs. 125 lines/day | 28.1x |
| Methodik / Methodology | v2; source `f3e9ac99769d` |
| Speedup vs. 80 lines/day | 43.5x |
| Speedup vs. 125 lines/day | 27.9x |
| Methodik / Methodology | v2; source `300e70ebcc8a` |

### Artefaktmix / Artifact Mix

```text
Produktiv / Production [#...................] 0.9% | 3118
Tests [#...................] 4.4% | 15645
Dokumentation / Documentation [###############.....] 77.3% | 274046
Produktiv / Production [#...................] 0.9% | 3275
Tests [#...................] 4.5% | 15825
Dokumentation / Documentation [###############.....] 77.2% | 274123
Skripte / Scripts [##..................] 9.4% | 33354
Konfiguration / Configuration [#...................] 7.2% | 25462
Daten und Medien / Data and media [....................] 0.0% | 0
Expand Down Expand Up @@ -1039,7 +1068,7 @@ Mo/Mo 4 0 0 0 0 0 0 0 3 1 4 4 0 0 0 2 0 0 0 0 0 3 3 3 0 0
Di/Tu 3 0 0 3 0 0 0 0 2 0 3 4 4 0 0 0 0 4 3 4 0 0 4 0 4 0
Mi/We 2 0 0 0 2 0 4 0 2 0 0 2 4 0 0 0 0 0 0 0 0 0 3 0 4 0
Do/Th 0 0 0 1 0 4 1 0 0 0 1 4 0 0 4 0 0 3 0 0 0 0 3 0 0 2
Fr/Fr 0 0 4 2 2 0 3 2 3 4 4 4 1 0 0 0 0 4 3 2 0 0 0 0 0 -
Fr/Fr 0 0 4 2 2 0 3 2 3 4 4 4 1 0 0 0 0 4 3 2 0 0 0 0 0 3
Sa/Sa 0 0 0 0 0 0 4 0 4 4 0 4 2 0 2 0 3 4 4 0 2 4 4 0 4 -
```

Expand Down Expand Up @@ -1118,15 +1147,15 @@ Slots 0..15
```

```text
Slots 16..16
cap 200 | .
167 | #
133 | #
100 | #
67 | #
33 | #
0 +---
16
Slots 16..17
cap 500 | . .
417 | . .
333 | . #
250 | . #
167 | # #
83 | # #
0 +-----
16 17
```

| Slot | Phase | Nettozeilen / Net lines |
Expand All @@ -1148,6 +1177,7 @@ Slots 16..16
| 14 | 004 RL-SE-Closeout / 004 RL-SE closeout | 1265 |
| 15 | Feature 032 verlinkte Intake-Evidence / Feature 032 linked intake evidence | 1359 |
| 16 | Storage-Check-only-Make-Härtung / Storage check-only Make hardening | 187 |
| 17 | Formel- und JSON-Ressourcengrenzen / Formula and JSON resource bounds | 414 |

Die festen Slots halten den Phasenvergleich auch bei fehlenden oder spaeter ergaenzten Werten stabil.

Expand All @@ -1157,8 +1187,8 @@ Die festen Slots halten den Phasenvergleich auch bei fehlenden oder spaeter erga

```text
Scale: 0..50x
80 lines/day [##################..] 43.9x
125 lines/day [###########.........] 28.1x
80 lines/day [#################...] 43.5x
125 lines/day [###########.........] 27.9x
```

Die Faktoren vergleichen sichtbare Lieferdichte mit den dokumentierten manuellen Referenzen. Sie messen keine Arbeitszeit.
Expand All @@ -1171,7 +1201,7 @@ Die Faktoren vergleichen sichtbare Lieferdichte mit den dokumentierten manuellen
Scale: 0..5000 lines/day
Experienced manual [#...................] 80
Thorsten solo [#...................] 125
Visible repository [##############......] 3512.1
Visible repository [##############......] 3481.7
```

Die gemeinsame Skala vergleicht Referenzen und sichtbare Lieferdichte. Sie schreibt die Git-Aktivitaet keiner Person oder KI pauschal zu.
Expand All @@ -1180,9 +1210,9 @@ Die gemeinsame Skala vergleicht Referenzen und sichtbare Lieferdichte. Sie schre

### Textalternative / Text Alternative

DE: Das Fenster beginnt am 2025-11-02 und endet am 2026-10-29. Es enthaelt 101 aktive und 261 inaktive vergangene Tage. Peak-Tag: 2026-10-24 / 58461. Peak-Woche: 2026-10-18 / 106574. Laengste Serie: 8 Tage (2026-07-19..2026-07-26).
DE: Das Fenster beginnt am 2025-11-02 und endet am 2026-10-30. Es enthaelt 102 aktive und 261 inaktive vergangene Tage. Peak-Tag: 2026-10-24 / 58461. Peak-Woche: 2026-10-18 / 106574. Laengste Serie: 8 Tage (2026-07-19..2026-07-26).

*EN: The window starts on 2025-11-02 and ends on 2026-10-29. It contains 101 active and 261 inactive elapsed days. Peak day: 2026-10-24 / 58461. Peak week: 2026-10-18 / 106574. Longest streak: 8 days (2026-07-19..2026-07-26).*
*EN: The window starts on 2025-11-02 and ends on 2026-10-30. It contains 102 active and 261 inactive elapsed days. Peak day: 2026-10-24 / 58461. Peak week: 2026-10-18 / 106574. Longest streak: 8 days (2026-07-19..2026-07-26).*

| Monat / Month | Geaenderte Textzeilen / Changed text lines |
|---|---:|
Expand All @@ -1197,6 +1227,6 @@ DE: Das Fenster beginnt am 2025-11-02 und endet am 2026-10-29. Es enthaelt 101 a
| 2026-07 | 74031 |
| 2026-08 | 26210 |
| 2026-09 | 70997 |
| 2026-10 | 167033 |
| 2026-10 | 167479 |

<!-- project-statistics-v2:end -->
4 changes: 2 additions & 2 deletions docs/security/gsdb-intensive-review/evidence-matrix.json
Original file line number Diff line number Diff line change
Expand Up @@ -1053,8 +1053,8 @@
"sourceClass": "ProjectEvidence",
"path": "docs/security/threat-model.md",
"version": "Current",
"reviewedAt": "2026-10-10",
"normalizedSha256": "4ec34eae41ed654fa02f14a2412ad8667555c1f5d1b873da4059a1d70bcf8c48",
"reviewedAt": "2026-10-30",
"normalizedSha256": "a6cfafb7b15749c9051e5802cc6de4fbf4c0a5a27e6298ad7b90d3f87c3fa169",
"scope": {
"de": "Zeilenspezifischer aktueller Nachweis aus docs/security/threat-model.md; der Hash beweist Inhalt, nicht automatisch Erfuellung.",
"en": "Current row-specific evidence from docs/security/threat-model.md; the hash proves content, not automatic fulfilment."
Expand Down
1 change: 1 addition & 0 deletions docs/security/gsdb-intensive-review/open-findings.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ This is not product acceptance or a new hardening feature.
- Quellen / Sources: CL-08-01, CL-08-02, CL-08-06, CL-08-07, CL-08-08, CL-08-09, CL-08-10, CL-08-11, CL-08-12
- Owner: TinyCalc security governance role; Reviewer: Independent technical security review role
- Beobachtung / Observation: Produktcode ist seit 30.08.2026 unverändert. ExecuteSafe zeigt ex.Message an; Load liest die ganze Datei und leert die Engine vor Verarbeitung aller Zellen. Das sind konkrete Prüfziele, keine hier reproduzierten Exploits. / Product code is unchanged since 2026-08-30. ExecuteSafe displays ex.Message; Load reads the whole file and clears the engine before processing all cells. These are concrete review targets, not exploits reproduced in this review.
- Teilnachweis 2026-10-30 / Partial evidence 2026-10-30: Die Standard-Scan-Ressourcenbefunde fuer vollstaendiges JSON-Einlesen und exponentielle Formelreferenzen wurden mit Byte-/Tiefengrenze, lauflokaler Memoisierung, Arbeitsbudget und Regressionen adressiert. Der breitere Finding-Status bleibt Open, weil Dateisystem-Fehlermeldungen und die uebrigen CL-08-Zeilen nicht Gegenstand dieser Korrektur sind. / The standard-scan resource findings for whole-file JSON loading and exponential formula references are addressed with byte/depth limits, per-run memoization, a work budget, and regressions. The broader finding remains Open because filesystem error messages and the remaining CL-08 rows are outside this fix.
- Folgearbeit / Follow-up: Ungültige/große JSON-Dateien, null-Zellen, Feldgrenzen, Zustandskonsistenz nach Ladefehlern und Dateifehlerausgaben prüfen; bereinigte Benutzermeldungen, Ressourcenlimits und passende Regressionen anhand des tatsächlichen Ergebnisses umsetzen. / Test malformed/large JSON files, null cells, field limits, state consistency after load failures and file error output; implement sanitized user messages, resource limits and suitable regressions according to actual results.
- Zieltermin / Target date: 2026-12-31; frühere Neubewertung bei Scope- oder Evidenzänderung / earlier reassessment on scope or evidence change.
- Restrisiko / Residual risk: Die offene Lücke bleibt sichtbar und wird nicht als erfüllt dargestellt. / The open gap remains visible and is not presented as fulfilled.
Expand Down
22 changes: 22 additions & 0 deletions docs/security/threat-model.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,27 @@
# Bedrohungsmodell: TinyCalc Feature 003

## Ressourcenbegrenzung 2026-10-30 / Resource bounds 2026-10-30

Deutsch: Die Trust Boundary Datei/Formel begrenzt `.mcalc.json` auf 128 KiB
und 16 JSON-Verschachtelungsebenen, bevor ein Objektgraph entsteht. Die
Neuberechnung verwendet nur innerhalb eines Laufs memoierte Zellwerte und ein
aus Raster- und Formellimits abgeleitetes Arbeitsbudget. Zykluserkennung,
atomare Ladeübernahme und bestehende Fehlerverträge bleiben erhalten. Damit
sind die Standard-Scan-Befunde `csf_c54f3d1ce3e3ec728a5fb57f` und
`csf_7264301dfe8ca7dc4a0ae14d` technisch adressiert. Restrisiken: bewusst
ungeprüfte kleine zukünftige JSON-Felder bleiben kompatibel; Dateisystemfehler
außerhalb dieser beiden Ressourcenbefunde werden getrennt bewertet.

English: The file/formula trust boundary caps `.mcalc.json` at 128 KiB and
sixteen JSON nesting levels before an object graph is created. Recalculation
uses cell values memoized only for one run plus a work budget derived from the
grid and formula limits. Cycle detection, atomic load replacement and existing
error contracts remain intact. This technically addresses standard-scan
findings `csf_c54f3d1ce3e3ec728a5fb57f` and
`csf_7264301dfe8ca7dc4a0ae14d`. Small unknown future JSON properties remain
compatible by design; filesystem-error handling outside these two resource
findings remains a separate assessment.

## Feature 006: geplanter Grenzschutz / Planned boundary protection

### Deutscher Prüfblock
Expand Down
5 changes: 4 additions & 1 deletion src/MicroCalc.Core/Engine/MicroCalcEngine.cs
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ public EditResult EditCell(CellAddress address, string input)
public RecalculateResult Recalculate()
{
var errors = new List<string>();
// DE: Eine Sitzung teilt sichere Zwischenergebnisse und das Arbeitsbudget über den gesamten Lauf.
// EN: One session shares safe intermediate results and the work budget across the complete run.
var evaluationSession = _evaluator.CreateSession(Sheet);

foreach (var address in Sheet.AddressesRowMajor())
{
Expand All @@ -152,7 +155,7 @@ public RecalculateResult Recalculate()
continue;
}

var eval = _evaluator.EvaluateForCell(cell.Contents, Sheet, address);
var eval = evaluationSession.EvaluateForCell(cell.Contents, address);
if (!eval.Success)
{
errors.Add($"{address}: {eval.ErrorMessage} (Pos {eval.ErrorPosition})");
Expand Down
Loading
Loading