Skip to content

[Feature]: add checksum validation to browser installation #38762

@Eric-Arellano

Description

@Eric-Arellano

🚀 Feature Request

Add to playwright-core a file with the expected SHA256 checksums for the browser binaries installed by browsers.json. playwright install will validate that the checksum matches what is expected after downloading binaries. If there is a mismatch, the install process will fail.

The script roll_browser.js would be updated to embed the checksums into playwright-core in the same PR that bumps the revision number. It would generate the SHA256 checksum based on the downloaded file.

Example

No response

Motivation

This proposal is to improve supply chain security for all Playwright browser users. Checksum validation substantially reduces the risk of a bad actor overwriting the binaries hosted in Azure with malicious binaries.

Why do I propose storing the checksums in the source code itself, rather than pulling it from the server? Pulling the checksums from the same server where the binaries are downloaded would not give much security improvement because a bad actor could simply rewrite the checksums to match their malicious binary.

Given that npmjs.com dependencies are immutable, once a playwright-core version is released, the embedded checksums cannot be compromised. This means that an attacker who compromises Azure cannot inject malicious binaries for existing releases.

My proposal does still have a limitation: if Azure was compromised during the specific roll_browser.js execution, and that compromise goes undetected until after the PR merges and the version ships to NPM, then the new version would have malicious checksums. (The bad version could be yanked once detected.)

However, despite this limitation, this feature still substantially improves the security posture:

  • Current state: Azure compromises at any time can retroactively compromise all historical Playwright releases
  • Proposed state: Azure compromise only affects versions rolled with roll_browser.js during the narrow compromise window; existing releases remain protected. There is a chance to detect the compromise before the bad roll_browser.js result is merged and released.

I would be interested in contributing this feature on behalf of IBM.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions