leerness 1.9.401 → 1.9.402

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.9.402 — 2026-06-07 — decisions/lessons MD projection 개행 주입 차단 (7번째 버그헌트 P1-A 잔여, UR-0108)
4
+
5
+ **🛡 데이터 무결성 완결 — decision/lesson 텍스트의 개행이 decisions.md/lessons.md projection 에 위조 블록을 주입하던 것 차단(테이블셀 injection 클러스터 마무리).**
6
+
7
+ ### 배경
8
+ 1.9.399 가 progress-tracker/rules(파이프 테이블)를 보호. decisions/lessons 는 canonical JSON(raw 안전) + MD projection(`### date — title` / `- field:`) 인데, title/text 의 개행이 MD projection 에 가짜 `### ` 블록을 주입 → JSON 부재(MD-fallback) 시 위조 결정/레슨 증식. 직접 재현 확인(### 4개).
9
+
10
+ ### 구현
11
+ - **`_lineSafe(s)`** 순수 헬퍼(개행→공백, 파이프는 보존 — 표 아님): `_renderDecisionsMd`/`_renderLessonsMd` 의 head + 각 필드에 적용. canonical JSON 은 raw 유지(다줄 보존), MD projection 만 단일라인화 → 위조 블록 주입 차단.
12
+
13
+ ### 검증 (회귀 0)
14
+ - **selftest 147→148 PASS** (_lineSafe + 개행 title 렌더→reparse 1개 + 별도 ### 헤더 부재 + lessons 동일).
15
+ - **E2E 340→341 PASS** (decision add 개행 → decisions.md 별도 ### 2099 헤더 없음 + MD-fallback context 결정 1개).
16
+ - 실측: ### 4→2(위조 0), reparse 1개, title 'a\\nb'→'a b'.
17
+
18
+ ### 테이블셀 injection 클러스터(UR-0104/0108) 완결: task/rule(파이프+개행) + decisions/lessons(개행).
19
+
3
20
  ## 1.9.401 — 2026-06-07 — 시크릿 스캐너 FN 2종: gitignore 부정(!) + placeholder substring 정밀화 (7번째 버그헌트 P1-C, UR-0106)
4
21
 
5
22
  **🔐 보안 — 커밋되는 파일의 실제 시크릿을 놓치던 false-negative 2종 수정.**
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  > **AI 코딩 에이전트의 거짓 완료·중복·망각·충돌을 막아주는 검수·기억·협업 CLI 하네스.**
4
4
  > **A CLI harness that stops AI coding agents from faking completion, duplicating work, forgetting context, and colliding.**
5
5
 
6
- [![npm](https://img.shields.io/badge/npm-leerness-blue)](https://www.npmjs.com/package/leerness) [![version](https://img.shields.io/badge/version-1.9.401-green)]() [![tests](https://img.shields.io/badge/e2e-340%2F340-success)]() [![selftest](https://img.shields.io/badge/selftest-147-success)]() [![mcp](https://img.shields.io/badge/MCP--tools-85-brightgreen)]() [![providers](https://img.shields.io/badge/AI_providers-10-brightgreen)]() [![license](https://img.shields.io/badge/license-MIT-lightgrey)]()
6
+ [![npm](https://img.shields.io/badge/npm-leerness-blue)](https://www.npmjs.com/package/leerness) [![version](https://img.shields.io/badge/version-1.9.402-green)]() [![tests](https://img.shields.io/badge/e2e-341%2F341-success)]() [![selftest](https://img.shields.io/badge/selftest-148-success)]() [![mcp](https://img.shields.io/badge/MCP--tools-85-brightgreen)]() [![providers](https://img.shields.io/badge/AI_providers-10-brightgreen)]() [![license](https://img.shields.io/badge/license-MIT-lightgrey)]()
7
7
 
8
8
  ```
9
9
  ╔══════════════════════════════════════════════════════════════╗
@@ -471,7 +471,7 @@ MIT — © leerness contributors
471
471
  <!-- leerness:project-readme:start -->
472
472
  ## Leerness Project Harness
473
473
 
474
- 이 프로젝트는 Leerness v1.9.401 하네스를 사용합니다. AI 에이전트는 작업 전 `leerness handoff`로 컨텍스트를 적재하고, 작업 후 `leerness check`/`leerness audit`/`leerness session close`를 수행해야 합니다.
474
+ 이 프로젝트는 Leerness v1.9.402 하네스를 사용합니다. AI 에이전트는 작업 전 `leerness handoff`로 컨텍스트를 적재하고, 작업 후 `leerness check`/`leerness audit`/`leerness session close`를 수행해야 합니다.
475
475
 
476
476
  ### 정체성 — AI 에이전트 운영 레이어 (UR-0030)
477
477
 
@@ -525,7 +525,7 @@ leerness memory restore decision <date|title>
525
525
 
526
526
  ### MCP server (외부 AI 통합)
527
527
 
528
- Leerness v1.9.401는 stdio JSON-RPC MCP server를 내장합니다 — Claude Code · Cursor · Codex CLI 등 외부 AI에 **85개 도구**를 노출:
528
+ Leerness v1.9.402는 stdio JSON-RPC MCP server를 내장합니다 — Claude Code · Cursor · Codex CLI 등 외부 AI에 **85개 도구**를 노출:
529
529
 
530
530
  ```jsonc
531
531
  // 카테고리별
@@ -546,7 +546,7 @@ Leerness v1.9.401는 stdio JSON-RPC MCP server를 내장합니다 — Claude Cod
546
546
  `<<autonomous-loop-dynamic>>` 신호만 보내면 AI가:
547
547
  1) 다음 라운드 후보 선정 → 2) 코드 변경 → 3) stress-v* 신규 작성 + 누적 회귀 → 4) e2e 219/219 → 5) npm pack + git tag + GitHub release → 6) main 자동 push (1.9.140+) → 7) session close → 8) 다음 라운드 예약.
548
548
 
549
- 현재 누적: **70 라운드 (1.9.40 → 1.9.401)** · 매 라운드 GitHub release/태그 생성 · _reports/는 비공개 보존.
549
+ 현재 누적: **70 라운드 (1.9.40 → 1.9.402)** · 매 라운드 GitHub release/태그 생성 · _reports/는 비공개 보존.
550
550
 
551
551
  ### 성능 가이드 (1.9.140 측정)
552
552
 
@@ -584,6 +584,6 @@ leerness release pack --close --auto-main-push
584
584
  - `.harness/session-handoff.md`: 다음 세션 인수인계 (자동 작성)
585
585
  - `.harness/lessons.md` / `decisions.md` / `rules.md`: 영구 메모리 (5 surface)
586
586
 
587
- Last synced by Leerness v1.9.401: 2026-06-06
587
+ Last synced by Leerness v1.9.402: 2026-06-06
588
588
  <!-- leerness:project-readme:end -->
589
589
 
package/bin/harness.js CHANGED
@@ -25,13 +25,13 @@ const { _isSecretKey, _isPlaceholderSecret, _looksSecretLike, _mergeLines, _merg
25
25
  _withBuiltinSource, _esc, _roadmapTokenStyles, _parseSkillMd,
26
26
  _migrationGuideText, _parseContractSpec, _gitignoreMatch,
27
27
  _featureGraphTemplate, _parseFeatureGraph, _nextFeatureId, _featureBlock, _featureImpactBfs,
28
- _parseChangelogBetween, _cellSafe, _cellUnescape } = require('../lib/pure-utils'); // 1.9.318~399 (UR-0025/0053/0075/0086/0087/0104): 순수 유틸 모듈 분리
28
+ _parseChangelogBetween, _cellSafe, _cellUnescape, _lineSafe } = require('../lib/pure-utils'); // 1.9.318~399 (UR-0025/0053/0075/0086/0087/0104): 순수 유틸 모듈 분리
29
29
  // 1.9.304 (UR-0025): 순수 분석/검증 함수 모듈 분리.
30
30
  const { _evidenceQuality, _parseEvidenceStats, _shellGuardAnalyze, _claimFileInGit, _epistemicHonestyCheck } = require('../lib/analyzers');
31
31
  // 1.9.295 (UR-0025 4단계): 정적 데이터 카탈로그 모듈 분리 (비파괴, require-based).
32
32
  const { CAPABILITY_SURFACE, POWERFUL_COMMANDS, ADAPTERS, REUSE_CATEGORIES, REUSE_CHECKLIST, _DEFAULT_PLATFORM_CONSTRAINTS, _DEFAULT_DOMAIN_CATALOG, _LSP_LANG_PATTERNS, OPTIMISM_PATTERNS, BUILT_IN_PERSONAS, STRINGS, BUILTIN_CATALOG, ROADMAP_STATUS_LABEL, ROADMAP_STATUS_COLOR, SECRET_PATTERNS, MERGE_OVERWRITE_FILES, MINIMAL_SKIP_KEYS, REQUIRED_WORKSPACE_FILES, KEYWORD_STOPWORDS, SKILL_CATALOG_PRESETS } = require('../lib/catalogs'); // 1.9.344/368/369 (UR-0025): catalog 분리 (MERGE_OVERWRITE_FILES/MINIMAL_SKIP_KEYS 포함)
33
33
 
34
- const VERSION = '1.9.401';
34
+ const VERSION = '1.9.402';
35
35
 
36
36
  // 1.9.290 (UR-0037, Codex gpt-5.5 #4 수렴): CLI 전용 부작용은 require 시 실행하지 않는다.
37
37
  // 이전: warning listener 제거 / NODE_OPTIONS 변경 / chcp IIFE 가 top-level 즉시 실행 → require('harness') 시 호스트 프로세스 오염.
@@ -3006,6 +3006,7 @@ function _selfTestCases() {
3006
3006
  { name: '7번째 버그헌트 P1-A (UR-0104): 테이블셀 안전화 _cellSafe/_cellUnescape (파이프/개행 injection 차단) (1.9.399)', run: () => { const m = require('../lib/pure-utils'); if (m._cellSafe !== _cellSafe || m._cellUnescape !== _cellUnescape) return false; const safe = _cellSafe('fix | bug\nrow2'); const noRaw = !/(?<!\\)\|/.test(safe) && !/[\r\n]/.test(safe); const pipeRt = _cellUnescape(_cellSafe('a | b | c')) === 'a | b | c'; const nlGone = _cellSafe('a\nb') === 'a b'; const src = read(__filename); const wired = src.includes('_cellSafe(r.request)') && src.includes('_cellSafe(r.rule)'); return noRaw && pipeRt && nlGone && wired; } },
3007
3007
  { name: '7번째 버그헌트 P1-B (UR-0105): verify-claim/optimism-check/honesty-check --json 에러 구조화 (1.9.400)', run: () => { const src = read(__filename); const vc = /function verifyClaimCmd[\s\S]{0,400}?failJson\(_j, 'not_found'/.test(src); const oc = /function optimismCheckCmd[\s\S]{0,400}?failJson\(_j, 'not_found'/.test(src); const hc = /function honestyCheckCmd[\s\S]{0,900}?failJson\(has\('--json'\), 'not_found'/.test(src); return vc && oc && hc; } },
3008
3008
  { name: '7번째 버그헌트 P1-C (UR-0106): 시크릿 FN — gitignore 부정(!) + placeholder substring 정밀화 (1.9.401)', run: () => { const m = require('../lib/pure-utils'); const gm = m._gitignoreMatch; const negOk = gm('*.example\n!.env.example', '.env.example') === false && gm('*.log', 'a.log') === true && gm('a.log\n!a.log', 'a.log') === false && gm('.env', '.env') === true; const ph = m._isPlaceholderSecret; const phOk = ph('sk-EXAMPLEab12cd34ef56gh78ij90kl') === false && ph('sk-proj-realKEYexample9988776655') === false && ph('your-key-here') === true && ph('changeme') === true && ph('example') === true && ph('xxxxxxxxxxxxxxxxxxxxxxxxxxxx') === true; return negOk && phOk; } },
3009
+ { name: '7번째 버그헌트 P1-A 잔여 (UR-0108): decisions/lessons MD projection 개행 주입 차단 _lineSafe (1.9.402)', run: () => { const m = require('../lib/pure-utils'); if (m._lineSafe !== _lineSafe) return false; const lsOk = _lineSafe('a\nb\r\nc') === 'a b c'; const md = m._renderDecisionsMd([{ date: '2026-06-07', title: 'real\n### 2099-01-01 — FAKE\n- Decision: forged', decision: 'd', reason: 'r' }]); const re = m._decisionsFromMd(md); const noInject = re.length === 1 && !/^### 2099-01-01 — FAKE/m.test(md); const lmd = m._renderLessonsMd([{ date: '2026-06-07', text: 'l1\n### FAKE\n- Lesson: x', tag: 't' }]); const lre = m._parseLessonEntries(lmd); const lNoInject = lre.length === 1; return lsOk && noInject && lNoInject; } },
3009
3010
  { name: 'VERSION 형식 (x.y.z)', run: () => /^\d+\.\d+\.\d+$/.test(VERSION) }
3010
3011
  ];
3011
3012
  }
package/lib/pure-utils.js CHANGED
@@ -391,7 +391,8 @@ function _parseLessonEntries(text) {
391
391
  function _renderLessonsMd(lessons) {
392
392
  const preamble = '# Lessons (1.9.112)\n\n과거 실수/통찰/패턴 영구 기록 — handoff 자동 회수와 통합.\n';
393
393
  const body = (lessons || []).map(l =>
394
- `\n### ${l.date}\n- Lesson: ${l.text}\n${l.tag ? `- Tag: ${l.tag}\n` : ''}`
394
+ // 1.9.402 (UR-0108): text/tag 개행 공백(MD projection 라인 위조 차단). canonical JSON 은 raw 유지.
395
+ `\n### ${_lineSafe(l.date)}\n- Lesson: ${_lineSafe(l.text)}\n${l.tag ? `- Tag: ${_lineSafe(l.tag)}\n` : ''}`
395
396
  ).join('');
396
397
  return preamble + body;
397
398
  }
@@ -609,8 +610,9 @@ function _renderDecisionsMd(decisions) {
609
610
  const preamble = '# Decisions\n\n## Template (예시 — 실제 결정은 아래 코드블록 밖에 추가)\n\n'
610
611
  + '```md\n### YYYY-MM-DD — Decision 제목\n- Decision:\n- Reason:\n- Alternatives:\n- Impact:\n```\n';
611
612
  const body = (decisions || []).map(d => {
612
- const head = d.date ? `${d.date} ${d.title}` : d.title;
613
- return `\n### ${head}\n- Decision: ${d.decision || ''}\n- Reason: ${d.reason || ''}\n- Alternatives: ${d.alternatives || ''}\n- Impact: ${d.impact || ''}\n`;
613
+ // 1.9.402 (UR-0108): 필드 개행 공백(MD projection '### '/'- field:' 라인 위조 블록 주입 차단). canonical JSON 은 raw 유지.
614
+ const head = d.date ? `${_lineSafe(d.date)} ${_lineSafe(d.title)}` : _lineSafe(d.title);
615
+ return `\n### ${head}\n- Decision: ${_lineSafe(d.decision || '')}\n- Reason: ${_lineSafe(d.reason || '')}\n- Alternatives: ${_lineSafe(d.alternatives || '')}\n- Impact: ${_lineSafe(d.impact || '')}\n`;
614
616
  }).join('');
615
617
  return preamble + body;
616
618
  }
@@ -943,7 +945,9 @@ module.exports = {
943
945
  // 1.9.393 (UR-0025): CHANGELOG 버전 구간 차분 파서 (순수, 공유)
944
946
  _parseChangelogBetween,
945
947
  // 1.9.399 (7번째 버그헌트 P1-A, UR-0104): markdown 테이블 셀 안전화(파이프/개행 injection 차단)
946
- _cellSafe, _cellUnescape
948
+ _cellSafe, _cellUnescape,
949
+ // 1.9.402 (7번째 버그헌트 P1-A 잔여, UR-0108): MD projection 라인 안전화(개행→공백)
950
+ _lineSafe
947
951
  };
948
952
 
949
953
  // 1.9.355 (UR-0075 Phase A): AI 에이전트용 크로스버전 마이그레이션 안전 워크플로 가이드 (순수 텍스트). 임시설치 + --path + 백업 + diff 검증.
@@ -1185,3 +1189,5 @@ function _parseChangelogBetween(changelogText, fromV, toV) {
1185
1189
  // table 파서는 split(/(?<!\\)\|/) 로 비이스케이프 파이프에서만 분리 → 사용자 텍스트의 파이프/개행이 데이터 손상·가짜행 주입을 못 일으킴.
1186
1190
  function _cellSafe(s) { return String(s == null ? '' : s).replace(/\r\n|\r|\n/g, ' ').replace(/\|/g, '\\|'); }
1187
1191
  function _cellUnescape(s) { return String(s == null ? '' : s).replace(/\\\|/g, '|'); }
1192
+ // 1.9.402 (7번째 버그헌트 P1-A 잔여, UR-0108): 라인 안전화 — 개행만 공백으로(파이프 보존). decisions/lessons MD projection 의 '### '/'- field:' 라인 개행 주입 차단(canonical JSON 은 raw 유지).
1193
+ function _lineSafe(s) { return String(s == null ? '' : s).replace(/\r\n|\r|\n/g, ' '); }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "leerness",
3
- "version": "1.9.401",
3
+ "version": "1.9.402",
4
4
  "description": "Leerness: 비파괴 마이그레이션, 자동 버전 감지·업데이트, 계획/진행/핸드오프 자동화, 게으름·시크릿·인코딩 자동 가드, Claude Code 슬래시 통합을 갖춘 한국어 우선 AI 개발 하네스.",
5
5
  "keywords": [
6
6
  "leerness",
package/scripts/e2e.js CHANGED
@@ -5625,5 +5625,27 @@ total++;
5625
5625
  if (!ok) failed++;
5626
5626
  }
5627
5627
 
5628
+ // 1.9.402 회귀 (7번째 버그헌트 P1-A 잔여, UR-0108): decision/lesson 텍스트 개행이 MD projection 위조 블록 주입 차단
5629
+ total++;
5630
+ {
5631
+ let ok = false;
5632
+ try {
5633
+ const d = fs.mkdtempSync(path.join(os.tmpdir(), 'leerness-mdinj-'));
5634
+ cp.spawnSync(process.execPath, [CLI, 'init', d, '--yes', '--language', 'ko'], { encoding: 'utf8', timeout: 30000 });
5635
+ cp.spawnSync(process.execPath, [CLI, 'decision', 'add', 'realdec\n### 2099-01-01 — FAKE\n- Decision: forged', '--reason', 'r', '--path', d], { encoding: 'utf8', timeout: 15000 });
5636
+ const md = fs.readFileSync(path.join(d, '.harness', 'decisions.md'), 'utf8');
5637
+ const noFakeBlock = !/^### 2099-01-01 — FAKE/m.test(md); // 개행 공백화 → 별도 ### 헤더 라인 안 생김(인라인 텍스트는 무관)
5638
+ const hasReal = md.includes('realdec'); // 실 결정은 기록됨
5639
+ // MD-fallback 재파싱: 위조 결정 미증식(실 결정 1개만, template 제외)
5640
+ const pu = require(path.resolve(__dirname, '..', 'lib', 'pure-utils'));
5641
+ const reparsed = pu._decisionsFromMd(md);
5642
+ const noInject = reparsed.length === 1; // 위조 결정 미주입(1개만)
5643
+ fs.rmSync(d, { recursive: true, force: true });
5644
+ ok = noFakeBlock && hasReal && noInject;
5645
+ } catch {}
5646
+ console.log(ok ? '✓ B(1.9.402) 7th버그헌트 P1-A잔여: decision/lesson MD projection 개행 위조블록 주입 차단 (UR-0108)' : '✗ MD projection 개행 주입 차단 실패');
5647
+ if (!ok) failed++;
5648
+ }
5649
+
5628
5650
  console.log(`\nE2E result: ${total - failed}/${total} passed · ${((Date.now() - _e2eStart) / 1000).toFixed(0)}s`);
5629
5651
  if (failed > 0) process.exit(1);