chore(security): scrub internal identifier examples from public docs and tests - #172
chore(security): scrub internal identifier examples from public docs and tests#172lyonzin wants to merge 1 commit into
Conversation
…and tests
The FTS5 lexical fast-path documentation, config examples, tests and
in-code comments used MDR-AD002 and MDR-AD003 as canonical identifier
examples. Those match the format of an internal blue-team detection
rule taxonomy from a specific corpus and should not be leaking into
public code samples, tokenizer docstrings, or fixture seed data.
This commit replaces every public MDR-AD00x mention with MS17-010
(EternalBlue / MS Security Bulletin MS17-010, well-known public
CVE-adjacent identifier) — same shape, same routing coverage, zero
internal context. MDR-AD999 (mock-only) becomes MS99-999.
Files touched:
- README.md, config.example.yaml, docs/features/fts5_fast_path.md,
bench/test_bench_fts5_lexical.py, mcp_server/server.py (docstring)
- tests/conftest.py (fixture seed data + sample_lexical_queries)
- tests/test_fts5_index.py, tests/test_query_router.py,
tests/test_search.py, tests/test_e2e_fts5.py, tests/test_config_fts5.py
Router coverage expansion:
- MS17-010 is a letter+digit compound (MSxx-yyy) that the shipped
DEFAULT patterns [A-Z]{2,}-\d+ do NOT match (requires >=2 letters
before the hyphen). Rather than pick a narrower replacement,
mcp_server/config.py.fts5_patterns gains a new default pattern
[A-Z]+\d+-\d+ so MS-style Security Bulletin identifiers route to
the FTS5 fast-path as well. tests/test_config_fts5.py and
tests/test_query_router.py updated to match.
Zero LEI 1 impact (no MCP tool signature change), zero API surface
diff (validated by scripts/check_api_surface.py), 66/66 tests pass
locally on the touched suites.
📝 WalkthroughWalkthroughThe FTS5 default patterns now recognize letter-plus-digit identifiers such as ChangesFTS5 identifier support
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
| patterns: | ||
| - "[A-Z]{2,}-\\d+" # H1-P4-XXX, MDR-AD002, CWE-79, MS17-010 | ||
| - "[A-Z]{2,}-\\d+" # H1-P4-XXX, MS17-010, CWE-79, MS17-010 | ||
| - "CVE-\\d{4}-\\d+" # canonical CVE identifiers | ||
| - "^[a-f0-9]{32,64}$" # md5/sha1/sha256 file hashes |
There was a problem hiding this comment.
Sample omits new routing pattern
When a user copies this explicit patterns list and enables the lexical fast path, it replaces the programmatic defaults without [A-Z]+\d+-\d+, causing identifiers covered only by the new pattern to remain on the semantic path; the feature guide repeats the same incomplete default list.
Prompt To Fix With AI
This is a comment left during a code review.
Path: config.example.yaml
Line: 289-292
Comment:
**Sample omits new routing pattern**
When a user copies this explicit `patterns` list and enables the lexical fast path, it replaces the programmatic defaults without `[A-Z]+\d+-\d+`, causing identifiers covered only by the new pattern to remain on the semantic path; the feature guide repeats the same incomplete default list.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@config.example.yaml`:
- Line 290: Synchronize the public pattern examples with the runtime default in
config.example.yaml lines 290-290 and docs/features/fts5_fast_path.md lines
60-60: add the [A-Z]+\d+-\d+ pattern, retain the CWE-79 pattern, and use
MS17-010 and MS99-999 as examples in both locations.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: ac45ccac-b153-4308-8aa4-7897b03b1d4d
📒 Files selected for processing (12)
README.mdbench/test_bench_fts5_lexical.pyconfig.example.yamldocs/features/fts5_fast_path.mdmcp_server/config.pymcp_server/server.pytests/conftest.pytests/test_config_fts5.pytests/test_e2e_fts5.pytests/test_fts5_index.pytests/test_query_router.pytests/test_search.py
| # identifier vocabulary. Add custom project-specific codes below. | ||
| patterns: | ||
| - "[A-Z]{2,}-\\d+" # H1-P4-XXX, MDR-AD002, CWE-79, MS17-010 | ||
| - "[A-Z]{2,}-\\d+" # H1-P4-XXX, MS17-010, CWE-79, MS17-010 |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Synchronize both public pattern examples with the runtime default.
Both snippets claim that MS17-010 is supported while showing only "[A-Z]{2,}-\\d+", which cannot match that identifier. Add "[A-Z]+\\d+-\\d+" in both locations and retain the CWE-79 pattern.
config.example.yaml#L290-L290: update the copyable configuration block and useMS17-010andMS99-999as examples.docs/features/fts5_fast_path.md#L60-L60: update the documented default pattern block with the same pattern list.
📍 Affects 2 files
config.example.yaml#L290-L290(this comment)docs/features/fts5_fast_path.md#L60-L60
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@config.example.yaml` at line 290, Synchronize the public pattern examples
with the runtime default in config.example.yaml lines 290-290 and
docs/features/fts5_fast_path.md lines 60-60: add the [A-Z]+\d+-\d+ pattern,
retain the CWE-79 pattern, and use MS17-010 and MS99-999 as examples in both
locations.
Summary
Scrub of internal identifier examples from public docs, config samples, tokenizer docstrings, and test fixtures. The FTS5 fast-path materials had been using
MDR-AD002/MDR-AD003as the canonical identifier examples across README, config, docs, benches, in-code comments, and test seed data. Those match the shape of an internal blue-team detection rule taxonomy and should not leak into public code samples.This PR replaces every
MDR-AD00xmention on the public surface withMS17-010(the well-known public EternalBlue / MS Security Bulletin MS17-010 identifier) — same tokenization behavior, same routing coverage, zero internal context.MDR-AD999(mock-only) becomesMS99-999.What changed
README.md,config.example.yaml,docs/features/fts5_fast_path.md)bench/test_bench_fts5_lexical.py)mcp_server/server.py:847)tests/conftest.py,tests/test_fts5_index.py,tests/test_query_router.py,tests/test_search.py,tests/test_e2e_fts5.py,tests/test_config_fts5.py)Router coverage expansion
MS17-010is a letter+digit compound (MS<year>-<seq>) that the shipped default patterns[A-Z]{2,}-\d+do not match (they require ≥2 letters before the hyphen). Rather than pick a narrower replacement,mcp_server/config.pyfts5_patternsgains a new default pattern[A-Z]+\d+-\d+so MS-style Security Bulletin identifiers route to the FTS5 fast-path just like CWE-79 and CVE-2021-4034. This is additive on the default pattern list (4 → still additive, users with custom patterns unaffected).tests/test_config_fts5.py::test_ut031_defaults_when_section_emptybumped fromassert len == 3toassert len == 4.tests/test_query_router.py::ROUTER_TEST_PATTERNSgains an anchored^[A-Z]+\d+-\d+$counterpart for the boundary tests.LEI 1 preserved
Zero change to the 13 frozen MCP tool signatures.
scripts/check_api_surface.py --checkreturns no diff.Test plan
tests/test_fts5_index.py,tests/test_query_router.py,tests/test_v483_hotfix.py,tests/test_config_fts5.pyruff check+ruff format --checkclean onmcp_server/,tests/,bench/scripts/check_api_surface.py --check)Summary by CodeRabbit
New Features
MS17-010.Documentation
Tests
Greptile Summary
The PR replaces internal-looking identifier examples with public MS bulletin identifiers and expands the runtime router defaults to recognize letter-plus-digit compounds.
[A-Z]+\d+-\d+to the programmatic FTS5 pattern defaults.Confidence Score: 4/5
The sample configuration must be synchronized with the new runtime pattern before merging, otherwise users following it will not get the advertised MS-style FTS5 routing.
The runtime default recognizes MS17-010, but the explicit pattern list shipped for users to copy replaces that default without the new regex, causing identifiers covered only by that regex to remain on the semantic path.
Files Needing Attention: config.example.yaml, docs/features/fts5_fast_path.md
Important Files Changed
Prompt To Fix All With AI
Reviews (1): Last reviewed commit: "chore(security): scrub internal identifi..." | Re-trigger Greptile