Skip to content

CTFワークスペースを追加#22

Merged
T3pp31 merged 4 commits into
mainfrom
codex/refactor-ctfpage-to-ctf-workspace
May 14, 2026
Merged

CTFワークスペースを追加#22
T3pp31 merged 4 commits into
mainfrom
codex/refactor-ctfpage-to-ctf-workspace

Conversation

@T3pp31

@T3pp31 T3pp31 commented May 13, 2026

Copy link
Copy Markdown
Owner

Motivation

  • 静的なCTFリファレンスページを、貼り付けやファイル選択を使って即座に解析・変換できるインタラクティブなCTFワークスペースへ置き換えるため。
  • 解析/変換処理をUIから分離して再利用可能にするためにロジックを専用モジュールへ移すため。

Description

  • src/features/ctf/ctfTools.ts を追加し、型定義、CTF_TRANSFORMS、入力解析用の analyzeCtfInput、変換実行の transformCtfInput(内部に runTransform を持つ)などCTF処理ロジックを実装しました。
  • src/features/ctf/index.ts を追加して型と関数を再エクスポートするエントリを用意しました。
  • src/pages/CtfPage.tsx を全面的に差し替え、以下のパネルを持つ CTF Workspace UI を実装しました:入力エリア(テキスト貼り付け・ファイル選択・クリア)、自動解析パネル(flag/Base64/Hex/URL/printable候補)、変換パネル(Base64/Hex/URL/ROT13/Caesar/単一バイトXORなど)、結果パネル(変換結果・flag候補・コピー操作)、操作履歴パネル(変換名・入力/出力概要・タイムスタンプ)。
  • ページ側は専用モジュールの関数(analyzeCtfInput / transformCtfInput / summarizeText 等)を呼び出す実装にして変換ロジックをページに直接詰め込まない設計にしました。

Testing

  • ビルドは npm run buildtsc -b && vite build)で成功しました。
  • リンターは npm run linteslint .)で成功しました。
  • ブラウザやPlaywrightが環境に存在しなかったためUIの自動E2E/スクリーンショット取得は未実施です。

Codex Task

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: efacf17191

ℹ️ 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".

Comment thread src/pages/CtfPage.tsx
Comment on lines +160 to +162
} catch (caughtError) {
setError(caughtError instanceof Error ? caughtError.message : "変換に失敗しました。");
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Clear stale transform result on errors

When a user successfully runs one transform and then runs another transform that throws, such as invalid Hex/Base64/URL input, this catch path only sets the error message and leaves the previous result rendered in the result panel with copy buttons. That stale output can be mistaken for the failed transform's output; clear result before/inside the error path so failed conversions do not display an unrelated prior result.

Useful? React with 👍 / 👎.

T3pp31 commented May 14, 2026

Copy link
Copy Markdown
Owner Author

確認しましたが、この PR は現状マージしません。

理由:

対応案:

  1. main に rebase/merge して CI 削除差分を消す。
  2. catchsetResult(null) する、または失敗時の結果表示を明示的に無効化する。
  3. Add CTF Workspace and Artifact Analyzer (binary analysis, transforms, detectors) #17/CTF 定義をページから分離して features/ctf モジュール群へ移動 #19/CTF ワークスペースの状態モデルと Writeup エクスポートを追加 #20 との CtfPage.tsxfeatures/ctf の重複を整理してください。

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c47c7fbb49

ℹ️ 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".

Comment thread src/features/ctf/ctfTools.ts Outdated
Array.from(bytes, (byte) => byte.toString(16).padStart(2, "0")).join("");

const parseHexBytes = (input: string) => {
const normalized = input.replace(/^0x/i, "").replace(/[\s:_-]/g, "");

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Strip hex dump offsets before decoding

When users paste an xxd-style hex dump as the textarea placeholder suggests (for example 00000000: 666c 6167 7b78 7d), this normalizer removes the colon and spaces but leaves the address offset as hex data, so Hex decode emits leading NUL/offset bytes and corrupts multi-line dumps instead of decoding only the byte column. Either strip recognized dump offsets/ASCII columns before decoding or avoid advertising hex-dump input.

Useful? React with 👍 / 👎.

@T3pp31 T3pp31 merged commit ea5c2be into main May 14, 2026
1 check passed

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: dd84505830

ℹ️ 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".

Comment thread src/pages/CtfPage.tsx
const nextResult = {
name: activeTransform.label,
output: transformResult.output,
flagCandidates: analyzeCtfInput(transformResult.output).flag,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Persist decoded flag candidates in the writeup

When a transform reveals a flag (for example decoding ZmxhZ3t4fQ==), this stores the candidate only in result.flagCandidates, so the result panel shows it but workspace.flagCandidates remains unchanged. Because the writeup preview/export is generated from workspace, the exported Markdown still has empty Flag Candidates/Final Flag sections for automatically discovered flags unless the user manually copies them into notes; add these candidates to the workspace or include them when generating the writeup.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant