Skip to content

fix: report no auth modes for credential-free TextTarget - #3777

Open
alexcastgonz (pcbeingused333) wants to merge 3 commits into
microsoft:mainfrom
pcbeingused333:fix-c1186
Open

alexcastgonz (pcbeingused333) wants to merge 3 commits into
microsoft:mainfrom
pcbeingused333:fix-c1186

Conversation

@pcbeingused333

Copy link
Copy Markdown
Contributor

Fixes #3712

Description

TextTarget writes prompts to a local text stream and never contacts a service, but it inherited the default supported_auth_modes of ("api_key",), so New Target described it as "Supported authentication: API key".

  • TextTarget declares supported_auth_modes = (), so the registry metadata and /targets/types say it takes no credentials.
  • CreateTargetDialog shows "No authentication required" when the registry metadata is loaded and a target reports an empty mode list. The built-in fallback entries (used when the registry is unavailable) also carry [], so they keep showing nothing rather than a claim the dialog can't back.

Tests and Documentation

  • tests/unit/registry/test_target_registry.py and tests/unit/backend/test_target_service.py assert the empty list for TextTarget (2 fail on main, pass with the change); the existing api-key-only assertion now uses GitHubCopilotTarget.
  • CreateTargetDialog.test.tsx: new test for the "No authentication required" text (fails on main); the target-list test gets the extra TextTarget entry.
  • No documentation change; JupyText not run (no notebook touched).

This change was prepared with an AI coding assistant (Claude Code) and submitted by Alex Castillo González.

TextTarget writes to a local stream and never contacts a service, but it
inherited the default supported_auth_modes of (api_key,), so the target
picker described it as 'Supported authentication: API key'. Declare an
empty tuple and have the dialog say 'No authentication required' when the
registry reports no auth modes.
# Conflicts:
#	tests/unit/registry/test_target_registry.py
Copilot AI balanced review requested due to automatic review settings November 5, 2026 14:52

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The new async test in tests/unit/backend/test_target_service.py needs an _async suffix to comply with the required naming convention.

1 open issue
What changed in this PR

This PR addresses #3712 by identifying TextTarget as credential-free in registry metadata and displaying that information in the target-creation dialog.

Changes:

  • Declare that TextTarget supports no authentication modes.
  • Show “No authentication required” for empty mode lists from loaded registry metadata, while preserving fallback behavior.
  • Add registry, backend, and frontend regression tests.
File Description
tests/​unit/​registry/​test_target_registry.py Verify credential-free metadata and retain API-key-only coverage.
tests/​unit/​backend/​test_target_service.py Verify the API returns no authentication modes for TextTarget.
pyrit/​prompt_target/​text_target.py Declare an empty supported authentication-mode tuple.
frontend/​src/​components/​Config/​CreateTargetDialog.tsx Display credential-free status when registry metadata is available.
frontend/​src/​components/​Config/​CreateTargetDialog.test.tsx Add TextTarget coverage and verify the authentication description.

Review effort: Balanced

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

TextTarget is described as using API-key authentication even though it needs no credentials

3 participants