Make api_key and identity auth modes disjoint by deprecating the implicit Entra fallback
Maintainer antworten meist innerhalb von 2 Tagen
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 35/100
- Issue-Typ
- Feature
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Aktiv
- Tech-Stack
- python
- Bereich
- authentication
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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).
- Vorherrschende Sprache
- Python
- Sterne
- 4.7k
- Forks
- 1k
- Ø Merge
- 2 T. 4 Std.
- Gemergte PRs (30 T.)
- 484
Entwicklungsumgebung
Startet den Dev-Container des Projekts im Browser, mit Ihrem eigenen GitHub-Konto.
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Kein Beitragsleitfaden
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus microsoft/PyRIT
-
Scenario objective previews can split supplementary Unicode during truncationEvtl. vergeben @Aadithya-kl hat das vor 1 Tag übernommen. OffenBug: triage help wanted
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
microsoft/PyRIT#3870 · 1 Kommentar · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 2 Tagen
-
URLDataTypeSerializer treats mixed-case HTTP(S) schemes as local pathsEvtl. vergeben @akhil9tiet hat das vor 1 Tag übernommen. OffenBug: triage help wanted
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
microsoft/PyRIT#3861 · 1 Kommentar · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 2 Tagen
-
Parameter required status is lost after wire round-tripEvtl. vergeben @its-amann hat das vor 1 Tag übernommen. OffenBug: triage help wanted
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
microsoft/PyRIT#3854 · 1 Kommentar · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 2 Tagen
-
BUG: LLMGenericTextConverter identifier changes between processes for set-valued template parametersEvtl. vergeben @samrudhi03 hat das vor 1 Tag übernommen. OffenBug: triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
microsoft/PyRIT#3841 · 1 Kommentar · 1 zugewiesene Person ·
Maintainer antworten meist innerhalb von 2 Tagen
-
BUG: SelfAskGeneral scorers leave their output keys out of the identifierEvtl. vergeben @Hrushikesh-ramilla hat das vor 2 Tagen übernommen. OffenBug: triage
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 72/100
Maintainer antworten meist innerhalb von 2 Tagen
Alle Issues in microsoft/PyRIT
Ähnliche Issues
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 69/100
jejjohnson/gaussx#752 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 85/100
521xueweihan/HelloGitHub#4270 ·
-
enhancement owner: den-haag
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 67/100
Maintainer antworten meist innerhalb von 6 Tagen
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 78/100
ok-oldking/ok-wuthering-waves#1828 ·
Maintainer antworten meist innerhalb von 1 Tag
-
lesson-submission pending-review
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 65/100
Ikalus1988/MisakaNet#4512 ·
Maintainer antworten meist innerhalb von 1 Tag