Commit 1ce4aeb
fix(audit): batch 1 — M-1 bare-except + M-3 timezone_offset + C-2 spec drift + typedb doc (#100)
* fix: audit batch 1 — M-1 bare-except + M-3 timezone_offset + C-2 spec drift + typedb doc
Closes 4 findings from tasks/compliance-audit-2026-04-25.md, all
small / mechanical / independent.
M-1 — memory_store.py:351 bare `except:` → `except Exception:`
Direct GOV-003 §"Error Handling" violation: bare except catches
KeyboardInterrupt/SystemExit. The re-raise on line 354 partially
compensated, but the pattern itself is what GOV-003 forbids and what
Ruff `E722` (already enabled) would flag the moment H-1 lands.
Comment added explaining the GOV-003 reference for future readers.
M-3 — OCSF events now emit `metadata.timezone_offset: 0`
GOV-012 §"Required OCSF Base Fields" lists timezone_offset as a
mandatory base attribute. Our events were correct on `time` (always
ISO8601 UTC) but missed the explicit offset, forcing OCSF-strict
downstream pipelines (Sentinel custom-log tables) to insert an
ingest-time transform. Constant `0` since we always emit UTC.
C-2 — `no_hardcoded_secrets` fabricated control claim removed
governance/controls.yaml:45-47 declared GovernanceValidator
.validate_operation as the runtime enforcement point for
no_hardcoded_secrets. Reading governance_validator.py:31-49 — the
method has zero secret-scanning logic. This is the highest-severity
audit-risk pattern: a control listed as 'enforced via runtime method
X' where X is a no-op. Removed the fabricated claim with an inline
comment documenting honest state (GitGuardian + Snyk in CI today;
ruff S rules pending H-1; runtime detector tracked as follow-up).
test_governance_spec_drift.py still passes — its "every runtime rule
references a method or test" check is satisfied by the remaining
input_validation rule.
typedb doc — `export TYPEDB_USERNAME=admin` → `<your-typedb-username>`
Carry-over from PR #82 (TypeDB auth hardening) that missed the
merge by 64s. The example block in configure-typedb.md was the last
place the old hardcoded `admin` default still appeared in user-facing
docs.
All four touch independent files. 18/18 governance + logging tests
pass locally. ruff check + ruff format --check clean.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* ci: enforce --cov-fail-under=67 (audit H-2)
GOV-007 §'Coverage Requirements' mandates ≥80% line / ≥70% branch
'enforced in CI'. Today's CI runs pytest --cov but does NOT pass
--cov-fail-under, so any coverage including 0% is silently accepted.
controls.yaml:35 already claims --cov-fail-under=67 as the enforced
value; this PR makes the claim true.
67% chosen as the starting ratchet because it matches the existing
governance/controls.yaml declaration and is verified to pass on
master today. Issue #51 tracks raising it toward 80% across v2.5.x.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>1 parent f36409e commit 1ce4aeb
5 files changed
Lines changed: 24 additions & 6 deletions
File tree
- .github/workflows
- docs/how-to
- governance
- src/zettelforge
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
63 | 67 | | |
64 | 68 | | |
65 | 69 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
118 | 118 | | |
119 | 119 | | |
120 | 120 | | |
121 | | - | |
| 121 | + | |
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
45 | | - | |
46 | | - | |
47 | | - | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
48 | 54 | | |
49 | 55 | | |
50 | 56 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
348 | 348 | | |
349 | 349 | | |
350 | 350 | | |
351 | | - | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
352 | 355 | | |
353 | 356 | | |
354 | 357 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
104 | 109 | | |
105 | 110 | | |
106 | 111 | | |
| |||
0 commit comments