You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 5b172cd
Browse filesBrowse the repository at this point in the historyBrowse files
Harden question_id validation with a strict identifier contract
Implement the change-note 13 deferred follow-up (reviewed contract,
security_fix_review_publication_plan_20261023.md section 6): question
ids now fullmatch \A[a-z0-9][a-z0-9_-]{0,63}\Z at the single
authoritative boundary (_validate_question_record), reject-NOT-strip,
enforced before dedup.
Closes three hostile-id sinks with one rule: ':'-forgery of the
4-segment trace request-id shape, the strip/dedup collision that
silently lost trace rows, and markdown table-row injection in
gate-evidence reports. The stored value no longer strips (structurally
redundant under the contract), so dedup and storage agree exactly.
All 114 frozen synthetic_v1 ids satisfy the contract byte-identically;
no corpus, hash, metric, or API change. New adversarial suite
tests/eval/test_question_id_security.py (98 cases). Full suite 800
passed, 1 skipped, 1 warning (supersedes 702); Gate M1 reassessed:
5 passed / 4 blocked unchanged, no waivers. Docs: EVALUATION.md
sections 2 and 7 document the rule; change note section 14 records it.
README status correction rides here: the "question_id allowlist is
not implemented" limitation is replaced with the implemented contract
plus the standing third-party-data trust caveat, and the test record
updates 702 -> 800 with the extended supersession chain.
-**Commits (master):**`eacd8e5` C1 — Phases 4–6 + corpus (81 files; incl. the narrow `.gitignore` exception `corpora/*` + `!corpora/synthetic_v1/`, and a new one-rule `.gitattributes``corpora/synthetic_v1/** -text` discovered necessary at staged review: under `core.autocrlf=true` without it, fresh checkouts re-mapped the corpus bytes and failed manifest SHA-256 verification on 6 PDFs (Windows) and would fail the 18 text files on `autocrlf=false` platforms — all 27 files verified byte-identical after simulated checkout). `c8f013c` C2 — Phase 7 (8 files; discloses that `cli.py` carries the fix's CLI hardening, so the security amendment spans C2+C3 under file-level grouping). C3 — Phase 8 + security amendment (20 files; this entry rides here).
217
217
-**Disclosed limitation (Decision E):** file-level grouping means **C1 and C2 are not independently test-verified**; only the final published tree carries a recorded green run (702). No push occurred; remote publication remains a separate, unmade decision.
**Scope:** Additive record of the `question_id` strict-identifier fix (the Decision-D deferral of §13.5, now implemented as a separately scoped change), its adversarial regression suite, and the Gate M1 reassessment. Sections 1–13 above are preserved unchanged; the canonical master plan was not modified; no earlier decision record was rewritten; no new D-number is created (D3, D10, D13–D18 remain pending). This entry rides the authorized Phase 8 closure commit of 2026-10-24 (owner-approved publication; SHA in `reports\phase8_publication_closure_20261024.md`).
223
+
224
+
**Fix — what changed and why (review basis: `reports\security_fix_review_publication_plan_20261023.md` §6):**
225
+
1.**Root cause.** The question `id` had only a type + non-empty + per-file-dedup check. A hostile id could (a) forge extra `:` segments in the trace request-id `eval:<dataset_id>:<split>:<question_id>` (the exact class closed for `dataset_id`), (b) exploit the strip/dedup mismatch — dedup stored the raw value while the record stored the stripped value, so `"q1"` and `" q1 "` were "distinct" yet both became `q1`, colliding on the `traces.request_id` UNIQUE constraint whose violation is swallowed by best-effort tracing (silent evidence-row loss), and (c) inject markdown table rows (`\n|---|`, `|`) into gate-decision report artifacts. Rated Medium / integrity (no path sink, no SQLi, no crash path).
226
+
2.**Fix (2 files).**`eval\dataset.py`: `_QUESTION_ID_PATTERN = \A[a-z0-9][a-z0-9_-]{0,63}\Z`, **fullmatch on the raw value, reject-NOT-strip**, enforced in `_validate_question_record` immediately after the type check and ahead of dedup — the single authoritative boundary (the only `Question` construction site in `src/`). The stored value no longer strips (now structurally redundant), so dedup and storage agree exactly and the collision class is closed. `docs\EVALUATION.md` §2 documents the rule as the contract; §7 notes the four-segment request-id shape is now structurally guaranteed.
227
+
3.**Invariants preserved.** All 114 frozen `synthetic_v1` ids (dev 70 + test 44, `q0001`–`q0110`) satisfy the contract byte-identically — no corpus change, no hash change; valid-id ordering and determinism unchanged; cross-split id reuse stays legal (request ids differ by split); path-containment, dataset-integrity, redaction, and egress safeguards untouched; typed-error + safe-CLI conventions reused (`DatasetIntegrityError` → CLI exit 3, bounded message, no traceback).
228
+
4.**Test record supersession** (each supersedes the last because changed code invalidated it): 641 → 696 → 702 → **800 passed, 1 skipped, 1 warning, exit 0 (39.22 s)** — lead-run 2026-10-24 (`.venv\Scripts\python.exe -m pytest -q`); new adversarial suite `tests\eval\test_question_id_security.py`**98 passed** (2.30 s); `tests\eval` 265 passed, 1 skipped; `tests\egress` + `tests\test_observer_trace.py` 18 passed, 1 warning; dataset-id security + frozen-corpus groups 61 passed. The 1 skip and 1 warning remain the pre-existing Windows symlink-privilege fixture and upstream `StarletteDeprecationWarning`. Defaults re-verified at runtime: `egress_mode='off'`, `local_generation_enabled=False`, `retrieval_score_floor=None`, `generation_model=None`.
229
+
5.**Gate M1 reassessment (no status manufactured).** Reassessed criterion-by-criterion against fresh evidence: **unchanged at 5 passed / 4 blocked / 0 failed, no waivers** (checklist: `reports\question_id_hardening_20261024.md` §5). The question-id fix closes the §13.5 deferred follow-up but moves no gate criterion: criteria 1/5/7/9 stay blocked on the same D3/BG-1a/score-floor/perf-run prerequisites, and criterion 8's per-path instrumentation caveat is re-stated, not reinterpreted.
230
+
6.**Prohibition status.** The §13 "non-self-authored datasets must not be evaluated until the allowlist lands" restriction is **satisfied for the identifier-integrity dimension** by this fix. The separate trust caveat is unchanged and still binding: the corpus remains same-author (R19 — hashes freeze self-consistency, not authorship), and no external-dataset evaluation is authorized by this entry.
@@ -166,9 +166,9 @@ The CLI shares the same pipeline:
166
166
.venv\Scripts\python.exe -m rag_platform.cli eval --dataset corpora\synthetic_v1 --split dev
167
167
```
168
168
169
-
Last full run, 2026-10-23: **702 passed, 1 skipped, 1 warning** (31.92 s) — the skip is the Windows symlink-privilege
169
+
Last full run, 2026-10-24: **800 passed, 1 skipped, 1 warning** (39.22 s) — the skip is the Windows symlink-privilege
170
170
fixture, the warning an upstream Starlette deprecation, both pre-existing. Record chain, each superseding the last as
171
-
code changed: 641 (Phase 8, pre-fix) → 696 → **702**. Tests are hermetic: no network, no model load, fixtures under
171
+
code changed: 641 (Phase 8, pre-fix) → 696 → 702 → **800**. Tests are hermetic: no network, no model load, fixtures under
172
172
`data\tmp`. From any drive the two `D:`-layout tests fail by design. A `.env` file is optional; copy
173
173
[`.env.example`](.env.example), which keeps egress off.
174
174
@@ -225,12 +225,14 @@ data/ reports/ .cache/ gitignored runtime state
225
225
-**Gate M1 is not passed: 5 passed / 4 blocked.** The blocked criteria — generation-enabled run, score-floor approval,
226
226
the BG-1a verdict, and the generation-spike memory measurement — are recorded with reasons in the evidence checklist
227
227
and change note §13; none is waived.
228
-
-**`question_id` allowlist is not implemented.** Only self-authored, hash-frozen datasets may be evaluated. A
229
-
non-self-authored dataset could forge `:`-delimited request ids or inject markdown rows; fix deferred pending owner
230
-
approval (change note §13).
228
+
-**`question_id` validation is implemented; third-party data is not approved by that fact.** Question ids now
229
+
fullmatch a strict contract (`\A[a-z0-9][a-z0-9_-]{0,63}\Z`, reject-NOT-strip) at dataset load, closing request-id
230
+
forgery, silent trace loss, and markdown-row injection (change note §14). That is an *identifier-integrity* control
231
+
only: hashes freeze self-consistency, not authorship, so any dataset the project did not author must not be treated
232
+
as approved until its use is separately reviewed.
231
233
-**C1 and C2 are not independently test-verified.** The commits are grouped by file, so only the final tree carries a
232
-
green run. The authoritative full-suite record is 702 passed / 1 skipped / 1 warning (2026-10-23); the chain 641 →
233
-
696 → 702 each superseded the last as code changed.
234
+
green run. The authoritative full-suite record is 800 passed / 1 skipped / 1 warning (2026-10-24); the chain 641 →
235
+
696 → 702 → 800 each superseded the last as code changed.
234
236
-**No benchmark numbers.** BG-1a has no valid result; the repo claims no throughput, latency, or quality figures.
235
237
-**The 90 % RAM ceiling is a policy, not code.** The app can only refuse or stop its own work (plan §10.4).
236
238
-**Windows and `D:` only.** Two tests assert the project lives on `D:` and fail anywhere else.
@@ -245,11 +247,10 @@ Committed so far: [`282cd11`](https://github.com/aspire488/rag-platform/commit/2
245
247
[`247b899`](https://github.com/aspire488/rag-platform/commit/247b899) this README, then the three publication commits of
246
248
2026-10-23: [`eacd8e5`](https://github.com/aspire488/rag-platform/commit/eacd8e5) phases 4–6 and the frozen corpus,
0 commit comments