BinaryContentにCTF向けメタ情報を追加し読み込み上限を設定する#21
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 1f25fe9af5
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| pub network: NetworkConfig, | ||
| pub feature_flags: FeatureFlagsConfig, | ||
| pub paths: PathsConfig, | ||
| pub binary: BinaryConfig, |
There was a problem hiding this comment.
Preserve existing configs when adding binary defaults
When a user upgrades with an existing config/default.toml that predates this commit and therefore lacks [binary], this new required field makes toml::from_str in AppConfig::load fail; the app startup path then uses unwrap_or_default, so all of the user's customized scan/network/path settings are silently discarded. Add a serde/default fallback for binary (or merge with defaults) so older config files continue to load with only the new binary settings defaulted.
Useful? React with 👍 / 👎.
|
確認しましたが、この PR は現状マージしません。 理由:
対応案:
|
Motivation
Description
BinaryContentにmagic_bytes/file_type_guess/sha256/sha1/md5/printable_strings/flag_candidates/entropy/warningsを追加し、read_binary_fileがAppStateのbinary設定を参照するよう変更した(src-tauri/src/commands/binary.rs)。BinaryConfig型をsrc-tauri/src/config.rsに追加し、既定値をsrc-tauri/config/default.tomlに追加した(max_read_bytes,hex_dump_bytes,decoded_text_max_chars,max_strings,min_string_len,magic_bytes_len,max_flag_candidates)。src-tauri/src/utils/binary.rsのread_fileを設定引数を受け取る形に書き換え、先頭 N バイトのみを読み込むread_prefix、ハッシュとエントロピーをストリーミングで算出するcalculate_hashes_and_entropy、マジックバイト抽出、ファイル種別推定、文字列抽出、フラグ候補抽出、デコード表示制限ロジック等を追加した。BinaryContentを更新し、src/pages/BinaryPage.tsxを改良して Summary/Hashes/Magic Bytes/Strings/Flag Candidates/Warnings/Hex Dump/Decoded Text のセクションを表示するようにした。utils::binaryの解析挙動・制限動作)とフロントエンドのtests/tauriInvokeArgs.test.tsxを更新/拡張して、新しいBinaryContentの形状と表示を検証するテストを追加した。opensslを利用するためsrc-tauri/Cargo.tomlに依存を追加した。Testing
cargo fmt --checkは成功した。npx vitest run tests/tauriInvokeArgs.test.tsxを実行し全テストが成功(5/5)。npm run build(tsc+vite build)とnpm run lint(eslint)を実行して成功した。cargo test --offline --lib utils::binary)は追加したテストを含むが、実行環境でglib-2.0.pc相当のシステム依存が不足しておりglib-sysのビルドが失敗するため実行できずブロックされた(環境依存の外部ライブラリが原因)。Codex Task