Make api_key and identity auth modes disjoint by deprecating the implicit Entra fallback
メンテナーはふだん 2 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 35/100
- issue の種類
- 機能追加
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- python
調査の方向性
Start with pyrit/auth/openai_auth.py::resolve_openai_auth, then compare the inlined authentication chains in AzureMLChatTarget and PromptShieldTarget. This work is ordered after #2846, which adds explicit auth-mode support to AzureBlobStorageTarget; review that dependency and #3010 before changing behavior. Done means the implicit identity fallback warns for one release, strict modes and cleanup are addressed, and the setup and per-target notebooks plus release and migration guidance are updated.
索引モデルが issue の本文から書いたものです。
説明
Is your feature request related to a problem? Please describe.
Follow-up to review feedback on #3010 (thread).
api_key authentication mode can currently resolve to identity. The chain in pyrit/auth/openai_auth.py::resolve_openai_auth is:
- token-provider callable passed as
api_key - explicit
api_keystring - the target's API key environment variable
- fallback: an Entra token, for recognized Azure endpoints only
Step 4 is why "no api_key passed" was ambiguous in the first place — it can mean "the user chose identity" or "no key is available, mint a token." #3010 fixed the user-facing symptom by adding an explicit auth_mode, but left the underlying fallback in place for backward compatibility, so the two modes still overlap rather than being disjoint.
The same inlined chain exists in AzureMLChatTarget and PromptShieldTarget.
Describe the solution you'd like
Make the two modes disjoint:
auth_mode="api_key"requires a key or an explicitly supplied token provider, and fails clearly when neither is present. No implicit identity fallback.auth_mode="identity"uses identity and ignores keys (already true as of #3010).
This is a breaking change: OpenAIChatTarget(endpoint=<azure endpoint>) with no key plus az login works silently today and is documented that way, so it should go through a deprecation cycle rather than being removed outright:
- One release emitting a
DeprecationWarningwhen the implicit fallback is taken, namingauth_mode="identity"as the replacement. - Removal in the following release, called out in the release notes and migration guidance.
Two cleanups land with this:
TargetService._accepts_auth_modecan be deleted. It exists solely becauseAzureBlobStorageTargethas noauth_modeparameter; once every identity-advertising target accepts the explicit mode, a target that cannot meet that contract should fail loudly instead of being quietly skipped. This is blocked on #2846, which adds explicit auth-mode support toAzureBlobStorageTarget.doc/code/setup/1_configuration.py/.ipynband the per-target notebooks that describe keyless Azure auth need updating.
Describe alternatives you've considered, if relevant
- Keep the fallback indefinitely. Lowest churn, but leaves
api_keymode able to silently produce identity auth, which is the ambiguity #3010 set out to remove. - Remove it immediately in #3010. Rejected: an unannounced break buried in a bugfix, with no warning period for users relying on the documented keyless Azure path.
- Add an explicit
automode that keeps today's chain, leavingapi_keyandidentitystrict. Preserves the behavior under an honest name, but adds a third mode to document and reason about; only worth it if the keyless path turns out to be widely depended upon.
Additional context
Ordering: this should land after #2846, which supplies the AzureBlobStorageTarget half and unblocks removing _accepts_auth_mode. #2846 and #3010 also introduce two overlapping mechanisms for the same concern (a per-class get_auth_mode_parameters hook vs. an explicit auth_mode constructor argument); reconciling those into one belongs in the same pass.
Related: #3010, #2846, #2235 (which introduced the fallback — correctly, for its original purpose as a last resort when no key exists).
- 主要言語
- Python
- スター
- 4.6k
- フォーク
- 944
- 平均マージ
- 3日 1時間
- マージ済み PR(30日)
- 278
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoft/PyRIT のほかの issue
-
BUG ColloquialWordswapConverter skips words next to punctuation and inserts spaces into hyphenated words対応中かも @ShivamSharma43 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 2 日以内に返信
-
BUG UnicodeReplacementConverter writes characters outside the BMP as invalid five-digit \u escapes対応中かも @ShivamSharma43 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 2 日以内に返信
-
BUG: label queries only return the final conversation of an attack対応中かも @richlundeen が 1 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
microsoft/PyRIT#3095 · コメント 1 件 · 担当者 1 名 ·
メンテナーはふだん 2 日以内に返信
-
BUG PuzzledConverter cannot select words carrying non-ASCII letters, so the mask falls on articles instead対応中かも @adimalkar が 3 日前に担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
microsoft/PyRIT#3022 · コメント 4 件 ·
メンテナーはふだん 2 日以内に返信
-
BUG Configuration keeps runtime-status errors after polling recovers対応中かも @joeyvictorino が 1 日前に担当しました。 オープンBug: triage GUI help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
microsoft/PyRIT#2868 · コメント 4 件 · 担当者 1 名 ·
メンテナーはふだん 2 日以内に返信
microsoft/PyRIT の issue をすべて見る
似ている issue
-
comp/gateway comp/plugins duplicate P3 type/bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
NousResearch/hermes-agent#137019 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
bot-triaged module: docs triaged
難易度 1/5 1〜3時間 初心者へのやさしさ 88/100
メンテナーはふだん 1 日以内に返信
-
new-entry
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
BinWang28/audio-ai-hub#194 ·
-
confluence: a paged listing's links re-encode a parameter they carry, where real carries it as sentオープンfidelity
難易度 2/5 1〜3時間 初心者へのやさしさ 63/100
メンテナーはふだん 1 日以内に返信