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

Đang mở
#38,673 6 bình luận 17 reaction 1 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@dgozman đang làm issue này rồi.

Từ ngày 5/1/2026.

Đánh giá

Issue này chưa được đánh giá.

Mô tả

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.
Ngôn ngữ chính
TypeScript
Star
100k
Fork
6.9k
Merge trung bình
16 giờ 8 phút
Pull request đã merge (30 ngày)
281

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của microsoft/playwright

Tất cả issue của microsoft/playwright

Issue tương tự

Thêm issue về TypeScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.