Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Maintenance: updating deps, icon chooser, and accommodating security policies #218

Merged
merged 97 commits into from
Jun 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
3fe029a
WIP: replacing redux with @wordpress/data
mlwilkerson May 24, 2024
7d72d99
switch to using POST instead of PUT for the /config route and remove …
mlwilkerson May 24, 2024
ad86724
use the real createInterpolateElement
mlwilkerson May 24, 2024
0cdb87e
update many deps
mlwilkerson May 24, 2024
a44bee4
Revert "WIP: replacing redux with @wordpress/data"
mlwilkerson May 24, 2024
626ae2c
update redux-thunk import
mlwilkerson May 24, 2024
5892737
fix api query REST route to use application/json content-type
mlwilkerson May 24, 2024
7e0e89f
re-build with new deps and webpack config
mlwilkerson May 25, 2024
26dd71e
fix up some actions tests that now use POST
mlwilkerson May 25, 2024
b4c4665
update query handling to allow for JSON documents
mlwilkerson May 25, 2024
85ba1d2
update yost/phpunit-polyfills dep
mlwilkerson May 28, 2024
a5c114b
update and test query API to accept associative array with variables
mlwilkerson May 28, 2024
7354698
make resetAxiosMocks do more resetting
mlwilkerson May 28, 2024
9e34928
WIP: playwright config and setup
mlwilkerson May 29, 2024
5d04fa8
cleanup the proKit setup
mlwilkerson May 29, 2024
114f9d6
finish the new playwright test for block editing with icon chooser
mlwilkerson May 30, 2024
d233c9c
remove obsolete block editor e2e test
mlwilkerson May 30, 2024
0e8f0d7
update test description
mlwilkerson May 30, 2024
91658a8
formatting
mlwilkerson May 30, 2024
e941361
gitignore some playright artifacts
mlwilkerson May 30, 2024
71bf983
rebuild JS bundle
mlwilkerson May 30, 2024
a2313f8
bring back the compatibility handling for createInterpolateElement
mlwilkerson May 30, 2024
1bdadfd
go back to only importing the current version of createInterpolateEle…
mlwilkerson May 30, 2024
7abb05b
re-enable building with --webpack-no-externals
mlwilkerson May 30, 2024
af1aa4f
rebuild production admin bundle
mlwilkerson May 30, 2024
672f84b
back to using compat form of createInterpolateElement
mlwilkerson May 31, 2024
31d549d
add comment
mlwilkerson May 31, 2024
5e1f4ce
drop the react-redux dep version for compatibility
mlwilkerson May 31, 2024
1710395
bring back the handling of custom externals
mlwilkerson May 31, 2024
c676599
rebuild admin bundle
mlwilkerson May 31, 2024
7dee864
update Dockerfile and scripts to enable mod_security with OWASP
mlwilkerson May 31, 2024
37c118b
config for mod_security with OWASP core ruleset and conditionally all…
mlwilkerson Jun 1, 2024
ab98675
make mod_security more configurable when starting a container
mlwilkerson Jun 3, 2024
e33d948
add e2e test for conflict scanning and blocking
mlwilkerson Jun 3, 2024
1153e68
Change the HTTP verb for conflict detection from PUT to POST
mlwilkerson Jun 3, 2024
091ff2b
rebuild admin bundle
mlwilkerson Jun 3, 2024
bf52c07
change HTTP verb for v3deprecation snoozer from PUT to POST
mlwilkerson Jun 3, 2024
29a46ec
rebuild admin bundle
mlwilkerson Jun 3, 2024
86fbf12
remove out of date react tests
mlwilkerson Jun 3, 2024
94b1748
add test to ensure that browser globals are not overriden
mlwilkerson Jun 3, 2024
30eb688
WIP: adding a container for wp 6.0
mlwilkerson Jun 4, 2024
1e268dd
update e2e test for WP 6.0
mlwilkerson Jun 4, 2024
242e03b
wire up dev environment for WP 6.0
mlwilkerson Jun 4, 2024
70d09fa
update php8.2 composer deps
mlwilkerson Jun 4, 2024
0ca6b7e
update the WP 5.4 docker image build
mlwilkerson Jun 4, 2024
8d8f698
change e2e test reset logic to not use REST API
mlwilkerson Jun 4, 2024
99b866b
rework docker config for wp5.4
mlwilkerson Jun 4, 2024
c349367
Revert "change e2e test reset logic to not use REST API"
mlwilkerson Jun 4, 2024
136add3
refactor e2e test setup
mlwilkerson Jun 4, 2024
3f37b5f
change default db host
mlwilkerson Jun 4, 2024
3fe0672
update config controller tests to change PUT to POST
mlwilkerson Jun 4, 2024
9b448a7
WIP: making test-enqueue more readable
mlwilkerson Jun 5, 2024
9ad3cfe
WIP: refactor and correct test-enqueue
mlwilkerson Jun 5, 2024
4e387c4
more refactoring and fixing of EnqueueTest
mlwilkerson Jun 5, 2024
0f6176a
auto-formatting
mlwilkerson Jun 5, 2024
f0af933
rename file
mlwilkerson Jun 5, 2024
46f3932
fix for phpcs
mlwilkerson Jun 5, 2024
f5d32d3
auto-formatting
mlwilkerson Jun 5, 2024
05be44a
re-organize e2e tests and add one for apiEndpoint compat
mlwilkerson Jun 5, 2024
4306d76
update deps for fa-icon-chooser
mlwilkerson Jun 5, 2024
3ce3a69
rebuild admin bundle
mlwilkerson Jun 5, 2024
831c45a
remove docsrv and update DEVELOPMENT.md about previewing docs
mlwilkerson Jun 6, 2024
d1d9a02
update php test workflow
mlwilkerson Jun 6, 2024
e5ab8b1
add playwright test run in CI
mlwilkerson Jun 6, 2024
9dbadb4
rename javascript workflow
mlwilkerson Jun 6, 2024
c83927a
change workflow name
mlwilkerson Jun 6, 2024
72c22f6
add separate playwright workflow
mlwilkerson Jun 6, 2024
eafc889
Revert "rename javascript workflow"
mlwilkerson Jun 6, 2024
5f2dd19
remove playwright from Jest workflow
mlwilkerson Jun 6, 2024
c7f0be8
add composer files for php7.4
mlwilkerson Jun 6, 2024
d051faa
remove playwright workflow
mlwilkerson Jun 6, 2024
70aaa08
update composer-php7.4.lock
mlwilkerson Jun 6, 2024
e47a5c3
add Dockerfile for php7.4
mlwilkerson Jun 6, 2024
6d446e9
Change docker compose config for php7.4 and WP 4.7
mlwilkerson Jun 6, 2024
866a36a
update composer.lock
mlwilkerson Jun 6, 2024
f52c965
update composer configs for php8.3
mlwilkerson Jun 6, 2024
96581fe
set up docker config for php8.3
mlwilkerson Jun 6, 2024
2a05d79
remove composer files for php8.2
mlwilkerson Jun 6, 2024
ca586d6
update composer lock for php8.1
mlwilkerson Jun 6, 2024
7905d04
temporarily reduce number of php versions in test matrix
mlwilkerson Jun 6, 2024
4fb0cd4
remove docker compose config for php8.2 and update php8.1
mlwilkerson Jun 6, 2024
4de2955
fix require path for match-result.php
mlwilkerson Jun 6, 2024
cd2ad3b
update composer.lock for php 8.0
mlwilkerson Jun 6, 2024
af6c75f
update composer lock for php7.3
mlwilkerson Jun 6, 2024
0b9dfcc
update composer lock for php7.2
mlwilkerson Jun 6, 2024
db8076e
update composer lock for php7.1
mlwilkerson Jun 6, 2024
2efc154
re-enable all versions of php in test matrix
mlwilkerson Jun 6, 2024
3d3688f
update compat-js bundle deps and config
mlwilkerson Jun 6, 2024
fb46c9b
update docker config for wp 5.0
mlwilkerson Jun 6, 2024
8522a73
migrate the changeTechnology e2e test to playwright
mlwilkerson Jun 6, 2024
08e6758
add e2e test for inserting via icon chooser in full site editor
mlwilkerson Jun 7, 2024
e646f65
update DEVELOPMENT.md about playwright tests and mod_security
mlwilkerson Jun 7, 2024
23e248b
update fullSiteEditor e2e test to work on subsequent runs after clear…
mlwilkerson Jun 7, 2024
75f32b9
update env.js to load .env and .env.local to use override mode
mlwilkerson Jun 7, 2024
4aacd5e
update DEVELOPMENT.md
mlwilkerson Jun 7, 2024
061d993
use env var for kit token
mlwilkerson Jun 7, 2024
a25fd66
update DEVELOPMENT.md about env vars for kit and api tokens
mlwilkerson Jun 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,14 @@ WORDPRESS_DEBUG=true
WORDPRESS_DEBUG_LOG=true
FONTAWESOME_ENV=development
MYSQL_ROOT_PASSWORD=somewordpress
# This should be false by default.
# It could be overridden in .env.local.
# This pertains to the mod_security OWASP core rule set.
ENABLE_MOD_SECURITY=false

# ENABLE_MOD_SECURITY=true, then the following
# may be set to "true" to make exceptions to the usual mod_security rules,
# allowing any requests on the font-awesome REST API routes that would
# otherwise be blocked by the core rule set.
#
# ALLOW_ALL_REQUESTS_FOR_FONT_AWESOME=true
16 changes: 8 additions & 8 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: PHP Composer
name: PHP Tests

on:
push:
Expand Down Expand Up @@ -34,12 +34,12 @@ jobs:

strategy:
matrix:
php: ['7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2']
php: ['7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3']
wordpress: [latest]
include:
- php: '5.6'
wordpress: 5.2.5
- php: '7.4'
- php: '8.3'
wordpress: trunk

steps:
Expand All @@ -52,7 +52,7 @@ jobs:
- name: Validate composer.json and composer.lock
id: composer-lock
run: |
if [ ${{ matrix.php }} == '7.4' ]; then
if [ ${{ matrix.php }} == '8.2' ]; then
composer validate
LOCK_FILE=composer.lock
COMPOSER_FILE=composer.json
Expand Down Expand Up @@ -213,10 +213,10 @@ jobs:
# only run the output tests on the newer versions of php and phpunit, cause
# they're trickier
run: |
if [ "5.6" == ${{ matrix.php }} ] || [ "7.1" == ${{ matrix.php }} ] || [ "7.2" == ${{ matrix.php }} ] || [ "7.3" == ${{ matrix.php }} ]; then
PHP_UNIT_ARGS="--exclude-group output"
else
if [ "8.3" == ${{ matrix.php }} ]; then
PHP_UNIT_ARGS=""
else
PHP_UNIT_ARGS="--exclude-group output"
fi

WP_PLUGIN_DIR="$(pwd)" \
Expand Down Expand Up @@ -267,7 +267,7 @@ jobs:

- name: Maybe run phpcs
run: |
if [ ${{ matrix.php }} == '7.4' ] && [ ${{ matrix.wordpress }} == latest ]; then
if [ ${{ matrix.php }} == '8.3' ] && [ ${{ matrix.wordpress }} == latest ]; then
composer phpcs
echo
echo "Skipping phpcs"
Expand Down
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@ tmp/
webpack-stats.html
webpack-stats.json
.phpunit.result.cache
admin/src/playwright/.auth/
admin/artifacts/
admin/test-results/
87 changes: 81 additions & 6 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
- [Optional Development Setup Steps](#optional-development-setup-steps)
- [Run tests with phpunit](#run-tests-with-phpunit)
* [Pass arguments to phpunit](#pass-arguments-to-phpunit)
- [Run end-to-end tests with playwright](#run-end-to-end-tests-with-playwright)
- [Use wp-cli within your Docker environment](#use-wp-cli-within-your-docker-environment)
- [Run anything else within your Docker environment](#run-anything-else-within-your-docker-environment)
* [Run a shell insider your Docker environment](#run-a-shell-inside-your-docker-environment)
Expand All @@ -18,6 +19,7 @@
* [Main Options](#main-options)
* [Releases Metadata Transient](#releases-metadata-transient)
* [V3 Deprecation Warning](#v3-deprecation-warning)
- [Managing web security rules](#managing-web-security-rules)
- [Cut a Release](#cut-a-release)
- [Run a Local Docs Server](#run-a-local-docs-server)
- [Special Notes on plugin-sigma](#special-notes-on-plugin-sigma)
Expand Down Expand Up @@ -609,6 +611,53 @@ Everything before the `--` are the options do the `bin/phpunit` script, and ever
to the `phpunit` command inside the container.
</details>

# Run end-to-end tests with playwright

## Add tokens to `.env.local`

```
API_TOKEN=YOUR_FA_API_TOKEN
KIT_TOKEN=YOUR_KIT_TOKEN
```

To run the end-to-end tests, you must have the WordPress environment running.
For example, from the top-level directory, run this:

```bash
bin/dev
```

Leave that running in one terminal and do the following in a separate terminal.

Playwright must be also installed when initializing a local dev environment:
```bash
cd admin
npx playwright install --with-deps
```

Then, still in the `admin` directory, run tests on the terminal:
```bash
npx playwright test
```

Or run the tests in the Playwright UI:
```bash
npx playwright test --ui
```

Or in debug mode:
```bash
npx playwright test --debug
```

See also [Playwright docs](https://playwright.dev/docs/intro).

## WordPress Version Caveat

The end-to-end tests may use features of WordPress that are not present in older versions, so their
use on older versions may be limited. But within those limits, at least some of them are useful for
running against older versions of WordPress to ensure compatibility.

# Use WP-CLI within your Docker environment

For example,
Expand Down Expand Up @@ -731,6 +780,36 @@ Remove it:
$ bin/wp transient delete font-awesome-v3-deprecation-data
```

# Managing web security rules

For the `latest` docker image, the latest release of the [OWASP core ruleset](https://coreruleset.org/) is installed by default,
but _not_ enabled by default. This simulates what are probably common Web Application Firewall configurations for WordPress hosting providers.

By default, it merely audits. See the log in `/var/log/apache2/modsec_audit.log`.

To enable filtering--actually rejecting requests that exceed the rules' tolerances--edit your `.env.local`:

```
ENABLE_MOD_SECURITY=true
```

Note that this env var setting must be present in the environment when the docker container is created.
So if you've already started a container, you'll need to stop and remove it, then change this env var,
then start it back up.

You can watch the terminal where `apache2` is launched in the container. When `mod_security` is not enabled,
it'll look like this:

```
'apache2 -D FOREGROUND -D DEVELOPMENT'
```

When `mod_security` is enabled, it'll look like this:

```
'apache2 -D FOREGROUND -D DEVELOPMENT -D EnableModSecurity'
```

# Cut a Release

## Running composer commands for the release
Expand Down Expand Up @@ -1181,15 +1260,11 @@ If you want to preview the built docs with a web server, first build the docs:
bin/phpdoc
```

Then go into the `docsrv` directory and run the doc server:
Then go into the `docs` directory and run:
```
cd docsrv
npm install
node index.js
npx serve
```

Point a web browser at `http://localhost:3000`.

# Special Notes on plugin-sigma

`plugin-sigma` demonstrates how a third-party plugin developer could include this Font Awesome plugin as a composer
Expand Down
1 change: 0 additions & 1 deletion admin/build/0-731a0dbb53704ba81085.js

This file was deleted.

1 change: 0 additions & 1 deletion admin/build/1-2963a8c24519c41a3b57.js

This file was deleted.

Loading
Loading