leerness 1.9.363 → 1.9.365
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 +36 -0
- package/README.md +5 -5
- package/bin/harness.js +61 -20
- package/lib/catalogs.js +3 -1
- package/lib/pure-utils.js +21 -0
- package/package.json +1 -1
- package/scripts/e2e.js +48 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,41 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.9.365 — 2026-06-06 — 안정화⑤ 외부리뷰 CV-6: 시크릿 스캐너 FP/FN 정밀도 (UR-0081)
|
|
4
|
+
|
|
5
|
+
**🛠 외부 멀티모델 리뷰 안정화 시리즈 5탄 — 시크릿 스캐너 오탐(placeholder/자기 .env) 억제 + 미탐(unquoted) 보강.**
|
|
6
|
+
|
|
7
|
+
### 배경 — 외부 리뷰 CV-6 (Opus+Sonnet)
|
|
8
|
+
- **FP**: `secret: "change-me"` 같은 placeholder 경보(Opus), 사용자가 토큰 채운 gitignored `.env` 경보(Sonnet, 설계 모순 — .env 는 gitignored 안전 보관소).
|
|
9
|
+
- **FN**: 따옴표 없는 `KEY=secret123` 미탐(Opus, 패턴이 따옴표 강제).
|
|
10
|
+
- provider 19종 정탐 6/6 양호(FP 없음).
|
|
11
|
+
|
|
12
|
+
### 구현
|
|
13
|
+
1. **placeholder FP 억제** — `_isPlaceholderSecret(value)`(pure): change-me/your-*/<...>/example/${...} 등 명백한 예시값은 시크릿 아님. assignment 패턴(valueGroup)의 **값에만** 적용(provider 형식 키엔 미적용 → FN 방지).
|
|
14
|
+
2. **unquoted FN 보강** — 신규 패턴 `KEY=value`(따옴표 없음) + `_looksSecretLike`(숫자포함 8+/24+ 만 후보 → camelCase 코드 식별자 오탐 억제). charset 이 `.` 제외 → `process.env.X` 등 var-ref 자동 제외.
|
|
15
|
+
3. **gitignored 강등** — `_isLikelyGitignored`(간이 .gitignore 매칭): gitignored 파일(.env 계열)의 발견은 **info 로 강등**(커밋 제외 = 설계상 안전), 커밋되는 파일 발견만 실패. `.env` 미-gitignore 시엔 정상 실패.
|
|
16
|
+
4. SECRET_PATTERNS 19→20.
|
|
17
|
+
|
|
18
|
+
### 검증 (회귀 0)
|
|
19
|
+
- **selftest 111→112 PASS** (행위: `_isPlaceholderSecret`/`_looksSecretLike` 직접 호출 단언). **E2E 310→311 PASS** (행위: placeholder no-fail / unquoted 탐지 / gitignored info 강등 3시나리오).
|
|
20
|
+
- 실측: `{secret:"change-me"}` no-fail · `password=hunter2realsecret` 탐지 · gitignored `.env`(토큰) exit 0 + info, 미-gitignore 시 fail.
|
|
21
|
+
|
|
22
|
+
## 1.9.364 — 2026-06-06 — 4번째 외부평가 반영: auto-update hook 비침투화 (UR-0083)
|
|
23
|
+
|
|
24
|
+
**🛠 4번째 외부평가(web, 1.9.361 대상) 9.3 반영 — SessionStart 자동업데이트 hook 매세션 노이즈 제거.**
|
|
25
|
+
|
|
26
|
+
### 배경
|
|
27
|
+
4번째 외부평가가 "Claude 세션 시작마다 `leerness update --check` 가 실행돼 부담"을 지적(9.3). Codex CV-2 후속 권고(hook 비침투화)와 일치. `--no-auto-update`(opt-out)는 이미 존재하나, 기본 ON 상태의 hook 이 매 세션 출력하는 점이 문제.
|
|
28
|
+
|
|
29
|
+
### 구현
|
|
30
|
+
1. **`update --check --quiet` 모드**(신규): up-to-date 시 **완전 무음**, 업데이트 가능 시에만 1줄 통지. 헤더/네트워크 로그 전부 억제.
|
|
31
|
+
2. **SessionStart hook 명령 → `leerness update --check --quiet`**: 새 설치는 quiet hook.
|
|
32
|
+
3. **기존 비-quiet hook 자동 업그레이드**: autoUpdateInstall 재실행(migrate 포함) 시 기존 `leerness update --check`(비-quiet)를 quiet 버전으로 교체 → 기존 사용자도 노이즈 제거.
|
|
33
|
+
4. **opt-out 가시화**: hook 설치 안내에 "최신이면 무음" 명시 + `--no-auto-update` 끄기 안내 유지.
|
|
34
|
+
|
|
35
|
+
### 검증 (회귀 0)
|
|
36
|
+
- **selftest 110→111 PASS** (quiet 모드 + hook --quiet + 업그레이드 로직 가드). **E2E 309→310 PASS** (행위: up-to-date `update --check --quiet` 무음 + hook 명령 --quiet 확인).
|
|
37
|
+
- 실측: up-to-date 프로젝트 `update --check --quiet` → 출력 0 chars. 기존 비-quiet hook → 재설치 시 `--quiet` 로 업그레이드.
|
|
38
|
+
|
|
3
39
|
## 1.9.363 — 2026-06-06 — 안정화④ 외부리뷰 CV-7: commands/help 표면 drift 해소 (UR-0082)
|
|
4
40
|
|
|
5
41
|
**🛠 외부 멀티모델 리뷰 안정화 시리즈 4탄 — `--help`/`commands` 에서 누락됐던 명령군 전수 등재.**
|
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
|
-
[](https://www.npmjs.com/package/leerness) [](https://www.npmjs.com/package/leerness) []() []() []() []() []() []()
|
|
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.
|
|
474
|
+
이 프로젝트는 Leerness v1.9.365 하네스를 사용합니다. 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.
|
|
528
|
+
Leerness v1.9.365는 stdio JSON-RPC MCP server를 내장합니다 — Claude Code · Cursor · Codex CLI 등 외부 AI에 **83개 도구**를 노출:
|
|
529
529
|
|
|
530
530
|
```jsonc
|
|
531
531
|
// 카테고리별
|
|
@@ -546,7 +546,7 @@ Leerness v1.9.363는 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.
|
|
549
|
+
현재 누적: **70 라운드 (1.9.40 → 1.9.365)** · 매 라운드 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.
|
|
587
|
+
Last synced by Leerness v1.9.365: 2026-06-06
|
|
588
588
|
<!-- leerness:project-readme:end -->
|
|
589
589
|
|
package/bin/harness.js
CHANGED
|
@@ -7,7 +7,7 @@ const cp = require('child_process');
|
|
|
7
7
|
const os = require('os'); // 1.9.178: _publishToNpm 에서 os.tmpdir() 사용 (전역 import)
|
|
8
8
|
const readline = require('readline');
|
|
9
9
|
// 1.9.274 (UR-0025 1단계): 순수 유틸 함수 모듈 분리 (require-based, 비파괴). selftest 7종이 동작 검증.
|
|
10
|
-
const { _isSecretKey, compareVer, parseHarnessVersion, _classifyCJK, _riskLabel, _detectSystemLang, _parseSlashFromHelp,
|
|
10
|
+
const { _isSecretKey, _isPlaceholderSecret, _looksSecretLike, compareVer, parseHarnessVersion, _classifyCJK, _riskLabel, _detectSystemLang, _parseSlashFromHelp,
|
|
11
11
|
PERMISSION_TIERS, _tierRank, _requiredTier, _policyAllows, _resolveNpmTag, _mcpJsonContent, _newRunRecord,
|
|
12
12
|
_htmlToText, _extractTitle, _extractLinks,
|
|
13
13
|
_countDatedBlocks, _extractDecisionBlocks, _classifyIntent,
|
|
@@ -28,7 +28,7 @@ const { _evidenceQuality, _parseEvidenceStats, _shellGuardAnalyze, _claimFileInG
|
|
|
28
28
|
// 1.9.295 (UR-0025 4단계): 정적 데이터 카탈로그 모듈 분리 (비파괴, require-based).
|
|
29
29
|
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, SKILL_CATALOG_PRESETS } = require('../lib/catalogs'); // 1.9.344 (UR-0025): SKILL_CATALOG_PRESETS 분리
|
|
30
30
|
|
|
31
|
-
const VERSION = '1.9.
|
|
31
|
+
const VERSION = '1.9.365';
|
|
32
32
|
|
|
33
33
|
// 1.9.290 (UR-0037, Codex gpt-5.5 #4 수렴): CLI 전용 부작용은 require 시 실행하지 않는다.
|
|
34
34
|
// 이전: warning listener 제거 / NODE_OPTIONS 변경 / chcp IIFE 가 top-level 즉시 실행 → require('harness') 시 호스트 프로세스 오염.
|
|
@@ -3077,14 +3077,14 @@ function _selfTestCases() {
|
|
|
3077
3077
|
{ name: 'UR-0058: lessons canonical JSON 레이어(_loadLessons/_saveLessons/lessonsJsonPath) + pure 파서/렌더 round-trip', run: () => { const m = require('../lib/pure-utils'); const objs = [{ date: '2026-06-05', text: 'A', tag: 't' }, { date: '2026-06-04', text: 'B', tag: null }]; const rt = m._parseLessonEntries(m._renderLessonsMd(objs)); const rtOk = JSON.stringify(rt) === JSON.stringify(objs); const tplOk = m._parseLessonEntries(m._renderLessonsMd([])).length === 0; const layerOk = typeof _loadLessons === 'function' && typeof _saveLessons === 'function' && typeof lessonsJsonPath === 'function' && _renderLessonsMd === m._renderLessonsMd; return rtOk && tplOk && layerOk; } },
|
|
3078
3078
|
{ name: 'UR-0025 심층: BUILTIN_CATALOG→lib/catalogs + _withBuiltinSource→pure-utils 분리 (1.9.341)', run: () => { const c = require('../lib/catalogs'); const m = require('../lib/pure-utils'); const catOk = c.BUILTIN_CATALOG && Object.keys(c.BUILTIN_CATALOG).length === 9 && c.BUILTIN_CATALOG.office && c.BUILTIN_CATALOG.office.version === '1.0.0'; const out = m._withBuiltinSource(c.BUILTIN_CATALOG); const work = Object.keys(out).length === 9 && Object.values(out).every(v => v._source === 'builtin') && out.office.version === '1.0.0' && Array.isArray(out.office.capabilities) && Object.keys(m._withBuiltinSource(null)).length === 0; const src = read(__filename); const moved = BUILTIN_CATALOG === c.BUILTIN_CATALOG && _withBuiltinSource === m._withBuiltinSource && !/const BUILTIN_CATALOG = \{/.test(src); return catOk && work && moved; } },
|
|
3079
3079
|
{ name: 'UR-0025 심층: ROADMAP_STATUS_LABEL/COLOR→lib/catalogs 분리 (1.9.342)', run: () => { const c = require('../lib/catalogs'); const lblOk = c.ROADMAP_STATUS_LABEL && Object.keys(c.ROADMAP_STATUS_LABEL).length === 11 && c.ROADMAP_STATUS_LABEL.done === '완료' && c.ROADMAP_STATUS_LABEL.blocked === '오류'; const colOk = c.ROADMAP_STATUS_COLOR && Object.keys(c.ROADMAP_STATUS_COLOR).length === 11 && c.ROADMAP_STATUS_COLOR.done === '#16a34a' && c.ROADMAP_STATUS_COLOR.skill === '#8b5cf6'; const src = read(__filename); const moved = ROADMAP_STATUS_LABEL === c.ROADMAP_STATUS_LABEL && ROADMAP_STATUS_COLOR === c.ROADMAP_STATUS_COLOR && !/const ROADMAP_STATUS_LABEL = \{/.test(src); return lblOk && colOk && moved; } },
|
|
3080
|
-
{ name: 'UR-0025 심층: SECRET_PATTERNS→lib/catalogs 보안 응집 분리 (1.9.343)', run: () => { const c = require('../lib/catalogs'); const catOk = Array.isArray(c.SECRET_PATTERNS) && c.SECRET_PATTERNS.length ===
|
|
3080
|
+
{ name: 'UR-0025 심층: SECRET_PATTERNS→lib/catalogs 보안 응집 분리 (1.9.343)', run: () => { const c = require('../lib/catalogs'); const catOk = Array.isArray(c.SECRET_PATTERNS) && c.SECRET_PATTERNS.length === 20 && c.SECRET_PATTERNS.every(p => p.name && p.re instanceof RegExp); const A = 'A'.repeat(40); const hit = (s) => c.SECRET_PATTERNS.some(p => { p.re.lastIndex = 0; return p.re.test(s); }); const det = hit('AKIA' + 'ABCD1234EFGH5678') && hit('sk-' + 'ant-api03-' + A + '_' + A) && !hit('const u = "john' + '_doe_2024";'); const moved = SECRET_PATTERNS === c.SECRET_PATTERNS; return catOk && det && moved; } },
|
|
3081
3081
|
{ name: 'UR-0025 심층: SKILL_CATALOG_PRESETS→lib/catalogs 분리 (1.9.344)', run: () => { const c = require('../lib/catalogs'); const catOk = c.SKILL_CATALOG_PRESETS && Object.keys(c.SKILL_CATALOG_PRESETS).length === 2 && c.SKILL_CATALOG_PRESETS.vercel && c.SKILL_CATALOG_PRESETS.vercel.owner === 'vercel-labs' && c.SKILL_CATALOG_PRESETS.anthropic && c.SKILL_CATALOG_PRESETS.anthropic.repo === 'skills'; const moved = SKILL_CATALOG_PRESETS === c.SKILL_CATALOG_PRESETS; return catOk && moved; } },
|
|
3082
3082
|
{ name: 'UR-0025 심층: _esc(HTML escape)→pure-utils 분리 + XSS 가드 (1.9.345)', run: () => { const m = require('../lib/pure-utils'); const work = m._esc('&<>"\'') === '&<>"'' && m._esc('<script>x</script>') === '<script>x</script>' && m._esc(null) === '' && m._esc(undefined) === '' && m._esc(42) === '42'; const moved = _esc === m._esc; return work && moved; } },
|
|
3083
3083
|
{ name: 'UR-0025 심층: _roadmapTokenStyles→pure-utils 분리 (1.9.346)', run: () => { const m = require('../lib/pure-utils'); const out = m._roadmapTokenStyles({ 'color.primary': '#2563eb' }, { 'color-surface': '#fff', 'custom': '#abc' }); const work = out.startsWith(':root {') && out.includes('--lr-primary: #2563eb') && out.includes('--lr-surface: #fff') && out.includes('--lr-custom: #abc') && out.includes('--lr-card-bg') && m._roadmapTokenStyles(null, null).startsWith(':root {'); const moved = _roadmapTokenStyles === m._roadmapTokenStyles; return work && moved; } },
|
|
3084
3084
|
{ name: 'UR-0025 심층: _parseSkillMd(SKILL.md frontmatter, BOM-aware)→pure-utils 분리 (1.9.347)', run: () => { const m = require('../lib/pure-utils'); const r = m._parseSkillMd('---\nname: s1\ndescription: "d1"\n---\nbody'); const work = r.meta.name === 's1' && r.meta.description === 'd1' && r.body === 'body' && m._parseSkillMd('---\nname: b\n---\nx').meta.name === 'b' && Object.keys(m._parseSkillMd('plain text').meta).length === 0 && m._parseSkillMd('plain text').body === 'plain text' && m._parseSkillMd(null).body === ''; const moved = _parseSkillMd === m._parseSkillMd; return work && moved; } },
|
|
3085
3085
|
{ name: 'UR-0059(외부리뷰 P0): --path 라우팅 일관화 — bare args[N]||cwd 제거 + arg(--path) wrap', run: () => { const src = read(__filename); const bare1 = '(args[1] ' + '|| process.cwd())'; const bare2 = '(args[2] ' + '|| process.cwd())'; const noBare = !src.includes(bare1) && !src.includes(bare2); const wrapped = src.includes('arg(' + "'--path', args[1] || process.cwd())") && src.includes('arg(' + "'--path', args[2] || process.cwd())"); const argDefault = arg('--definitely-not-real-xyz', 'SENT') === 'SENT'; return noBare && wrapped && argDefault; } },
|
|
3086
3086
|
{ name: 'UR-0061(외부리뷰 P1): roadmap CSS 값 살균 — :root/</style> breakout 차단', run: () => { const m = require('../lib/pure-utils'); const css = m._roadmapTokenStyles({ 'color.primary': 'red;}' + '</style><script>alert(1)</script>' }, {}); const blocked = !css.includes('<') && !css.includes('>'); const primaryLine = (css.split('\n').find(l => l.includes('--lr-primary')) || ''); const noBreakout = !primaryLine.replace(/;$/, '').includes('}'); const preserved = m._roadmapTokenStyles({ 'color.primary': '#2563eb' }, {}).includes('--lr-primary: #2563eb'); return blocked && noBreakout && preserved; } },
|
|
3087
|
-
{ name: 'UR-0060(외부리뷰 P1): SECRET_PATTERNS
|
|
3087
|
+
{ name: 'UR-0060(외부리뷰 P1): SECRET_PATTERNS 20종 (unquoted 보강) — GitLab/JWT/DB-URI/SendGrid/AWS-secret/Bearer 보강 + 오탐 가드', run: () => { const c = require('../lib/catalogs'); const hit = s => c.SECRET_PATTERNS.some(p => { p.re.lastIndex = 0; return p.re.test(s); }); const det = hit('glpat-' + 'x'.repeat(20)) && hit('eyJ' + 'x'.repeat(15) + '.eyJ' + 'y'.repeat(15) + '.' + 'z'.repeat(15)) && hit('postgres://u:p@host:5432/db') && hit('SG.' + 'x'.repeat(22) + '.' + 'y'.repeat(43)) && hit('aws_secret_access_key = "' + 'x'.repeat(40) + '"') && hit('Bearer ' + 'x'.repeat(25)); const clean = !hit('const u = "john' + '_doe_2024";') && !hit('https://example.com/path/to/page'); return c.SECRET_PATTERNS.length === 20 && det && clean; } },
|
|
3088
3088
|
{ name: 'UR-0068(외부리뷰 P2): _roadmapParseMilestones 블록 경계 — 다음 milestone status 누출 차단', run: () => { const m = require('../lib/pure-utils'); const r = m._roadmapParseMilestones('### M-0001. A\n\n### M-0002. B\nStatus: done\nProgress: 80%\n'); return r.length === 2 && r[0].status === 'planned' && r[0].progress === 0 && r[1].status === 'done' && r[1].progress === 80; } },
|
|
3089
3089
|
{ name: 'UR-0066(외부리뷰 P2): shell:true 주입 가드 — agents bench task _shellQuoteArg + fetchNpmLatest cmd.exe args', run: () => { const m = require('../lib/pure-utils'); const src = read(__filename); const benchQuoted = src.includes('const qTask = ' + '_shellQuoteArg(task)'); const npmSafe = /'\/d', '\/s', '\/c', 'npm', 'view'/.test(src); const q = m._shellQuoteArg('a & b'); const safe = (process.platform === 'win32' ? q === '"a & b"' : q === "'a & b'"); return benchQuoted && npmSafe && safe; } },
|
|
3090
3090
|
{ name: 'UR-0072(외부리뷰 P3): compareVer pre-release + _classifyCJK 한자 kana 귀속', run: () => { const m = require('../lib/pure-utils'); const verOk = m.compareVer('1.9.0-beta', '1.9.0') === -1 && m.compareVer('1.9.0', '1.9.0-beta') === 1 && m.compareVer('1.9.5', '1.9.5') === 0 && m.compareVer('1.9.6', '1.9.5') === 1; const jp = Buffer.from([0xE3, 0x81, 0x82, 0xE6, 0x97, 0xA5, 0xE6, 0x9C, 0xAC]); const cn = Buffer.from([0xE4, 0xB8, 0xAD, 0xE5, 0x9B, 0xBD]); const rj = m._classifyCJK(jp, jp.length); const rc = m._classifyCJK(cn, cn.length); const cjkOk = rj.japanese > rj.chinese && rc.chinese > 0 && rc.japanese === 0; return verOk && cjkOk; } },
|
|
@@ -3097,6 +3097,8 @@ function _selfTestCases() {
|
|
|
3097
3097
|
{ name: 'CV-1/UR-0076: arg() --path=값 파싱 + _resolveRoot(--path>positional>cwd) 행위', run: () => { if (typeof _resolveRoot !== 'function') return false; const save = process.argv; try { process.argv = ['node', 'h', 'context', '--path=/tmp/eqform']; const eq = arg('--path', null) === '/tmp/eqform'; process.argv = ['node', 'h', 'context', 'X', '--path', '/tmp/flag']; const flagWins = _resolveRoot('X') === '/tmp/flag'; process.argv = ['node', 'h', 'context', '/tmp/pos']; const posWins = _resolveRoot('/tmp/pos') === '/tmp/pos'; process.argv = ['node', 'h', 'context']; const cwdFb = _resolveRoot(undefined) === process.cwd(); return eq && flagWins && posWins && cwdFb; } finally { process.argv = save; } } },
|
|
3098
3098
|
{ name: 'CV-4/UR-0079: _pruneArchives archive retention (최신 keep 유지, 오래된 prune) 행위', run: () => { if (typeof _pruneArchives !== 'function') return false; const tmp = fs.mkdtempSync(path.join(os.tmpdir(), '__leerness_prune_')); try { const adir = path.join(tmp, '.harness', 'archive'); fs.mkdirSync(adir, { recursive: true }); for (let i = 0; i < 5; i++) fs.mkdirSync(path.join(adir, 'leerness-1.9.' + i + '-stamp')); const pruned = _pruneArchives(tmp, 2); const left = fs.readdirSync(adir).filter(n => /^leerness-/.test(n)).length; return pruned === 3 && left === 2; } finally { try { fs.rmSync(tmp, { recursive: true, force: true }); } catch {} } } },
|
|
3099
3099
|
{ name: 'CV-7/UR-0082: commands 카탈로그 + help 에 누락 명령군 등재 (표면 drift 가드)', run: () => { const src = read(__filename); const ci = src.indexOf('function commandsCmd'); const hi = src.indexOf('function help('); if (ci < 0 || hi < 0) return false; const cbody = src.slice(ci, ci + 8000); const hbody = src.slice(hi, hi + 7000); const must = ['install-safety', 'feature add', 'creds list', 'incident list', 'webhook serve', 'deploy auto', 'runs list', 'permissions list', 'whats-new', 'migrate audit']; return must.every(c => cbody.includes(c)) && hbody.includes('install-safety') && hbody.includes('feature add'); } },
|
|
3100
|
+
{ name: 'UR-0083(4th외부평가 9.3): auto-update hook 비침투 (update --quiet 모드 + hook --check --quiet + 업그레이드)', run: () => { const src = read(__filename); const quietMode = /const quiet = !!opts\.quiet \|\| has\('--quiet'\)/.test(src); const hookQuiet = src.includes("command: 'leerness update --check --quiet'"); const upgrade = /includes\('leerness update --check'\) && !h\.command\.includes\('--quiet'\)/.test(src); return quietMode && hookQuiet && upgrade; } },
|
|
3101
|
+
{ name: 'CV-6/UR-0081: 시크릿 스캐너 FP/FN — _isPlaceholderSecret + _looksSecretLike 행위', run: () => { if (typeof _isPlaceholderSecret !== 'function' || typeof _looksSecretLike !== 'function') return false; const fp = _isPlaceholderSecret('change-me') && _isPlaceholderSecret('your-api-key-here') && _isPlaceholderSecret('<token>') && _isPlaceholderSecret('') && !_isPlaceholderSecret('hunter2realpass'); const fn = _looksSecretLike('secret123') && _looksSecretLike('a'.repeat(24)) && !_looksSecretLike('processEnv') && !_looksSecretLike('reqBodyPassword'); return fp && fn; } },
|
|
3100
3102
|
{ name: 'VERSION 형식 (x.y.z)', run: () => /^\d+\.\d+\.\d+$/.test(VERSION) }
|
|
3101
3103
|
];
|
|
3102
3104
|
}
|
|
@@ -7305,6 +7307,24 @@ function* walk(root, base = root, depth = 0, extras = null) {
|
|
|
7305
7307
|
else yield p;
|
|
7306
7308
|
}
|
|
7307
7309
|
}
|
|
7310
|
+
// 1.9.365 (외부리뷰 CV-6/UR-0081): 간이 .gitignore 매칭 — gitignored 파일(.env 계열)의 시크릿은 커밋 제외(설계상 안전) → 실패 대신 info.
|
|
7311
|
+
// full gitignore semantics 아님 (정확매칭/.env-family/*.ext/dir/ 만). 미스 시 안전측(커밋됨으로 간주).
|
|
7312
|
+
function _isLikelyGitignored(root, fileRel) {
|
|
7313
|
+
let gi;
|
|
7314
|
+
try { gi = read(path.join(root, '.gitignore')); } catch { return false; }
|
|
7315
|
+
const relPosix = String(fileRel).replace(/\\/g, '/');
|
|
7316
|
+
const base = relPosix.split('/').pop();
|
|
7317
|
+
for (let pat of gi.split(/\r?\n/)) {
|
|
7318
|
+
pat = pat.trim();
|
|
7319
|
+
if (!pat || pat.startsWith('#') || pat.startsWith('!')) continue;
|
|
7320
|
+
const p = pat.replace(/^\/+|\/+$/g, '');
|
|
7321
|
+
if (p === relPosix || p === base) return true;
|
|
7322
|
+
if (pat === '.env' && /^\.env(\.|$)/.test(base)) return true; // .env 관행상 .env.* 도 보호
|
|
7323
|
+
if (p.startsWith('*.') && base.endsWith(p.slice(1))) return true;
|
|
7324
|
+
if (pat.endsWith('/') && (relPosix === p || relPosix.startsWith(p + '/'))) return true;
|
|
7325
|
+
}
|
|
7326
|
+
return false;
|
|
7327
|
+
}
|
|
7308
7328
|
function scanSecrets(root) {
|
|
7309
7329
|
root = absRoot(root);
|
|
7310
7330
|
const findings = [];
|
|
@@ -7320,22 +7340,35 @@ function scanSecrets(root) {
|
|
|
7320
7340
|
const fileRel = (file === root) ? path.basename(file) : rel(root, file); // 1.9.354 (UR-0072): 단일 파일 스캔 시 basename 표시('.' 방지)
|
|
7321
7341
|
// 1.9.350 (UR-0060 외부리뷰): leerness 자기 harness.js(regex 소스) + 생성 secret-policy 템플릿만 제외 — 정확 경로(사용자 파일명 substring false-negative 제거)
|
|
7322
7342
|
if (path.resolve(file) === path.resolve(__filename) || /(^|[\\/])\.(?:harness|leerness)[\\/]secret-policy\.md$/.test(fileRel)) continue;
|
|
7323
|
-
|
|
7343
|
+
const gitignored = _isLikelyGitignored(root, fileRel); // 1.9.365 CV-6: gitignored 면 발견을 info 로 강등
|
|
7344
|
+
for (const { name, re, valueGroup, requireSecretLike } of SECRET_PATTERNS) {
|
|
7324
7345
|
re.lastIndex = 0;
|
|
7325
7346
|
let m;
|
|
7326
7347
|
while ((m = re.exec(text))) {
|
|
7348
|
+
// 1.9.365 (CV-6/UR-0081): assignment 패턴 값이 placeholder/예시면 오탐 → 스킵(같은 패턴 계속 탐색).
|
|
7349
|
+
if (valueGroup != null) {
|
|
7350
|
+
const val = m[valueGroup];
|
|
7351
|
+
if (_isPlaceholderSecret(val)) { if (re.lastIndex === m.index) re.lastIndex++; continue; }
|
|
7352
|
+
if (requireSecretLike && !_looksSecretLike(val)) { if (re.lastIndex === m.index) re.lastIndex++; continue; }
|
|
7353
|
+
}
|
|
7327
7354
|
const line = text.slice(0, m.index).split('\n').length;
|
|
7328
|
-
findings.push({ file: fileRel, line, name, snippet: m[0].slice(0, 32) });
|
|
7355
|
+
findings.push({ file: fileRel, line, name, snippet: m[0].slice(0, 32), gitignored });
|
|
7329
7356
|
break;
|
|
7330
7357
|
}
|
|
7331
7358
|
}
|
|
7332
7359
|
}
|
|
7333
|
-
|
|
7334
|
-
|
|
7335
|
-
|
|
7360
|
+
// 1.9.365 (CV-6/UR-0081): gitignored(.env 등 설계상 안전 보관) 발견은 info, 커밋되는 파일 발견만 실패.
|
|
7361
|
+
const committed = findings.filter(f => !f.gitignored);
|
|
7362
|
+
const ignored = findings.filter(f => f.gitignored);
|
|
7363
|
+
if (committed.length) {
|
|
7364
|
+
fail(`secret patterns found: ${committed.length}`);
|
|
7365
|
+
committed.forEach(f => log(` ${f.file}:${f.line} ${f.name} ${f.snippet}…`));
|
|
7336
7366
|
process.exitCode = 1;
|
|
7337
7367
|
} else {
|
|
7338
|
-
ok('no obvious secret patterns');
|
|
7368
|
+
ok('no obvious secret patterns (커밋 대상)');
|
|
7369
|
+
}
|
|
7370
|
+
if (ignored.length) {
|
|
7371
|
+
log(` ⓘ gitignored ${ignored.length}건 (커밋 제외 — 설계상 안전 보관, 비실패): ${[...new Set(ignored.map(f => f.file))].join(', ')}`);
|
|
7339
7372
|
}
|
|
7340
7373
|
}
|
|
7341
7374
|
|
|
@@ -15209,26 +15242,29 @@ function fetchNpmLatest(pkg) {
|
|
|
15209
15242
|
|
|
15210
15243
|
async function updateCmd(root, opts = {}) {
|
|
15211
15244
|
root = absRoot(root);
|
|
15245
|
+
// 1.9.364 (4번째 외부평가 9.3 + Codex CV-2 후속): --quiet — SessionStart hook 비침투화.
|
|
15246
|
+
// up-to-date 시 무음, 업데이트 가능 시에만 1줄 통지 (매 세션 노이즈 제거). hook 명령이 이 모드를 사용.
|
|
15247
|
+
const quiet = !!opts.quiet || has('--quiet');
|
|
15212
15248
|
const verF = path.join(root, '.harness/HARNESS_VERSION');
|
|
15213
15249
|
const cur = exists(verF) ? parseHarnessVersion(read(verF)) : { plus: null, base: null, raw: '(not installed)' };
|
|
15214
|
-
log(`# leerness update`);
|
|
15215
|
-
log(`Current: ${cur.raw}`);
|
|
15250
|
+
if (!quiet) log(`# leerness update`);
|
|
15251
|
+
if (!quiet) log(`Current: ${cur.raw}`);
|
|
15216
15252
|
const fromTar = arg('--from', null);
|
|
15217
15253
|
const cacheHours = opts.checkOnly ? 24 : 0;
|
|
15218
15254
|
let nextLeerness = VERSION;
|
|
15219
|
-
if (fromTar) log(`Local tarball mode: ${fromTar}`);
|
|
15255
|
+
if (fromTar) { if (!quiet) log(`Local tarball mode: ${fromTar}`); }
|
|
15220
15256
|
else {
|
|
15221
15257
|
const cached = readUpdateCache(root);
|
|
15222
15258
|
if (cacheFresh(cached, cacheHours)) {
|
|
15223
15259
|
nextLeerness = cached.nextLeerness || VERSION;
|
|
15224
|
-
log(`(cached ${Math.round((Date.now() - cached.at) / 60000)}m ago)`);
|
|
15225
|
-
log(`npm leerness latest: ${cached.nextLeerness || '(unavailable)'}`);
|
|
15260
|
+
if (!quiet) log(`(cached ${Math.round((Date.now() - cached.at) / 60000)}m ago)`);
|
|
15261
|
+
if (!quiet) log(`npm leerness latest: ${cached.nextLeerness || '(unavailable)'}`);
|
|
15226
15262
|
} else {
|
|
15227
|
-
log('Checking npm registry…');
|
|
15263
|
+
if (!quiet) log('Checking npm registry…');
|
|
15228
15264
|
const latest = await fetchNpmLatest('leerness');
|
|
15229
15265
|
nextLeerness = latest || VERSION;
|
|
15230
15266
|
writeUpdateCache(root, { nextLeerness: latest, runningCli: VERSION });
|
|
15231
|
-
log(`npm leerness latest: ${latest || '(unavailable, using running CLI ' + VERSION + ')'}`);
|
|
15267
|
+
if (!quiet) log(`npm leerness latest: ${latest || '(unavailable, using running CLI ' + VERSION + ')'}`);
|
|
15232
15268
|
}
|
|
15233
15269
|
}
|
|
15234
15270
|
// What is "current"? canonical=base; legacy plus also rolls into leerness 1.9.0+
|
|
@@ -15242,6 +15278,7 @@ async function updateCmd(root, opts = {}) {
|
|
|
15242
15278
|
if (compareVer(nextLeerness, '1.9.0') >= 0) { needsMigrate = true; reason = 'consolidate legacy plus@ marker into canonical'; }
|
|
15243
15279
|
}
|
|
15244
15280
|
if (opts.checkOnly) {
|
|
15281
|
+
if (quiet) { if (needsMigrate) log(`↑ leerness 업데이트 가능: ${reason} — leerness update --yes`); return; } // up-to-date 시 무음
|
|
15245
15282
|
if (needsMigrate) log(`\n→ migration available: ${reason}`);
|
|
15246
15283
|
else log('\n→ up to date');
|
|
15247
15284
|
return;
|
|
@@ -15282,22 +15319,26 @@ function autoUpdateInstall(root) {
|
|
|
15282
15319
|
if (exists(settingsFile)) { try { settings = JSON.parse(read(settingsFile)); } catch {} }
|
|
15283
15320
|
settings.hooks = settings.hooks || {};
|
|
15284
15321
|
// 1.9.1 P1: legacy 'leerness-plus update' hook 자동 제거 (이전 fork 시절 잔재).
|
|
15285
|
-
let removedLegacy = 0;
|
|
15322
|
+
let removedLegacy = 0, upgradedQuiet = 0;
|
|
15286
15323
|
settings.hooks.SessionStart = (settings.hooks.SessionStart || []).filter(h => {
|
|
15287
15324
|
if (h && h.command && /\bleerness-plus update\b/.test(h.command)) { removedLegacy++; return false; }
|
|
15325
|
+
// 1.9.364 (4번째 외부평가 9.3): 비-quiet 'leerness update --check' 를 quiet 버전으로 업그레이드 (기존 설치 매세션 노이즈 제거)
|
|
15326
|
+
if (h && h.command && h.command.includes('leerness update --check') && !h.command.includes('--quiet')) { upgradedQuiet++; return false; }
|
|
15288
15327
|
return true;
|
|
15289
15328
|
});
|
|
15290
15329
|
if (!settings.hooks.SessionStart.some(h => h.command && h.command.includes('leerness update'))) {
|
|
15291
|
-
settings.hooks.SessionStart.push({ matcher: '*', command: 'leerness update --check' });
|
|
15330
|
+
settings.hooks.SessionStart.push({ matcher: '*', command: 'leerness update --check --quiet' });
|
|
15292
15331
|
}
|
|
15293
15332
|
writeUtf8(settingsFile, JSON.stringify(settings, null, 2) + '\n');
|
|
15294
15333
|
writeUtf8(path.join(root, '.claude/commands/update.md'),
|
|
15295
15334
|
`# /update\n\nleerness 자동 업데이트 (감지 → 마이그레이션 → 검증).\n\n\`\`\`\n!leerness update --yes\n\`\`\`\n\n체크만:\n\n\`\`\`\n!leerness update --check\n\`\`\`\n`);
|
|
15296
15335
|
ok('auto-update SessionStart hook installed (.claude/settings.local.json)');
|
|
15297
15336
|
if (removedLegacy) ok(`legacy hook 제거: ${removedLegacy}건 (leerness-plus → leerness 통합)`);
|
|
15337
|
+
if (upgradedQuiet) ok(`hook 업그레이드: ${upgradedQuiet}건 → --quiet (up-to-date 시 무음, 1.9.364)`);
|
|
15298
15338
|
ok('/update slash command added');
|
|
15299
15339
|
// 1.9.272 (GPT-5.5 외부 리뷰 반영): hook 설치 투명성 — 무엇을/왜/어떻게 끄는지 명시.
|
|
15300
|
-
|
|
15340
|
+
// 1.9.364 (4번째 외부평가 9.3): 비침투 — 세션 시작 시 --quiet 로 up-to-date 면 아무 출력 없음, 업데이트 가능 시에만 1줄.
|
|
15341
|
+
log(` ⓘ 이 hook 은 Claude Code 세션 시작 시 \`leerness update --check --quiet\` 를 1회 실행합니다 (최신이면 무음, 업데이트 가능 시에만 1줄 통지 · 자동 설치는 안 함).`);
|
|
15301
15342
|
log(` ⓘ 제거: ${rel(root, settingsFile)} 의 hooks.SessionStart 항목 삭제 · 설치 시 끄기: leerness init . --no-auto-update`);
|
|
15302
15343
|
}
|
|
15303
15344
|
|
package/lib/catalogs.js
CHANGED
|
@@ -376,7 +376,9 @@ const SECRET_PATTERNS = [
|
|
|
376
376
|
{ name: 'Google OAuth token', re: /\bya29\.[A-Za-z0-9_-]{20,}/g },
|
|
377
377
|
{ name: 'Slack token', re: /\bxox[baprs]-[A-Za-z0-9-]{10,}\b/g },
|
|
378
378
|
{ name: 'Generic private key', re: /-----BEGIN (?:RSA |OPENSSH |EC |DSA |PGP )?PRIVATE KEY-----/g },
|
|
379
|
-
{ name: 'Hardcoded password assignment', re: /\b(?:password|passwd|pwd|secret|api_key|apikey)\s*[:=]\s*["'][^"'\s]{6,}["']/gi },
|
|
379
|
+
{ name: 'Hardcoded password assignment', re: /\b(?:password|passwd|pwd|secret|api_key|apikey)\s*[:=]\s*["']([^"'\s]{6,})["']/gi, valueGroup: 1 }, // 1.9.365 CV-6: valueGroup → placeholder 오탐 억제
|
|
380
|
+
// 1.9.365 (외부리뷰 CV-6/UR-0081): unquoted 자격증명 (KEY=secret123) FN 보강. 값이 시크릿스러운지(_looksSecretLike) + placeholder 아닌지 후처리. 코드 var-ref(점 포함)는 charset 으로 제외.
|
|
381
|
+
{ name: 'Hardcoded credential (unquoted)', re: /\b(?:password|passwd|pwd|secret|secret_key|api_key|apikey|access_key|access_token|auth_token)\s*=\s*([A-Za-z0-9_\-/+]{8,})(?=[\s;,)]|$)/gi, valueGroup: 1, requireSecretLike: true },
|
|
380
382
|
// 1.9.350 (UR-0060 외부리뷰 3모델): 누락 패턴 보강
|
|
381
383
|
{ name: 'GitLab PAT', re: /\bglpat-[A-Za-z0-9_-]{20,}\b/g },
|
|
382
384
|
{ name: 'JWT', re: /\beyJ[A-Za-z0-9_-]{10,}\.eyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\b/g },
|
package/lib/pure-utils.js
CHANGED
|
@@ -615,8 +615,29 @@ function _renderDecisionsMd(decisions) {
|
|
|
615
615
|
return preamble + body;
|
|
616
616
|
}
|
|
617
617
|
|
|
618
|
+
// 1.9.365 (외부리뷰 CV-6/UR-0081): 시크릿 스캐너 오탐(FP) 억제 — 명백한 placeholder/예시 값은 시크릿 아님.
|
|
619
|
+
// assignment 패턴(secret/api_key = VALUE)의 VALUE 에만 적용 (provider 형식 키엔 미적용 → FN 방지).
|
|
620
|
+
function _isPlaceholderSecret(value) {
|
|
621
|
+
if (value == null) return true;
|
|
622
|
+
let v = String(value).trim().replace(/^["']|["']$/g, '').trim().toLowerCase();
|
|
623
|
+
if (!v) return true;
|
|
624
|
+
// 전체가 placeholder 토큰
|
|
625
|
+
if (/^(?:x{3,}|\*{3,}|\.{3,}|-+|0+|1234567890?|12345678|abc123|secret|password|passwd|changeme|change[-_]me|replace[-_]?me|placeholder|example|examples?|sample|dummy|test|testing|foo|bar|baz|tbd|todo|none|null|undefined|nil|empty|redacted|hidden|value|string|here)$/.test(v)) return true;
|
|
626
|
+
// 부분 placeholder 신호
|
|
627
|
+
if (v.includes('example') || v.includes('placeholder') || v.includes('change-me') || v.includes('changeme') || v.includes('replace-me') || v.includes('your-') || v.includes('your_') || v.includes('my-secret') || v.includes('xxxx') || v.includes('<') || v.includes('${') || v.includes('{{')) return true;
|
|
628
|
+
return false;
|
|
629
|
+
}
|
|
630
|
+
// 1.9.365 (외부리뷰 CV-6/UR-0081): unquoted assignment 값이 '시크릿스러운지' 판정 — 코드 식별자 오탐 억제용.
|
|
631
|
+
// 숫자 포함 8+ 또는 24+ 만 시크릿 후보 (camelCase 식별자 같은 무-숫자 단어는 제외).
|
|
632
|
+
function _looksSecretLike(value) {
|
|
633
|
+
const v = String(value || '');
|
|
634
|
+
if (!v) return false;
|
|
635
|
+
return (/\d/.test(v) && v.length >= 8) || v.length >= 24;
|
|
636
|
+
}
|
|
637
|
+
|
|
618
638
|
module.exports = {
|
|
619
639
|
_isSecretKey, compareVer, parseHarnessVersion,
|
|
640
|
+
_isPlaceholderSecret, _looksSecretLike,
|
|
620
641
|
_classifyCJK, _riskLabel, _detectSystemLang, _parseSlashFromHelp,
|
|
621
642
|
// 1.9.283 (UR-0025 2단계)
|
|
622
643
|
PERMISSION_TIERS, _tierRank, _requiredTier, _policyAllows, _resolveNpmTag, _mcpJsonContent, _newRunRecord,
|
package/package.json
CHANGED
package/scripts/e2e.js
CHANGED
|
@@ -4434,7 +4434,7 @@ total++;
|
|
|
4434
4434
|
const c = require(path.resolve(__dirname, '..', 'lib', 'catalogs.js'));
|
|
4435
4435
|
const A = 'A'.repeat(40);
|
|
4436
4436
|
const hit = (s) => c.SECRET_PATTERNS.some(p => { p.re.lastIndex = 0; return p.re.test(s); });
|
|
4437
|
-
const catOk = Array.isArray(c.SECRET_PATTERNS) && c.SECRET_PATTERNS.length ===
|
|
4437
|
+
const catOk = Array.isArray(c.SECRET_PATTERNS) && c.SECRET_PATTERNS.length === 20
|
|
4438
4438
|
&& hit('AKIA' + 'ABCD1234EFGH5678') && hit('sk-' + 'ant-api03-' + A + '_' + A) && !hit('const u = "john' + '_doe_2024";');
|
|
4439
4439
|
const harnessSrc = fs.readFileSync(path.resolve(__dirname, '..', 'bin', 'harness.js'), 'utf8');
|
|
4440
4440
|
const _catImp = (harnessSrc.match(/const \{[\s\S]*?\} = require\('\.\.\/lib\/catalogs'\)/) || [''])[0]; // import 순서/추가 비의존
|
|
@@ -4957,5 +4957,52 @@ total++;
|
|
|
4957
4957
|
if (!ok) failed++;
|
|
4958
4958
|
}
|
|
4959
4959
|
|
|
4960
|
+
// 1.9.364 회귀 (4번째 외부평가 9.3/UR-0083): auto-update hook 비침투 — update --check --quiet 가 up-to-date 시 무음 + hook 명령이 --quiet 사용
|
|
4961
|
+
total++;
|
|
4962
|
+
{
|
|
4963
|
+
let ok = false;
|
|
4964
|
+
try {
|
|
4965
|
+
const d = fs.mkdtempSync(path.join(os.tmpdir(), 'leerness-quiet-'));
|
|
4966
|
+
cp.spawnSync(process.execPath, [CLI, 'init', d, '--yes', '--language', 'ko'], { encoding: 'utf8', timeout: 30000 });
|
|
4967
|
+
// up-to-date(방금 init한 현재 버전) → --check --quiet 는 무음
|
|
4968
|
+
const r = cp.spawnSync(process.execPath, [CLI, 'update', d, '--check', '--quiet'], { encoding: 'utf8', timeout: 30000 });
|
|
4969
|
+
const silent = (r.stdout || '').trim() === '' && r.status === 0;
|
|
4970
|
+
// 설치된 SessionStart hook 명령이 --quiet 사용
|
|
4971
|
+
const settings = JSON.parse(fs.readFileSync(path.join(d, '.claude', 'settings.local.json'), 'utf8'));
|
|
4972
|
+
const hookQuiet = (settings.hooks.SessionStart || []).some(h => h.command && h.command.includes('update --check --quiet'));
|
|
4973
|
+
fs.rmSync(d, { recursive: true, force: true });
|
|
4974
|
+
ok = silent && hookQuiet;
|
|
4975
|
+
} catch {}
|
|
4976
|
+
console.log(ok ? '✓ B(1.9.364) 4th외부평가: auto-update hook 비침투 (update --check --quiet 무음 + hook --quiet) (UR-0083)' : '✗ auto-update 비침투 실패');
|
|
4977
|
+
if (!ok) failed++;
|
|
4978
|
+
}
|
|
4979
|
+
|
|
4980
|
+
// 1.9.365 회귀 (외부리뷰 CV-6/UR-0081): 시크릿 스캐너 정밀도 — placeholder FP 무시 / unquoted FN 탐지 / gitignored 강등
|
|
4981
|
+
total++;
|
|
4982
|
+
{
|
|
4983
|
+
let ok = false;
|
|
4984
|
+
try {
|
|
4985
|
+
const d = fs.mkdtempSync(path.join(os.tmpdir(), 'leerness-sec-'));
|
|
4986
|
+
fs.mkdirSync(path.join(d, 'src'), { recursive: true });
|
|
4987
|
+
// ① placeholder 만 → 커밋 대상 finding 없음 (exit 0)
|
|
4988
|
+
fs.writeFileSync(path.join(d, 'src', 'a.js'), 'const x = { secret: "change-me", apiKey: "your-key-here" };\n');
|
|
4989
|
+
const r1 = cp.spawnSync(process.execPath, [CLI, 'scan', 'secrets', path.join(d, 'src', 'a.js')], { encoding: 'utf8', timeout: 15000 });
|
|
4990
|
+
const fpOk = r1.status === 0 && /no obvious/.test(r1.stdout || '');
|
|
4991
|
+
// ② unquoted 실제 시크릿 → 탐지 (exit 1)
|
|
4992
|
+
fs.writeFileSync(path.join(d, 'src', 'b.txt'), 'password=hunter2realsecret\n');
|
|
4993
|
+
const r2 = cp.spawnSync(process.execPath, [CLI, 'scan', 'secrets', path.join(d, 'src', 'b.txt')], { encoding: 'utf8', timeout: 15000 });
|
|
4994
|
+
const fnOk = r2.status === 1 && /unquoted/.test(r2.stdout || '');
|
|
4995
|
+
// ③ gitignored(.env+src/) → 커밋 대상 0 → exit 0 + gitignored info
|
|
4996
|
+
fs.writeFileSync(path.join(d, '.gitignore'), '.env\nsrc/\n');
|
|
4997
|
+
fs.writeFileSync(path.join(d, '.env'), 'TOKEN=npm_abcdefghijklmnopqrstuvwxyz0123456789\n');
|
|
4998
|
+
const r3 = cp.spawnSync(process.execPath, [CLI, 'scan', 'secrets', d], { encoding: 'utf8', timeout: 20000 });
|
|
4999
|
+
const giOk = r3.status === 0 && /gitignored/.test(r3.stdout || '');
|
|
5000
|
+
fs.rmSync(d, { recursive: true, force: true });
|
|
5001
|
+
ok = fpOk && fnOk && giOk;
|
|
5002
|
+
} catch {}
|
|
5003
|
+
console.log(ok ? '✓ B(1.9.365) CV-6: 시크릿 스캐너 FP(placeholder)/FN(unquoted)/gitignored 강등 (UR-0081)' : '✗ 시크릿 스캐너 정밀도 실패');
|
|
5004
|
+
if (!ok) failed++;
|
|
5005
|
+
}
|
|
5006
|
+
|
|
4960
5007
|
console.log(`\nE2E result: ${total - failed}/${total} passed · ${((Date.now() - _e2eStart) / 1000).toFixed(0)}s`);
|
|
4961
5008
|
if (failed > 0) process.exit(1);
|