[BUG] - Sensitive API Key exposed in cleartext and potential UnboundLocalError in CLI initialization
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 68/100
Línea de trabajo
Comienza en cli.py, en el bloque de inicialización global que gestiona el fallback de BROWSER_USE_API_KEY, e inspecciona cómo los comandos de Typer utilizan llm_instance y page_extraction_llm. Ejecuta la CLI cuando la clave esté ausente o sea no válida, prueba las respuestas y y n, y verifica que la entrada secreta esté oculta y que rechazar la solicitud produzca un resultado correcto sin errores de inicialización posteriores.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Description
During a static code review of cli.py, two critical issues were identified in the global initialization block handling the BROWSER_USE_API_KEY fallback:
-
Cleartext Key Exposure (Security): The fallback mechanism uses the built-in input() function to collect the user's API key (os.environ['BROWSER_USE_API_KEY'] = input(...)). This echoes the sensitive API key in cleartext to the terminal, making it vulnerable to shoulder surfing and terminal history logging.
-
Unbound Local Variable Risk (Stability): If the initial ChatBrowserUse instantiation fails and the user selects n at the prompt, the code executes a pass. Consequently, llm_instance and page_extraction_llm remain uninitialized. When downstream Typer commands attempt to access these global instances, the application will crash with a NameError or UnboundLocalError.
Steps to reproduce
Note: Identified via static program analysis. Theoretical reproduction steps below:
1.Run the CLI tool in an environment where BROWSER_USE_API_KEY is not set or invalid.
-
At the prompt Set BROWSER_USE_API_KEY? (y/n):, type y.
-
Paste an API key and observe that the key is printed to the screen in plain text (Security Issue).
-
Alternatively, at the first prompt, type n.
-
Attempt to run any CLI command that utilizes the LLM. Observe the application crashing due to undefined variables (Stability Issue).
Expected behavior
-
The CLI should securely prompt for the API key by masking the input. Since typer is already a project dependency, typer.prompt("Enter your BROWSER_USE_API_KEY", hide_input=True) should be used instead of standard input().
-
If the user declines to provide a key (inputs n), the script should either gracefully exit using typer.Exit() with a helpful warning, or initialize a safe fallback state to prevent unhandled exceptions downstream.
Actual behavior
The API key is visibly echoed on the screen during input, and the script silently continues execution with undefined core LLM variables if the user skips the fallback prompt.
Additional context
Using typer.prompt(..., hide_input=True) is the standard best practice for handling secrets in Typer-based CLI applications and requires minimal refactoring.
- Lenguaje dominante
- Python
- Estrellas
- 4.3k
- Forks
- 356
- Merge medio
- 50 min
- PR fusionados (30 d)
- 6
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de browser-use/workflow-use
-
BUG: process_workflow_file_with_markers crashes with JSONDecodeError on YAML workflow filesPosiblemente ocupada @RaphaelFakhri la tomó hace 67 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
browser-use/workflow-use#156 ·
Los mantenedores suelen responder en 1 día
-
BUG: _resolve_placeholders crashes with IndexError on positional format placeholders like {0}Posiblemente ocupada @mikamikasuki la tomó hace 64 días. Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
browser-use/workflow-use#154 ·
Los mantenedores suelen responder en 1 día
-
Monika JankovicAbierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 15/100
browser-use/workflow-use#236 ·
Los mantenedores suelen responder en 1 día
-
Recording captures zero events: extension never loads (browser-use 0.13 / Chrome 137+) and schema validator 422s every WORKFLOW_UPDATEPosiblemente ocupada @Sangaibisi la tomó hace 117 días. Abierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
browser-use/workflow-use#165 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 10/100
browser-use/workflow-use#148 ·
Los mantenedores suelen responder en 1 día
Todos los issues de browser-use/workflow-use
Issues similares
-
docs(contributing): the two things that silently block a PRPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abiertoavailable documentation good first issue
Dificultad 1/5 1-3 horas Aptitud para principiantes 95/100
Nixitov/Riptide-Native#944 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
JTHCode/secretguard#24 ·
Los mantenedores suelen responder en 1 día
-
area: middleware documentation good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
-
enhancement good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
Los mantenedores suelen responder en 1 día
-
good first issue
Dificultad 1/5 Menos de una hora Aptitud para principiantes 95/100
omarelshamy25x/shamy-hijri#63 ·
Los mantenedores suelen responder en 1 día