fencewalk 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. fencewalk-0.1.0/LICENSE +21 -0
  2. fencewalk-0.1.0/PKG-INFO +494 -0
  3. fencewalk-0.1.0/README.md +485 -0
  4. fencewalk-0.1.0/pyproject.toml +23 -0
  5. fencewalk-0.1.0/setup.cfg +4 -0
  6. fencewalk-0.1.0/src/fencewalk/__init__.py +7 -0
  7. fencewalk-0.1.0/src/fencewalk/__main__.py +835 -0
  8. fencewalk-0.1.0/src/fencewalk/checklist.py +119 -0
  9. fencewalk-0.1.0/src/fencewalk/draft.py +123 -0
  10. fencewalk-0.1.0/src/fencewalk/fixture.py +208 -0
  11. fencewalk-0.1.0/src/fencewalk/fixtures/reference-case/EXPECTED-REPORT.md +108 -0
  12. fencewalk-0.1.0/src/fencewalk/fixtures/reference-case/README.md +52 -0
  13. fencewalk-0.1.0/src/fencewalk/fixtures/reference-case/SCRUB.md +62 -0
  14. fencewalk-0.1.0/src/fencewalk/fixtures/reference-case/chains.json +1 -0
  15. fencewalk-0.1.0/src/fencewalk/fixtures/reference-case/coverage.json +1 -0
  16. fencewalk-0.1.0/src/fencewalk/fixtures/reference-case/engagement.json +1 -0
  17. fencewalk-0.1.0/src/fencewalk/fixtures/reference-case/fixes.json +1 -0
  18. fencewalk-0.1.0/src/fencewalk/fixtures/reference-case/inventory.json +1 -0
  19. fencewalk-0.1.0/src/fencewalk/fixtures/reference-case/verify_next.json +1 -0
  20. fencewalk-0.1.0/src/fencewalk/intake.py +258 -0
  21. fencewalk-0.1.0/src/fencewalk/packet.py +160 -0
  22. fencewalk-0.1.0/src/fencewalk/packs/asd-secure-cloud-identity-1.4.json +1 -0
  23. fencewalk-0.1.0/src/fencewalk/packs/flash-20261113-001.json +1 -0
  24. fencewalk-0.1.0/src/fencewalk/packs/scuba-m365-v2.0.0.json +553 -0
  25. fencewalk-0.1.0/src/fencewalk/pdf.py +466 -0
  26. fencewalk-0.1.0/src/fencewalk/report.py +199 -0
  27. fencewalk-0.1.0/src/fencewalk/report_pdf.py +250 -0
  28. fencewalk-0.1.0/src/fencewalk/store.py +761 -0
  29. fencewalk-0.1.0/src/fencewalk/templates/run-brief.md +23 -0
  30. fencewalk-0.1.0/src/fencewalk/web.py +1836 -0
  31. fencewalk-0.1.0/src/fencewalk.egg-info/PKG-INFO +494 -0
  32. fencewalk-0.1.0/src/fencewalk.egg-info/SOURCES.txt +50 -0
  33. fencewalk-0.1.0/src/fencewalk.egg-info/dependency_links.txt +1 -0
  34. fencewalk-0.1.0/src/fencewalk.egg-info/entry_points.txt +2 -0
  35. fencewalk-0.1.0/src/fencewalk.egg-info/top_level.txt +1 -0
  36. fencewalk-0.1.0/tests/test_acceptance.py +102 -0
  37. fencewalk-0.1.0/tests/test_adjudication.py +549 -0
  38. fencewalk-0.1.0/tests/test_checklist.py +250 -0
  39. fencewalk-0.1.0/tests/test_import.py +119 -0
  40. fencewalk-0.1.0/tests/test_intake.py +192 -0
  41. fencewalk-0.1.0/tests/test_invariants.py +131 -0
  42. fencewalk-0.1.0/tests/test_model_pass.py +337 -0
  43. fencewalk-0.1.0/tests/test_pack.py +46 -0
  44. fencewalk-0.1.0/tests/test_pack_asd.py +214 -0
  45. fencewalk-0.1.0/tests/test_pack_scuba.py +182 -0
  46. fencewalk-0.1.0/tests/test_packaging.py +228 -0
  47. fencewalk-0.1.0/tests/test_packs_coverage.py +379 -0
  48. fencewalk-0.1.0/tests/test_pdf.py +126 -0
  49. fencewalk-0.1.0/tests/test_report_pdf.py +256 -0
  50. fencewalk-0.1.0/tests/test_web.py +256 -0
  51. fencewalk-0.1.0/tests/test_web_ui2.py +1066 -0
  52. fencewalk-0.1.0/tests/test_web_writes.py +543 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Nate Riera
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,494 @@
1
+ Metadata-Version: 2.4
2
+ Name: fencewalk
3
+ Version: 0.1.0
4
+ Summary: Local-first perimeter-audit workbench: evidence-labeled inventory, rubric scoring, bounded model pass, adjudication, fix tracking.
5
+ Requires-Python: >=3.11
6
+ Description-Content-Type: text/markdown
7
+ License-File: LICENSE
8
+ Dynamic: license-file
9
+
10
+ # Fencewalk
11
+
12
+ Fencewalk is a local-first tool that runs one repeatable method for auditing a
13
+ small organization's perimeter: build a structured, evidence-labeled inventory;
14
+ score it against a sourced rubric; run a bounded model pass that maps coverage,
15
+ builds attack chains, and drafts fixes; adjudicate the model's output against
16
+ the evidence; and track the fixes to done.
17
+
18
+ It is not a scanner. Evidence enters through the operator (console reads,
19
+ exports, captures); the tool's value is the evidence discipline. Every
20
+ inventory entry carries a label — VERIFIED (checked, with date and source),
21
+ ON RECORD (asserted in the operator's records, not freshly checked), or
22
+ UNKNOWN — and UNKNOWN is a first-class value that nothing silently upgrades.
23
+
24
+ Fencewalk reports findings; it does not guarantee security. Findings are
25
+ advisory: a clean report is evidence about the checks that ran, not proof
26
+ that nothing is wrong.
27
+
28
+ ## Install
29
+
30
+ Python 3.11 or later, standard library only, zero third-party
31
+ dependencies.
32
+
33
+ ```sh
34
+ pipx install fencewalk
35
+ ```
36
+
37
+ That puts a `fencewalk` command on PATH. The tool ships with three
38
+ rubric packs (FLASH, CISA SCuBA, and ASD) and the Harborlight reference
39
+ fixture bundled in, so an installed run needs no checkout:
40
+ `fencewalk load-fixture reference-case eng.db` works from anywhere,
41
+ and `fencewalk packs` lists what it ships.
42
+
43
+ Git clone stays as the fallback (for reading the source, or for
44
+ auditing exactly what runs):
45
+
46
+ ```sh
47
+ git clone https://github.com/klarollc/fencewalk.git
48
+ cd fencewalk
49
+ PYTHONPATH=src python -m fencewalk --version
50
+ ```
51
+
52
+ The commands below are written in the `fencewalk ...` form; from a
53
+ checkout, prefix them with `PYTHONPATH=src python -m` instead.
54
+ Publishing a release is a separate, manual step — see
55
+ `RELEASING.md`; nothing here publishes anything.
56
+
57
+ ## Quickstart
58
+
59
+ The shortest path from install to a PDF report, on the bundled
60
+ Harborlight fixture:
61
+
62
+ ```sh
63
+ pipx install fencewalk
64
+ fencewalk load-fixture reference-case eng.db
65
+ fencewalk load-pack eng.db scuba-m365-v2.0.0
66
+ fencewalk report eng.db
67
+ fencewalk pdf eng.db --out eng.pdf
68
+ ```
69
+
70
+ The fixture arrives already scored, so the report opens with its
71
+ golden numbers:
72
+
73
+ ```text
74
+ ## Posture summary
75
+
76
+ - Inventory: 48 entries (VERIFIED 9, ON RECORD 21, UNKNOWN 18)
77
+ - Coverage: Covered 2 · Partial 7 · Unknown 8 · Not applicable 3 · Gap 0 — 20 rows
78
+ - Attack chains: 3
79
+ - Fixes: 20 (proposed 19, approved 0, done 1, deferred 0)
80
+ - Verify-next items: 10
81
+ ```
82
+
83
+ And the last command writes the PDF:
84
+
85
+ ```text
86
+ pdf written to eng.pdf
87
+ ```
88
+
89
+ To work the loop instead of just reading it, follow
90
+ [`docs/walkthrough.md`](docs/walkthrough.md): it runs the same
91
+ fixture end to end — checklist, packet, adjudication, fix
92
+ tracking — with real commands and real outputs. Check the
93
+ installed version any time with `fencewalk --version`.
94
+
95
+ ## The method (five stages, one loop)
96
+
97
+ 1. **Intake.** Build the inventory in sections, every entry evidence-labeled.
98
+ 2. **Verification.** Generate a read-only checklist from the UNKNOWN entries;
99
+ resolved unknowns return as VERIFIED with dates. Default order is
100
+ verify-first; an engagement records which order it used.
101
+ 3. **Model pass.** Assemble a single self-contained packet (brief, inventory,
102
+ rubric) for the operator to run in their own model session. Fencewalk does
103
+ not call a model API.
104
+ 4. **Adjudication.** Review the returned output against the inventory —
105
+ accept, correct, or reject, with corrections preserved. Model-flagged
106
+ inventory gaps flow back into the inventory as new UNKNOWNs.
107
+ 5. **Fix tracking.** Each adjudicated fix carries a rubric citation, an effort
108
+ estimate, the chain(s) it breaks, and a status that changes only on the
109
+ operator's explicit action.
110
+
111
+ ## Posture
112
+
113
+ - **Local-first.** No network calls, no telemetry, no accounts. An inventory
114
+ is a map of someone's attack surface; it stays on the operator's machine.
115
+ - **Files are the interchange.** One SQLite database per engagement is the
116
+ working store; the inventory, rubric packs, and reports also exist as plain
117
+ files (JSON / Markdown) that build the store and render from it.
118
+ - **Rubric packs are data, not code.** A versioned file of items with stable
119
+ IDs, groups, and a source citation. The engine is rubric-agnostic.
120
+ - **Counts are computed, never typed.** Every tally in a rendered report is
121
+ computed from the store at render time.
122
+ - **Repo posture:** public at https://github.com/klarollc/fencewalk since
123
+ Nov 22, 2026.
124
+
125
+ ## Command reference
126
+
127
+ Commands are grouped by stage, in the `fencewalk ...` form. From a
128
+ checkout, prefix each with `PYTHONPATH=src python -m`. Layout of a
129
+ checkout: `src/fencewalk/` is the package; `src/fencewalk/packs/`
130
+ holds the rubric packs as data files; `src/fencewalk/fixtures/`
131
+ holds the reference fixture with its scrub audit note (`SCRUB.md`);
132
+ `tests/` holds stdlib `unittest` suites.
133
+
134
+ ### Intake
135
+
136
+ - **Labels are never edited in place.** `edit-entry` changes an
137
+ entry's body, source, and checked/decay dates only. A label
138
+ changes solely through `set-label`, which appends the change
139
+ (date and actor) to the entry's label history. There is no entry
140
+ deletion.
141
+ - **Import never guesses.** `import-inventory` reads the bundle
142
+ format (`## A.` … `## H.` sections, `- ` bullets, numbered
143
+ entries in section H) into an empty inventory. An entry whose
144
+ text carries two or more distinct label markers (VERIFIED /
145
+ ON RECORD / UNKNOWN) is skipped and listed in the import report
146
+ for manual entry; an entry with no marker imports as UNKNOWN
147
+ with a source noting the label was not stated. For a VERIFIED
148
+ entry, the checked date is read from the same sentence as the
149
+ marker.
150
+
151
+ ```sh
152
+ # Create a fresh engagement database (refuses to overwrite an existing file)
153
+ fencewalk new /tmp/eng.db --name "Example audit" --subject "Example firm" --method-order verify-first --date 2026-11-18
154
+
155
+ # Add an entry (without --id, the next free ID in the section is assigned)
156
+ fencewalk add-entry /tmp/eng.db --section A --body "Mail is hosted by Example Mail." --label VERIFIED --source "console read" --checked-date 2026-11-18
157
+
158
+ # List entries (read-only; --section filters)
159
+ fencewalk list-entries /tmp/eng.db
160
+
161
+ # Change a label (the only label path; recorded in history)
162
+ fencewalk set-label /tmp/eng.db A1 "ON RECORD" --date 2026-11-19
163
+
164
+ # Edit body, source, or dates (never the label; --clear-*-date clears a date)
165
+ fencewalk edit-entry /tmp/eng.db A1 --body "Mail is hosted by Example Mail, verified at the console."
166
+
167
+ # Import a bundle-format Markdown inventory (inventory must be empty)
168
+ fencewalk import-inventory /tmp/eng.db inventory.md
169
+
170
+ # Build an engagement database from a bundled fixture (by name, or a directory path)
171
+ fencewalk load-fixture reference-case /tmp/reference.db
172
+ ```
173
+
174
+ ### Scoring
175
+
176
+ - **Pack loading is explicit and validated.** `new` does not seed
177
+ a pack. `load-pack` validates the whole file first (pack id,
178
+ title, source citation, and version present and non-empty; a
179
+ non-empty items list with unique IDs and a group and text on
180
+ every item) and inserts nothing on failure. Loading a pack whose
181
+ id is already in the database is refused. A pack argument is
182
+ either a file path or a bundled pack name.
183
+ - **Scoring goes through the store invariants.** A score with no
184
+ cited entries can only be Unknown, or Not applicable with a
185
+ written N/A reason; Not applicable always requires the reason.
186
+ Citations must name entries that exist, and the item must belong
187
+ to the pack.
188
+ - **Replacement is an explicit act.** `score` refuses an item that
189
+ already has a score and names the existing status; `rescore`
190
+ replaces a score and its citations atomically (a failed rescore
191
+ leaves the old score intact) and prints the previous status and
192
+ reasoning beside the new ones. The record of why a score changed
193
+ lives in adjudication, not in a score history.
194
+ - **"Not scored" is not "Unknown".** `list-coverage` lists every
195
+ item in the pack; an item with no score is marked `not scored`,
196
+ and the tallies line counts it separately from the Unknown
197
+ status.
198
+ - **A database with no pack has no report.** `report` on a
199
+ pack-less database exits with `error: database holds no rubric
200
+ pack; load one with load-pack` instead of rendering.
201
+
202
+ Three packs ship with the tool. The FLASH pack is the ARTEX
203
+ mitigations rubric: 20 items in 4 groups, from FBI
204
+ FLASH-20261113-001. The SCuBA pack is the CISA SCuBA Microsoft
205
+ 365 secure configuration baselines, pinned to ScubaGear **v2.0.0**
206
+ (released Oct 22, 2026), **109 items in 7 groups** (Entra ID 34,
207
+ Exchange Online 12, Power BI 8, Power Platform 9, Security Suite
208
+ 24, SharePoint Online and OneDrive 8, Teams 14). The baselines
209
+ are CC0 1.0 Universal; the pack file carries the full source
210
+ citation. Each item is one baseline policy, stated verbatim, with
211
+ a ` License: ` annotation where the baseline names a licence
212
+ requirement (11 items). The ASD pack is the ASD Blueprint for
213
+ Secure Cloud Entra ID expected state, pinned to **v1.4** (18
214
+ September 2026), **60 items in 8 groups** (Identity Properties 1,
215
+ Users 4, Groups 3, Devices 3, Applications 3, Protection 41,
216
+ Identity Governance 2, External Identities 3). The Blueprint is
217
+ CC BY 4.0, attributed © Commonwealth of Australia 2023; the pack
218
+ is adapted for a small organisation — the Blueprint's PROTECTED
219
+ classification generalises to sensitive information, and its
220
+ named location "Australia" to the organisation's approved
221
+ countries. Load it with `fencewalk load-pack <db>
222
+ asd-secure-cloud-identity-1.4`.
223
+
224
+ ```sh
225
+ # List the rubric packs shipped with the tool (read-only)
226
+ fencewalk packs
227
+
228
+ # Validate and load a rubric pack into a database (refuses a duplicate pack id)
229
+ fencewalk load-pack /tmp/eng.db flash-20261113-001
230
+ fencewalk load-pack /tmp/eng.db scuba-m365-v2.0.0
231
+
232
+ # Score one item (--cite is repeatable; --na-reason is required for Not applicable)
233
+ fencewalk score /tmp/eng.db --pack flash-20261113-001 --item R-1.4 --status Covered --reasoning "Built from Git; nothing to modify in place." --cite C1 --cite C2
234
+
235
+ # Replace an existing score (prints the previous status and reasoning beside the new ones)
236
+ fencewalk rescore /tmp/eng.db --pack flash-20261113-001 --item R-1.4 --status Partial --reasoning "Revised after a second look." --cite C1
237
+
238
+ # List every pack item with its score, or "not scored" (read-only)
239
+ fencewalk list-coverage /tmp/eng.db --pack flash-20261113-001
240
+ ```
241
+
242
+ ### Checklist
243
+
244
+ The checklist is a **derived view**: it is computed from the
245
+ database's current state at an as-of date and stores nothing —
246
+ there is no checklist table and no check-off state. It lists the
247
+ inventory entries still labelled UNKNOWN and, separately,
248
+ VERIFIED or ON RECORD evidence whose recorded decay date has
249
+ passed. It covers UNKNOWN inventory entries, not Unknown
250
+ coverage scores. Resolutions are recorded with `set-label`: a
251
+ settled entry leaves the next checklist, and the label history
252
+ keeps the record. An unknown that cannot be settled stays
253
+ UNKNOWN and stays on the list; that is the correct outcome, not a
254
+ failure.
255
+
256
+ ```sh
257
+ # Render the verification checklist as of a date (default: today)
258
+ fencewalk checklist /tmp/eng.db --date 2026-11-18
259
+
260
+ # Or write it to a file
261
+ fencewalk checklist /tmp/eng.db --date 2026-11-18 --out /tmp/checklist.md
262
+
263
+ # Record a resolution; the entry leaves the next checklist
264
+ fencewalk set-label /tmp/eng.db A3 VERIFIED --date 2026-11-18 --actor operator
265
+ ```
266
+
267
+ ### Model pass
268
+
269
+ - **The packet is self-contained and deterministic.** `packet`
270
+ assembles the run brief (the bundled template
271
+ `src/fencewalk/templates/run-brief.md`, every placeholder
272
+ substituted), the full labeled inventory in the bundle's
273
+ section shape, and the full rubric, preceded by a
274
+ run-configuration block. The same database state and options
275
+ produce a byte-identical packet; the command prints its byte
276
+ count and SHA-256 and records them, so a returned output can be
277
+ tied to the exact bytes that were run. The model is not named
278
+ in the packet — the operator chooses it at run time.
279
+ - **Ingest stores output verbatim, and changes nothing else.**
280
+ `ingest` refuses an output whose `--packet-hash` names no
281
+ recorded packet. It stores the output text exactly as returned,
282
+ with the operator-stated model label (or `not stated` — the
283
+ tool never guesses a model), and writes no coverage scores,
284
+ chains, fixes, or verify-next items. Parsing output into the
285
+ record is adjudication's work.
286
+ - **The draft sections without altering.** `draft` splits a stored
287
+ run's output at its deliverable headings (coverage, attack
288
+ chains, fixes, verify-next), reproduces each section verbatim
289
+ under a heading naming the deliverable, and follows each with an
290
+ adjudication stub (accept / correct / reject, plus a correction
291
+ line). Text before the first deliverable heading is kept as a
292
+ preamble; an output with no recognizable headings drafts as one
293
+ unsectioned block, stated plainly in the header.
294
+ - **Older databases just work.** The `packet_record` and
295
+ `model_run` tables are part of the schema for new databases and
296
+ are created on first use in databases built before them — no
297
+ migration step.
298
+
299
+ ```sh
300
+ # Assemble the packet and record its hash (deterministic for the same state)
301
+ fencewalk packet /tmp/eng.db --out /tmp/packet.md --date 2026-11-18
302
+
303
+ # Store a returned output against the packet it answers (model label is the operator's statement)
304
+ fencewalk ingest /tmp/eng.db /tmp/model-output.md --packet-hash <sha256> --model "Example Model 1"
305
+
306
+ # Render the adjudication draft for a stored run
307
+ fencewalk draft /tmp/eng.db --run 1
308
+ ```
309
+
310
+ ### Adjudication
311
+
312
+ - **Decisions are append-only events.** `adjudicate` records one
313
+ decision (accept / correct / reject) for one deliverable
314
+ section of one run, with a date and an actor. Adjudicating a
315
+ section again adds a new event; the section's current standing
316
+ is its latest event, and the full history stays one
317
+ `adjudications` call away. A `correct` decision **requires**
318
+ `--note`: the note is the correction, preserved verbatim in the
319
+ record.
320
+ - **A decision never applies anything by itself.** Accepting or
321
+ correcting a deliverable does not make the tool parse model
322
+ output into record entries — that silent, fragile step is
323
+ refused by design. Applying an adjudicated deliverable is
324
+ always a separate explicit command (see Fixes, below).
325
+
326
+ ```sh
327
+ # Record one adjudication decision (a correction requires its note)
328
+ fencewalk adjudicate /tmp/eng.db --run 1 --section coverage --decision correct --note "W-1.2 is scored from the checklist, not taken from the run."
329
+
330
+ # List a run's decision events and current standings
331
+ fencewalk adjudications /tmp/eng.db --run 1
332
+ ```
333
+
334
+ ### Fixes
335
+
336
+ - **Application is by hand, never by parsing.** The operator
337
+ applies each deliverable with explicit, checked commands:
338
+ `score`/`rescore` for coverage, `add-chain`, `add-fix`, and
339
+ `add-verify-next` for the rest, and `add-entry` for
340
+ model-flagged inventory gaps, which enter as UNKNOWN like any
341
+ other unverified fact. Duplicate chain keys and fix IDs are
342
+ refused, and rubric citations are validated against the pack.
343
+ - **Fix status changes only on the operator's explicit action.**
344
+ `add-fix` creates a fix as `proposed`; `set-fix-status` is the
345
+ only path that moves it (proposed / approved / done /
346
+ deferred), records the change in the fix's history, and refuses
347
+ a same-status no-op. Nothing anywhere in the tool marks a fix
348
+ done, changes a label, or enters a score by inference from a
349
+ decision.
350
+
351
+ ```sh
352
+ # Apply an adjudicated chain by hand (steps are "<phase>: <text>")
353
+ fencewalk add-chain /tmp/eng.db --key A --name "a borrowed ladder reaches the office window" --control "a lock on the window latch" --control-status unknown --control-rubric W-1.1 --step "Reconnaissance: the ladder is stored in the open yard" --step "Initial access: the window is climbed at night"
354
+
355
+ # Apply an adjudicated fix (created as proposed) and track it
356
+ fencewalk add-fix /tmp/eng.db --id F-1 --action "Fit a lock to the office window latch" --effort "An hour" --breaks A --rubric W-1.1
357
+ fencewalk set-fix-status /tmp/eng.db F-1 approved
358
+ fencewalk list-fixes /tmp/eng.db
359
+
360
+ # Apply an adjudicated verify-next item (sequence number assigned)
361
+ fencewalk add-verify-next /tmp/eng.db --unknown "whether the yard gate is locked at night" --why "chain A stands or falls on it" --check "the harbour log's gate page"
362
+ ```
363
+
364
+ ### Report
365
+
366
+ The report renders the engagement from the store: posture
367
+ summary, coverage table, attack chains, fixes, verify-next, and —
368
+ only when at least one adjudication event exists — an Adjudication
369
+ section carrying, per run, the model label, run date, and packet
370
+ hash, then each deliverable's current decision, date, actor, and
371
+ note. A database with no adjudication events renders exactly as
372
+ before, byte for byte.
373
+
374
+ The PDF is the same report as a file, for handing to a client or
375
+ filing: the same sections in the same order, the same wording, the
376
+ same computed counts, from the same gathered data, so the two
377
+ never drift apart. The writer is hand-rolled (the standard
378
+ library has no PDF writer and the tool takes no dependencies):
379
+ US Letter, the standard 14 fonts only, FlateDecode streams, no
380
+ JavaScript, no forms, no links. Rendering the same database
381
+ twice produces byte-identical output: the file carries no
382
+ timestamps, and its `/ID` is the SHA-256 of the gathered report
383
+ data, so the document is bound to the record it reports. `--out`
384
+ is required — a PDF to stdout is hostile.
385
+
386
+ ```sh
387
+ # Render the engagement report (Markdown) from a database
388
+ fencewalk report /tmp/reference.db
389
+
390
+ # Render and save the report (this is how src/fencewalk/fixtures/reference-case/EXPECTED-REPORT.md was produced)
391
+ fencewalk report /tmp/reference.db --out src/fencewalk/fixtures/reference-case/EXPECTED-REPORT.md
392
+
393
+ # Render the same report as a PDF file (same data, same sections, same wording)
394
+ fencewalk pdf /tmp/reference.db --out /tmp/reference.pdf
395
+ ```
396
+
397
+ ## The web interface
398
+
399
+ `serve` puts one engagement database on a local web page: an
400
+ overview (posture figures, checklist counts, coverage tallies,
401
+ model-pass provenance), the inventory (filterable by label and
402
+ section), the verification checklist, the coverage matrix, the
403
+ model-pass page (packet assembly and output ingest), the
404
+ adjudication page (draft sections, decision forms, apply forms),
405
+ the fixes list, and the report — the same store and the same
406
+ computed counts as the CLI, rendered as HTML.
407
+
408
+ - **Reads are reads.** GET and HEAD never write: a full crawl of
409
+ every page leaves the database file byte-identical, and the
410
+ store is opened fresh per request, so figures can never go
411
+ stale against the database on disk.
412
+ - **The verification loop writes in the browser.** Four form
413
+ submissions — set-label, edit-entry, add-entry, and
414
+ score/rescore — each maps one-to-one onto the CLI command of
415
+ the same name and calls the same store method, with the same
416
+ invariants, the same refusals, and the same history recording;
417
+ a refused write shows the refusal message verbatim and writes
418
+ nothing. Every other path still refuses POST with 405, and PUT,
419
+ DELETE, and PATCH are refused everywhere.
420
+ - **The model pass and adjudication write in the browser.** Seven
421
+ further form submissions — packet assembly, output ingest,
422
+ adjudication decisions, add-chain, add-fix, fix-status
423
+ transitions, and add-verify-next — each mapping one-to-one onto
424
+ the CLI command of the same name with the same invariants and
425
+ refusals. The packet assembly is the one submission that
426
+ answers with a file download instead of a redirect: the store
427
+ records only the packet's hash and metadata, so the packet text
428
+ exists nowhere after assembly except in that response. Ingest
429
+ takes pasted output (CRLF normalized to LF, the one documented
430
+ transformation); a decision never applies anything by itself —
431
+ applying an adjudicated deliverable is always a separate
432
+ explicit submission.
433
+ - **A bounded origin check, not authentication.** The interface
434
+ has no authentication. As the proportionate control for that, a
435
+ form submission whose Origin (or, failing that, Referer) host
436
+ does not match the server's Host is refused with 403 before
437
+ anything is written: this stops a drive-by form-post from an
438
+ unrelated web page while the server is up, at zero dependency
439
+ cost. It does not identify the operator, and it is not a
440
+ substitute for keeping the server local.
441
+ - **Local by default.** `serve` binds `127.0.0.1:8090`. Binding
442
+ any other host prints a plain warning at startup: the interface
443
+ has no authentication, and anyone who can reach the port can
444
+ read the engagement — and change it through the forms above.
445
+ - **Nothing extra to install.** Standard library only, no
446
+ JavaScript, no external assets — the stylesheet is embedded in
447
+ the page. A database with no rubric pack renders with a plain
448
+ "no rubric pack loaded" note where coverage would go, and its
449
+ report page shows the CLI's clean error line instead of
450
+ failing.
451
+
452
+ ```sh
453
+ # Serve an engagement database on http://127.0.0.1:8090/
454
+ fencewalk serve /tmp/eng.db
455
+
456
+ # Choose the port, or bind another address (prints the no-auth warning)
457
+ fencewalk serve /tmp/eng.db --port 8091
458
+ fencewalk serve /tmp/eng.db --host 0.0.0.0
459
+ ```
460
+
461
+ ## Licence
462
+
463
+ Fencewalk is released under the MIT licence. See `LICENSE`.
464
+
465
+ ## Build history
466
+
467
+ - **Slice 0** — the store and the counts: engagement data model,
468
+ FLASH pack as data, the scrubbed reference fixture, the fixture
469
+ loader, and the Markdown report renderer.
470
+ - **Slice 1** — intake: `new`, `add-entry` / `edit-entry` /
471
+ `set-label` / `list-entries`, and bundle-Markdown import.
472
+ - **Slice 2** — rubric packs and manual coverage scoring:
473
+ `load-pack`, `score` / `rescore`, `list-coverage`.
474
+ - **Slice 3** — verification checklists: a derived view that
475
+ stores nothing.
476
+ - **Slice 4** — the model pass: `packet`, `ingest`, `draft`.
477
+ - **Slice 5** — adjudication and fix tracking: `adjudicate` /
478
+ `adjudications`, `add-chain`, `add-fix`, `set-fix-status`,
479
+ `add-verify-next`.
480
+ - **UI-0** — the web interface, read-only: overview, inventory,
481
+ checklist, coverage, report.
482
+ - **UI-1** — the verification loop writes in the browser.
483
+ - **UI-2** — the model pass, adjudication, and fix transitions
484
+ write in the browser.
485
+ - **SCuBA pack (Phase 1)** — the second rubric pack, from pinned
486
+ ScubaGear v2.0.0.
487
+ - **PDF report (Phase 1)** — the engagement report as a
488
+ deterministic PDF file.
489
+ - **Packaging (Phase 1)** — `pipx install fencewalk`: a console
490
+ entry point, one version source, and the packs, fixture, and
491
+ template bundled as package data.
492
+ - **ASD pack (Phase 1)** — the third rubric pack, the ASD
493
+ Blueprint for Secure Cloud Entra ID expected state, v1.4,
494
+ adapted for a small organisation.