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

未关闭
#38,673 6 条评论 17 个 reaction 已指派 1 人 在 GitHub 查看

维护者通常 1 天内回复

@dgozman 已经在做这个了。

开始于 2026年1月5日。

评估

这个 Issue 还没有评估数据。

描述

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.
主要语言
TypeScript
星标
100k
派生
6.9k
平均合并
16 小时 8 分钟
30 天内合并 PR
281

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

microsoft/playwright 的其他 Issue

查看 microsoft/playwright 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。