Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions USER_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -2358,7 +2358,7 @@ Filter parsing also warns on `stderr` when an allow/deny variable is empty, cont

### AI Feedback

cdidx includes a `suggest_improvement` MCP tool for AI agents that hit gaps or bugs. Suggestions are saved locally beside the selected DB (`.cdidx/suggestions-codeindex.json` by default), and are sent to GitHub only when the user explicitly provides `CDIDX_GITHUB_TOKEN`. GitHub submission runs outside the suggestion-store file lock and uses a 10-second timeout by default; set `CDIDX_GITHUB_SUBMIT_TIMEOUT_SECONDS=<seconds>` to tune that deadline up to 300 seconds. Non-positive, non-numeric, and larger values fall back to the 10-second default. Local records include lifecycle metadata: `draft`, `submitted_pending_triage`, `open_in_upstream`, `resolved_in_upstream`, `wont_fix`, `duplicate`, or `superseded`, plus upstream issue URL/number fields when known. They also persist GitHub submission diagnostics (`last_submit_attempt`, `submit_attempt_count`, `last_submit_error`, and rate-limit `next_retry_at`) so operators can tell whether a suggestion was never attempted, failed transiently, is waiting for a rate-limit window, or was rejected by the API. New records also store attribution metadata: the MCP `initialize.clientInfo` name/version when available, an opaque cdidx session id, the cdidx version that recorded the suggestion, optional natural-language `toolInvocationContext`, and optional repository-relative `evidencePaths` supplied by the caller. Payload details and source-code leak guardrails are documented in the [Developer Guide](DEVELOPER_GUIDE.md#ai-feedback-implementation).
cdidx includes a `suggest_improvement` MCP tool for AI agents that hit gaps or bugs. Suggestions are saved locally beside the selected DB (`.cdidx/suggestions-codeindex.json` by default), and are sent to GitHub only when the user explicitly provides `CDIDX_GITHUB_TOKEN`. GitHub submission runs outside the suggestion-store file lock and uses a 10-second timeout by default; set `CDIDX_GITHUB_SUBMIT_TIMEOUT_SECONDS=<seconds>` to tune that deadline up to 300 seconds. Non-positive, non-numeric, and larger values fall back to the 10-second default. GitHub HTTP calls use .NET's default proxy discovery, but they do not forward OS/default proxy credentials by default; set `CDIDX_GITHUB_PROXY_USE_DEFAULT_CREDENTIALS=1` only when an enterprise proxy explicitly requires those credentials. Local records include lifecycle metadata: `draft`, `submitted_pending_triage`, `open_in_upstream`, `resolved_in_upstream`, `wont_fix`, `duplicate`, or `superseded`, plus upstream issue URL/number fields when known. They also persist GitHub submission diagnostics (`last_submit_attempt`, `submit_attempt_count`, `last_submit_error`, and rate-limit `next_retry_at`) so operators can tell whether a suggestion was never attempted, failed transiently, is waiting for a rate-limit window, or was rejected by the API. New records also store attribution metadata: the MCP `initialize.clientInfo` name/version when available, an opaque cdidx session id, the cdidx version that recorded the suggestion, optional natural-language `toolInvocationContext`, and optional repository-relative `evidencePaths` supplied by the caller. Payload details and source-code leak guardrails are documented in the [Developer Guide](DEVELOPER_GUIDE.md#ai-feedback-implementation).

Use `cdidx suggestions list` to review recorded suggestions, `cdidx suggestions show <id>` to inspect one entry, and `cdidx suggestions export --format markdown` to share a filtered triage bundle with a team. Use `cdidx suggestions export --format issue-drafts --open-issues open-issues.json` to emit issue-ready drafts with title, labels, evidence paths, body text, and duplicate matches from an open-issues JSON preflight. The command reads the suggestion store beside the selected DB (`.cdidx/suggestions-codeindex.json` by default), supports filters such as `--status`, `--language`, `--category`, `--since`, and `--agent`, and prints JSON with `--json` for scripts. By default, `suggestions list` and `suggestions export` emit every matching record in newest-first order; pass `--limit <n>` and `--offset <n>` to page or cap large stores. Exported JSON, markdown bundles, and issue-draft bodies cap long description/context/tool-invocation text with a `[truncated]` marker; use `cdidx suggestions show <id>` when you need the full local record body.

Expand Down Expand Up @@ -4793,7 +4793,7 @@ filter 解析では、allow / deny 変数が空、CSV 内に空 entry がある

### AIフィードバック

cdidx には、AI エージェントがギャップや不具合に気づいたときに使える `suggest_improvement` MCP ツールがあります。提案は選択した DB の隣(既定は `.cdidx/suggestions-codeindex.json`)にローカル保存され、`CDIDX_GITHUB_TOKEN` を明示設定した場合に限って GitHub へ送信されます。GitHub 送信は suggestion-store のファイルロック外で実行され、既定では 10 秒で timeout します。この deadline は `CDIDX_GITHUB_SUBMIT_TIMEOUT_SECONDS=<秒>` で最大 300 秒まで調整できます。0 以下、数値以外、または上限を超える値は 10 秒の既定値へ戻ります。ローカルレコードには lifecycle metadata として `draft`、`submitted_pending_triage`、`open_in_upstream`、`resolved_in_upstream`、`wont_fix`、`duplicate`、`superseded` と、判明している upstream issue URL/番号が保存されます。さらに GitHub 送信診断として `last_submit_attempt`、`submit_attempt_count`、`last_submit_error`、rate-limit 時の `next_retry_at` も永続化されるため、提案が未試行なのか、一時的に失敗したのか、rate-limit window 待ちなのか、API に拒否されたのかを運用者が判断できます。新規レコードには attribution metadata も保存されます。取得可能な場合は MCP `initialize.clientInfo` の name/version、不透明な cdidx セッション ID、提案を記録した cdidx バージョン、呼び出し元が任意で渡す自然言語の `toolInvocationContext`、任意のリポジトリ相対 `evidencePaths` が含まれます。ペイロード詳細とソースコード漏えいガードは [DEVELOPER_GUIDE.md#aiフィードバックの実装](DEVELOPER_GUIDE.md#aiフィードバックの実装) にまとめています。
cdidx には、AI エージェントがギャップや不具合に気づいたときに使える `suggest_improvement` MCP ツールがあります。提案は選択した DB の隣(既定は `.cdidx/suggestions-codeindex.json`)にローカル保存され、`CDIDX_GITHUB_TOKEN` を明示設定した場合に限って GitHub へ送信されます。GitHub 送信は suggestion-store のファイルロック外で実行され、既定では 10 秒で timeout します。この deadline は `CDIDX_GITHUB_SUBMIT_TIMEOUT_SECONDS=<秒>` で最大 300 秒まで調整できます。0 以下、数値以外、または上限を超える値は 10 秒の既定値へ戻ります。GitHub HTTP 呼び出しは .NET の既定 proxy 検出を使いますが、既定では OS/default proxy 資格情報を転送しません。企業 proxy が明示的にその資格情報を必要とする場合だけ `CDIDX_GITHUB_PROXY_USE_DEFAULT_CREDENTIALS=1` を設定してください。ローカルレコードには lifecycle metadata として `draft`、`submitted_pending_triage`、`open_in_upstream`、`resolved_in_upstream`、`wont_fix`、`duplicate`、`superseded` と、判明している upstream issue URL/番号が保存されます。さらに GitHub 送信診断として `last_submit_attempt`、`submit_attempt_count`、`last_submit_error`、rate-limit 時の `next_retry_at` も永続化されるため、提案が未試行なのか、一時的に失敗したのか、rate-limit window 待ちなのか、API に拒否されたのかを運用者が判断できます。新規レコードには attribution metadata も保存されます。取得可能な場合は MCP `initialize.clientInfo` の name/version、不透明な cdidx セッション ID、提案を記録した cdidx バージョン、呼び出し元が任意で渡す自然言語の `toolInvocationContext`、任意のリポジトリ相対 `evidencePaths` が含まれます。ペイロード詳細とソースコード漏えいガードは [DEVELOPER_GUIDE.md#aiフィードバックの実装](DEVELOPER_GUIDE.md#aiフィードバックの実装) にまとめています。

記録済みの提案は `cdidx suggestions list` で確認し、`cdidx suggestions show <id>` で1件を詳細表示し、`cdidx suggestions export --format markdown` でチーム triage 用に共有できます。`cdidx suggestions export --format issue-drafts --open-issues open-issues.json` は、title、labels、evidence paths、body text、open issue JSON との重複候補を含む Issue 作成用 draft を出力します。このコマンドは選択した DB の隣にある提案ストア(既定は `.cdidx/suggestions-codeindex.json`)を読み、`--status`、`--language`、`--category`、`--since`、`--agent` で絞り込めます。スクリプト向けには `--json` を使います。既定では `suggestions list` と `suggestions export` は一致した全レコードを新しい順に出力します。大きなストアでは `--limit <n>` と `--offset <n>` でページングまたは出力上限を指定できます。export JSON、markdown bundle、issue draft body は長い description / context / tool-invocation text を `[truncated]` marker 付きで制限します。ローカルレコード本文をすべて確認する場合は `cdidx suggestions show <id>` を使ってください。

Expand Down
20 changes: 20 additions & 0 deletions changelog.d/unreleased/3369.security.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
category: security
issues:
- 3369
affected:
- src/CodeIndex/Cli/GitHubHttpClientFactory.cs
- src/CodeIndex/Cli/GitHubIssueReporter.cs
- src/CodeIndex/Cli/IssueDuplicatePreflight.cs
- tests/CodeIndex.Tests/GitHubIssueReporterTests.cs
- tests/CodeIndex.Tests/IssueDuplicatePreflightTests.cs
- USER_GUIDE.md
---

## English

- **GitHub issue submission no longer forwards default proxy credentials by default (#3369)** — GitHub submission and duplicate-preflight HTTP clients still use standard proxy discovery, but OS/default proxy credentials are sent only when `CDIDX_GITHUB_PROXY_USE_DEFAULT_CREDENTIALS=1` is explicitly configured.

## 日本語

- **GitHub Issue 送信が既定で default proxy 資格情報を転送しないよう修正 (#3369)** — GitHub 送信と重複 preflight の HTTP クライアントは標準の proxy 検出を引き続き使いますが、OS/default proxy 資格情報は `CDIDX_GITHUB_PROXY_USE_DEFAULT_CREDENTIALS=1` が明示設定された場合にだけ送信されます。
16 changes: 16 additions & 0 deletions changelog.d/unreleased/3398.security.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
category: security
issues:
- 3398
affected:
- src/CodeIndex/Indexer/Symbols/SymbolExtractionWorker.cs
- tests/CodeIndex.Tests/IndexCommandRunnerTests.cs
---

## English

- **Symbol extraction worker test hooks no longer honor ambient environment variables (#3398)** — the isolated worker now ignores legacy `CDIDX_TEST_SYMBOL_EXTRACTION_WORKER_*` environment variables during normal execution and only receives bounded test controls through an internal test seam.

## 日本語

- **symbol extraction worker のテストフックが環境変数を拾わないよう修正 (#3398)** — isolated worker は通常実行中に従来の `CDIDX_TEST_SYMBOL_EXTRACTION_WORKER_*` 環境変数を無視し、内部テストシームから渡される上限付きのテスト制御だけを受け取るようになりました。
40 changes: 40 additions & 0 deletions src/CodeIndex/Cli/GitHubHttpClientFactory.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
using System.Net;

namespace CodeIndex.Cli;

internal static class GitHubHttpClientFactory
{
internal const string ProxyDefaultCredentialsEnvironmentVariable = "CDIDX_GITHUB_PROXY_USE_DEFAULT_CREDENTIALS";

internal static HttpClient CreateDefaultHttpClient(TimeSpan timeout)
{
var handler = new HttpClientHandler
{
UseProxy = true,
Proxy = HttpClient.DefaultProxy,
};
if (ShouldUseDefaultProxyCredentials())
handler.DefaultProxyCredentials = CredentialCache.DefaultCredentials;

var client = new HttpClient(handler)
{
Timeout = timeout,
DefaultRequestHeaders =
{
{ "User-Agent", "cdidx" },
{ "Accept", "application/vnd.github+json" },
{ "X-GitHub-Api-Version", "2022-11-28" },
},
};
return client;
}

internal static bool ShouldUseDefaultProxyCredentials()
{
var raw = Environment.GetEnvironmentVariable(ProxyDefaultCredentialsEnvironmentVariable)?.Trim();
return raw != null
&& (string.Equals(raw, "1", StringComparison.OrdinalIgnoreCase)
|| string.Equals(raw, "true", StringComparison.OrdinalIgnoreCase)
|| string.Equals(raw, "yes", StringComparison.OrdinalIgnoreCase));
}
}
20 changes: 1 addition & 19 deletions src/CodeIndex/Cli/GitHubIssueReporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -70,25 +70,7 @@ internal static class GitHubIssueReporter
private static readonly HttpClient s_defaultHttpClient = CreateDefaultHttpClient();

private static HttpClient CreateDefaultHttpClient()
{
var handler = new HttpClientHandler
{
UseProxy = true,
Proxy = HttpClient.DefaultProxy,
DefaultProxyCredentials = CredentialCache.DefaultCredentials,
};
var client = new HttpClient(handler)
{
Timeout = Timeout.InfiniteTimeSpan,
DefaultRequestHeaders =
{
{ "User-Agent", "cdidx" },
{ "Accept", "application/vnd.github+json" },
{ "X-GitHub-Api-Version", "2022-11-28" },
}
};
return client;
}
=> GitHubHttpClientFactory.CreateDefaultHttpClient(Timeout.InfiniteTimeSpan);

// Test seam: when set, replaces the default HttpClient so tests can
// mock GitHub responses without hitting the network. Production code
Expand Down
20 changes: 1 addition & 19 deletions src/CodeIndex/Cli/IssueDuplicatePreflight.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Globalization;
using System.Net;
using System.Net.Http.Headers;
using System.Text;
using System.Text.Json;
Expand Down Expand Up @@ -356,24 +355,7 @@ private static bool IsValidGitHubRepositoryPart(string value)
}

private static HttpClient CreateDefaultHttpClient()
{
var handler = new HttpClientHandler
{
UseProxy = true,
Proxy = HttpClient.DefaultProxy,
DefaultProxyCredentials = CredentialCache.DefaultCredentials,
};
return new HttpClient(handler)
{
Timeout = TimeSpan.FromSeconds(10),
DefaultRequestHeaders =
{
{ "User-Agent", "cdidx" },
{ "Accept", "application/vnd.github+json" },
{ "X-GitHub-Api-Version", "2022-11-28" },
},
};
}
=> GitHubHttpClientFactory.CreateDefaultHttpClient(TimeSpan.FromSeconds(10));

private static string? TryReadString(JsonNode? node, int maxLength)
{
Expand Down
Loading
Loading