Make WordPress Core

Changeset 63309 for trunk


Ignore:
Timestamp:
08/16/2026 08:24:05 PM (2 weeks ago)
Author:
desrosj
Message:

Build/Test Tools: Remove all npx commands.

When an npx command is run, the specified package will be downloaded and installed when it does not exist locally. This will also install all of the package’s direct and transitive dependencies, and any installation scripts present for every installed package are run. This is potentially dangerous because a compromised package would be able to run code on a local machine or within a GitHub Actions workflow runner.

This replaces every npx call with npm exec --no, which runs an installed binary only and will fail when the package is missing. Additionally, update-browserslist-db is now defined as a direct devDependency.

Props adrianmoldovanwp, desrosj, lancewillett, johnbillion.
Fixes #65864.

Location:
trunk
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/.github/workflows/reusable-end-to-end-tests.yml

    r62742 r63309  
    101101      - name: Install Playwright browsers
    102102        if: ${{ inputs.install-playwright }}
    103         run: npx playwright install --with-deps chromium
     103        run: npm exec --no -- playwright install --with-deps chromium
    104104
    105105      - name: Build WordPress
  • trunk/.github/workflows/reusable-performance-test-v2.yml

    r62742 r63309  
    149149
    150150      - name: Install Playwright browsers
    151         run: npx playwright install --with-deps chromium
     151        run: npm exec --no -- playwright install --with-deps chromium
    152152
    153153      - name: Start Docker environment
  • trunk/Gruntfile.js

    r62741 r63309  
    22802280                var done = this.async();
    22812281                grunt.util.spawn( {
    2282                         cmd: 'npx',
    2283                         args: [ 'playwright', 'test', '--config', 'tests/qunit/playwright.config.js' ],
     2282                        cmd: 'npm',
     2283                        args: [ 'exec', '--no', '--', 'playwright', 'test', '--config', 'tests/qunit/playwright.config.js' ],
    22842284                        opts: { stdio: 'inherit' }
    22852285                }, function( error, result, code ) {
     
    23642364                const distTag = grunt.option('dist-tag') || 'latest';
    23652365                grunt.log.writeln( `Updating WordPress packages (--dist-tag=${distTag})` );
    2366                 spawn( 'npx', [ 'wp-scripts', 'packages-update', `--dist-tag=${distTag}` ], {
     2366                spawn( 'npm', [ 'exec', '--no', '--', 'wp-scripts', 'packages-update', `--dist-tag=${distTag}` ], {
    23672367                        cwd: __dirname,
    23682368                        stdio: 'inherit',
     
    23712371
    23722372        grunt.registerTask( 'browserslist:update', 'Update the local database of browser supports', function() {
    2373                 grunt.log.writeln( `Updating browsers list` );
    2374                 spawn( 'npx', [ 'update-browserslist-db@latest' ], {
     2373                grunt.log.writeln( 'Updating browsers list' );
     2374                spawn( 'npm', [ 'exec', '--no', '--', 'update-browserslist-db' ], {
    23752375                        cwd: __dirname,
    23762376                        stdio: 'inherit',
  • trunk/package-lock.json

    r63167 r63309  
    9090                                "source-map-loader": "5.0.0",
    9191                                "typescript": "6.0.3",
     92                                "update-browserslist-db": "1.3.1",
    9293                                "uuid": "14.0.1",
    9394                                "wait-on": "9.0.10",
     
    3226732268                },
    3226832269                "node_modules/update-browserslist-db": {
    32269                         "version": "1.2.3",
    32270                         "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.2.3.tgz",
    32271                         "integrity": "sha512-Js0m9cx+qOgDxo0eMiFGEueWztz+d4+M3rGlmKPT+T4IS/jP4ylw3Nwpu6cpTTP8R1MAC1kF4VbdLt3ARf209w==",
     32270                        "version": "1.3.1",
     32271                        "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.3.1.tgz",
     32272                        "integrity": "sha512-ZZ61DsRsOnakl74HAmp3oSN4aXUmEWXf+i/yv0h7tIBfICc3VdrFErQKUUKPgu3AMsTUMbcongALEN4l6GSUrQ==",
    3227232273                        "dev": true,
    3227332274                        "funding": [
  • trunk/package.json

    r63167 r63309  
    7878                "source-map-loader": "5.0.0",
    7979                "typescript": "6.0.3",
     80                "update-browserslist-db": "1.3.1",
    8081                "uuid": "14.0.1",
    8182                "wait-on": "9.0.10",
  • trunk/tests/qunit/playwright.config.js

    r62411 r63309  
    1313        use: {
    1414                headless: true,
    15                 /* This avoids the need to run `npx playwright install` in CI. */
     15                /* The system Chrome channel avoids a browser download in CI. */
    1616                channel: process.env.CI ? 'chrome' : undefined,
    1717        },
Note: See TracChangeset for help on using the changeset viewer.