[Feature]: Built-in Method to Mask Sensitive Input in Test Reports

Abierto
#38,673 6 comentarios 17 reacciones 1 asignado Ver en GitHub

Los mantenedores suelen responder en 1 día

@dgozman ya está trabajando en esto.

Desde el 5/1/2026.

Evaluación

Este issue todavía no se ha evaluado.

Descripción

milestone
🚀 Feature Request
// Current implementation
await page.getByPlaceholder('Password').fill(process.env.USER_PASSWORD);
// Report shows: Fill "actualPasswordValue123"

The sensitive value appears in:

HTML test reports
Trace viewer
Console logs
CI/CD artifacts

**Current Workaround:**

// Manual masking using evaluate
await passwordField.evaluate((el, val) => {
  el.value = val;
  el.dispatchEvent(new Event('input', { bubbles: true }));
}, secretValue);

**Proposed Solution**
Add a built-in method or option to mask sensitive input values in reports.

Option 1: New method fillSensitive()

await page.getByPlaceholder('Password').fillSensitive(process.env.USER_PASSWORD);
// Report shows: Fill "********" or Fill "[REDACTED]"

Option 2: Add mask option to existing fill() method

await page.getByPlaceholder('Password').fill(process.env.USER_PASSWORD, { mask: true });
// Report shows: Fill "********"

### Example

```typescript
// Login test with sensitive credentials
async login(username: string, password: string) {
  await this.usernameField.fill(username);

  // Current: Password visible in reports
  await this.passwordField.fill(password);

  // Proposed: Password masked in reports
  await this.passwordField.fillSensitive(password);
  // OR
  await this.passwordField.fill(password, { mask: true });
}

### Motivation

**Security Compliance**: Prevents accidental exposure of credentials in test artifacts that may be shared with stakeholders or stored in version control.
**Developer Experience:** Provides a simple, intuitive API without requiring custom workarounds.
**Industry Standard**: Similar to how many frameworks handle sensitive data logging.
**Real-world Impact:** Affects teams testing authentication flows, API integrations, payment systems, and any application using environment variables for secrets.
This feature would significantly improve security posture for teams using Playwright in enterprise environments where test reports are reviewed by security auditors or shared across teams.
Lenguaje dominante
TypeScript
Estrellas
100k
Forks
6.9k
Merge medio
16 h 8 min
PR fusionados (30 d)
281

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de microsoft/playwright

Todos los issues de microsoft/playwright

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.