feat(ci): storeId の完全性検査を強化 (notedeck#913 前提) - #40
Conversation
notedeck#913 で storeId(レジストリのディレクトリ名)がローカル同一性の
正準リンクになるため、check-registry-integrity.mjs に 4 検査を追加:
- skills も frontmatter の id = ディレクトリ名を強制
(skills だけ S11 検査をスキップしており乗っ取り経路が残っていた)
- 全 kind 横断の ID 重複検査(storeId はレジストリ全体で一意)
- テーマ内部 ID(theme.json5 の id)の一意性検査(欠損は現状どおり許容)
- storeId 形式検査: ^[a-z0-9-]{1,48}$ かつ Windows 予約デバイス名でない
現行レジストリ実データは全項目 pass を確認済み。
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
📝 WalkthroughWalkthroughThe registry integrity checker now validates store ID formats, reserved names, cross-kind uniqueness, skill frontmatter IDs, and theme-internal IDs. Registry documentation describes these rules, and security documentation lists the expanded CI checks. ChangesRegistry integrity validation
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant CI
participant RegistryChecker
participant RegistryItems
participant ThemeSources
CI->>RegistryChecker: Run integrity checks
RegistryChecker->>RegistryItems: Validate directory, metadata, and frontmatter IDs
RegistryItems-->>RegistryChecker: Return collected item IDs
RegistryChecker->>ThemeSources: Parse theme.json5 files
ThemeSources-->>RegistryChecker: Return theme IDs
RegistryChecker-->>CI: Report format, consistency, parse, and duplicate errors
Possibly related PRs
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ✅ Deployment successful! View logs |
misstore | bb47ef7 | Aug 11 2026, 10:08 PM |
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 `@scripts/check-registry-integrity.mjs`:
- Around line 172-181: Validate the parsed result in the theme-loading flow
before accessing theme.id: when JSON5.parse returns null, an array, or any
primitive rather than an object, add an integrity error and skip ID processing.
Keep the existing parse-error handling and only execute the themeInternalIds
logic for object values.
🪄 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: 1e2f7279-2d65-4861-a7e3-60665fc9d22b
📒 Files selected for processing (3)
docs/design/security.mddocs/registry-format.mdscripts/check-registry-integrity.mjs
| let theme | ||
| try { | ||
| theme = JSON5.parse(readFileSync(sourcePath, 'utf-8')) | ||
| } catch { | ||
| errors.push(`[${label}] theme.json5 が JSON5 として解釈できない`) | ||
| theme = {} | ||
| } | ||
| if (theme.id != null) { | ||
| if (!themeInternalIds.has(theme.id)) themeInternalIds.set(theme.id, []) | ||
| themeInternalIds.get(theme.id).push(id) |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Trace top-level theme parsing and subsequent property access.
rg -n -C 10 'JSON5\.parse|theme\.id|themeData' \
scripts/check-registry-integrity.mjs scripts/build-registry.js
# Confirm that the JSON5 grammar accepts null as a value.
curl -fsSL https://spec.json5.org/ | rg -n -i -C 2 'null|JSON5Value'Repository: notedeck-dev/misstore
Length of output: 23721
🏁 Script executed:
#!/bin/bash
set -euo pipefail
# Inspect the checker control flow and its command entry point.
sed -n '1,230p' scripts/check-registry-integrity.mjs
printf '\n--- package scripts ---\n'
rg -n -C 3 'check-registry-integrity|build-registry' package.json README.md .github 2>/dev/null || true
# Probe the relevant JavaScript property-access behavior without executing repository code.
node - <<'JS'
for (const theme of [null, [], {}, 'text', 0, false]) {
try {
console.log(JSON.stringify({ value: theme, id: theme.id, outcome: 'no throw' }))
} catch (error) {
console.log(JSON.stringify({ value: theme, outcome: error.name, message: error.message }))
}
}
JSRepository: notedeck-dev/misstore
Length of output: 8526
非 object の theme.json5 をエラーとして処理してください。
JSON5.parse はトップレベルの null、配列、プリミティブ値を受理します。null の場合、theme.id が TypeError を発生させ、CI チェックが終了します。
トップレベル値が object でない場合は integrity error を追加し、theme.id を参照しないでください。
🤖 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 `@scripts/check-registry-integrity.mjs` around lines 172 - 181, Validate the
parsed result in the theme-loading flow before accessing theme.id: when
JSON5.parse returns null, an array, or any primitive rather than an object, add
an integrity error and skip ID processing. Keep the existing parse-error
handling and only execute the themeInternalIds logic for object values.
なぜ
notedeck-dev/notedeck#913(設定ファイル名と表示名の分離)は storeId(レジストリのディレクトリ名)をローカル同一性の正準リンクにする設計で、その前提としてレジストリ側の機械保証 4 点が必要(詳細は notedeck#913 の仕様確定版コメント)。
何を
check-registry-integrity.mjsに検査 4 点を追加:id= ディレクトリ名の強制 — 従来 skills だけ検証がスキップされており、ID を偽った配布物による既存スキル乗っ取りの経路だった^[a-z0-9-]{1,48}$かつ Windows 予約デバイス名でない現行実データは全項目 pass(174 エントリ、違反ゼロ)。一時フィクスチャで 4 検査すべての発火を確認済み。docs(registry-format / security)も追随。
🤖 Generated with Claude Code
Summary by CodeRabbit
Bug Fixes
Documentation