Hacktoberfest 2026 : les issues que les mainteneurs ont marquées pour octobre, ouvertes et accessibles aux débutants. Parcourir les issues Hacktoberfest

BUG: OpenAITTSTarget accepts any speed, so an out-of-range value is only sent to the API on every request

Fermée
#3,445 1 commentaire 0 réactions 1 personne assignée Voir sur GitHub

Les mainteneurs répondent en général sous 2 jours

@ShivamSharma43 y travaille déjà.

Depuis le 22/10/2026.

  • #1 par @huong8373tt-beep — ouverte
  • #3447 par @ShivamSharma43 — fusionnée
  • #3461 par @huong8373tt-beep — fermée sans fusion

Évaluation

Difficulté
2/5
Temps estimé
1-3 heures
Accessibilité débutants
25/100
Type d'issue
Bug
Clarté
Clairement spécifiée
Activité
À l'abandon
Stack technique
python
Domaine
backend

Piste de recherche

The issue identifies OpenAITTSTarget.__init__ and _send_prompt_to_target_async; locate those entry points in the PyRIT source and check how OpenAIVideoTarget validates duration. Add coverage for the listed invalid speed values and for None and valid boundary values. Done when invalid speeds raise ValueError at construction while None remains accepted; linked pull request #3447 is already open.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

Describe the bug

OpenAITTSTarget.__init__ documents speed as "Select a value from 0.25 to 4.0", which is the range of the OpenAI speech API's speed parameter, but stores whatever is passed. _send_prompt_to_target_async then puts it in every request body (if self._speed is not None: body_parameters["speed"] = self._speed).

So speed=10, speed=-1.0, speed=0, speed=float("nan") or speed=True all construct a target without error, and the mistake only surfaces when each request reaches the API. The value is also recorded in the target's identifier as if it were valid. OpenAIVideoTarget already rejects an unsupported duration at the target instead of leaving it to the API.

Steps/Code to Reproduce
import asyncio
from pyrit.setup import IN_MEMORY, initialize_pyrit_async

asyncio.run(initialize_pyrit_async(memory_db_type=IN_MEMORY))

from pyrit.prompt_target import OpenAITTSTarget

for speed in (10, -1.0, 0, float("nan"), True):
    target = OpenAITTSTarget(model_name="tts-1", endpoint="https://api.openai.com/v1", api_key="sk-test", speed=speed)
    print(repr(speed), "-> accepted, will send speed =", repr(target._speed))
Expected Results

A speed that is not a finite number from 0.25 to 4.0 raises a ValueError when the target is created. None keeps the API default.

Actual Results
10 -> accepted, will send speed = 10
-1.0 -> accepted, will send speed = -1.0
0 -> accepted, will send speed = 0
nan -> accepted, will send speed = nan
True -> accepted, will send speed = True
Screenshots

N/A

Versions
  • OS: Windows 11
  • Python version: 3.11.9
  • PyRIT version: installed from main (898b3bdc) in editable mode
Langage dominant
Python
Étoiles
4.6k
Forks
962
Merge moyen
2 j 13 h
PR mergées (30 j)
423

Préparer son environnement

Ouvrir dans Codespaces

Lance le conteneur de développement du projet dans votre navigateur, avec votre propre compte GitHub.

  • Aucun Dockerfile ni fichier Docker Compose
  • Propose un modèle de pull request
  • Aucun guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de microsoft/PyRIT

Toutes les issues de microsoft/PyRIT

Issues similaires

Plus d'issues Python

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.