test(e2e): Phase D 敵対的パック (AI 一括投入検出 + proof 偽造) + insertParagraph 検出漏れ修正 - #118
Merged
Conversation
Phase D の敵対的 E2E で、AI が executeEdits で「コード全体を 1 編集で一気に投入」すると Monaco が insertParagraph で記録し、従来の bulk 検出 (insertText/insertReplacementText/ replaceContent のみ対象) を素通りして Pure Typing: YES のまま見逃す穴が判明した。 - structuralEdit: EDITOR_INTERNAL_INSERT に insertParagraph を追加。空白のみ (auto-indent) は benign、コードを含めば bulk。 - 内部ペースト (自分のコードのコピペ = 許可) の実挿入も複数行なら insertParagraph になり AI 一括投入と区別できないため、insertFromInternalPaste 監査マーカーと同一内容を許可リスト化 する isFlaggedBulkInsert / collectInternalPasteContents を新設し、verification / processSummary / pureTypingAnalyzer の 3 経路で内部ペーストを除外。 - isPureTyping は複数行 bulk でも崩れるよう導出を更新 (insertParagraph は従来 suspicious 判定に載らないため)。bulkInsertEvents の申告メタデータ照合は不変で後方互換。valid 不変。 editor/main.ts: dev 限定テストフック __tcTestInsertBlock (executeEdits で単一編集の複数行 投入を再現)。通常のキー入力 API では Monaco が 1 文字ずつに分解し再現できないため。 import.meta.env.DEV ガードで本番ビルドからは除去される。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- ai-bulk-insert: Copilot/snippet 相当の単一編集での複数行コード投入を再現し、proof に 痕跡が残り Pure Typing: NO / 外部入力 / bulk insertion として検出されることを実証。 対照として同じコードの打鍵は Pure Typing: YES (一括投入と区別される) を確認。 この経路で insertParagraph 検出漏れを発見・修正した (別コミット)。 - proof-forgery: export 済み proof への 5 種の偽造 (nonce/fingerprint 改ざん、イベント 複製=リプレイ、順序入替=切り貼り、末尾切り詰め) を verify-cli がすべて exit 1 で拒否 することを確認 (1 回の export に複数偽造を適用)。 app.ts: injectCodeBlock (dev フック __tcTestInsertBlock 経由で executeEdits を 1 回適用)。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
6 種の偽造はすべて root/チェーン/メタの破綻で PoSW 無関係なため fast (改ざん耐性のみ) で 検出できる。CI ランナーで full PoSW 再計算を 6 回直列実行すると test timeout (300s) を 超えていた (8 分超 × retry) ため fast に切替。ローカル 2.1m→20s。 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
🚀 Preview Deployment
Deployed from commit ee5bce8 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概要
E2E ハーネス Phase D。敵対的シナリオ (AI コード一括投入の検出 / proof 偽造の負のオラクル) を追加し、AI 一括投入の検出漏れを発見・修正した。
🐛 発見・修正した検出漏れ (重要)
Copilot/Cursor が「コード全体を 1 編集で一気に投入」すると検出を素通りしていた (
fix(shared))。AI が
executeEditsで複数行コードを 1 編集で投入すると Monaco はinsertParagraphで記録する。Phase A の bulk 検出はinsertText/insertReplacementText/replaceContentのみを対象にしていたため、この insertParagraph 経路を素通りし、Pure Typing: YES のまま AI 一括投入を見逃していた。Phase D の敵対的 E2E で発覚。修正:
insertParagraphを bulk 検出対象に追加。空白のみ (auto-indent) は benign、コードを含めば bulk。insertFromInternalPaste監査マーカーと同一内容を許可リスト化して 3 経路 (verification / processSummary / pureTypingAnalyzer) で除外。isPureTypingを複数行 bulk でも崩すよう更新。bulkInsertEvents申告メタデータ照合・valid(暗号的合否) は不変で後方互換。E2E シナリオ (Phase D: 3本・全 green。累計 16本 green)
インフラ
__tcTestInsertBlockを追加 (executeEdits で単一編集の複数行投入を再現)。通常のキー入力 API では Monaco が 1 文字ずつに分解し再現できないため。import.meta.env.DEVガードで本番ビルドからは除去される。テスト
🤖 Generated with Claude Code