refactor: dedupe managers, fix pointer/search bugs, harden server#30
Merged
Conversation
Refactoring - Add internal/poller.Pool and back Freezer/Watcher/AlertWatcher with it, removing ~150 lines of duplicated map+stop-channel+ticker boilerplate. - Collapse server handler decode/validate/error boilerplate behind generic decodeJSON[T] and require* helpers; use net/http status constants. - Extract shared scanRegions engine in search; unify adb signal() and the Peek/ReadRegion shell path; make cmp generic. - Rename module memodroid -> memdroid across go.mod, imports, docs, CLI. Bug fixes - Pointer scan/resolve: fix chunk-boundary pointer loss (bulk ReadRegion), store module-relative BaseOffset, apply offsets in base->final order, add cycle guard. Round-trip covered by a new fake-driver test. - REST pattern/string search now persist results into the session. - Guard CompareValues against short slices; reject TypeBytes in watch/alert. - Fix .CT module+offset detection; add mutexes to UndoStack and Session. Security - Bind loopback by default; add -addr/-token (MEMDROID_TOKEN) flags and a warning when exposed without auth. - Gate endpoints by HTTP method, cap request bodies at 1 MiB, add server timeouts, and broadcast to WebSocket clients outside the lock with dead- client pruning. Tests - Add unit tests for poller, search/types, store/cheatengine, and pointer.
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.
概要
コードベース全体のリファクタリングと、分析で見つかったバグ・並行性・セキュリティ問題の修正。挙動互換を保ちつつ重複を除去し、ポインタ機能の実バグを直し、Web サーバを安全側の既定に変更しました。
リファクタリング
internal/poller.Poolを新設しFreezer/Watcher/AlertWatcherを統合。3つでほぼ同一だったmap+stopチャネル+ticker+List/Stop/StopAllを一元化(~150行削減)。handlers.goの decode→validate→error ボイラープレートをジェネリックdecodeJSON[T]とrequire*/writeOK/queryIntヘルパで圧縮。http.Status*定数化。search.goの値/バイト検索ワーカーをscanRegionsに共通化。adbのsignal()集約とPeek/ReadRegionシェル経路統一。cmpのジェネリック化。memodroid→memdroidに統一(go.mod / imports / docs / CLI ヘッダ)。バグ修正
ReadRegion一括化)、モジュール相対BaseOffsetを保存、オフセットを base→final 順に統一、サイクル防止。fake driver による往復テストを追加。searchPattern/searchStringが結果を破棄していた問題を修正(セッションに保存し候補操作可能に)。CompareValuesの短スライス panic ガード、watch/alert でのTypeBytes明示エラー。.CTインポートのモジュール判定修正、UndoStack/Sessionに mutex 追加。セキュリティ
-addr/-token(MEMDROID_TOKEN)フラグ、無認証で外部公開時の警告。wswatch.Broadcastをロック外書き込み+死活クライアント掃除に。テスト
poller/search/types/store/cheatengine/pointerにユニットテストを新規追加。検証
go build ./.../go vet ./...パスgo test -race ./...全パス-addr/-token)動作確認済み