Skip to content

Commit 04f387e

Browse files
feat(*): Add AppSec support (#157)
* feat(appsec): Add AppSec feature * feat(appsec): Update php common to avoid file_get_contents error on PHP 7.2 * ci(test): Update all test workflows for appsec * ci(release): Update workflow with output instead of env * test(autoprepend): Add delay to make a test pass * test(auto_prepend_file): Update test for standalone mode * feat(autoprepend): Improve debug and error handling Add some jQuery animation in admin * test(end to end): Update test to handle new hidden element * feat(admin): Update success message for multisite tests * feat(*): Minor design update and docs for AppSec * docs(user guide): Fix link * feat(*): Prepare release 2.7.0
1 parent d9e52e6 commit 04f387e

File tree

171 files changed

+4896
-1356
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

171 files changed

+4896
-1356
lines changed

.github/dependabot.yml

Lines changed: 0 additions & 12 deletions
This file was deleted.

.github/workflows/doc-links.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@ jobs:
3737
gem install awesome_bot
3838
cd extension
3939
awesome_bot --files README.md --allow-dupe --allow 401 --skip-save-results --white-list ddev.site --base-url http://localhost:8080/
40-
awesome_bot docs/*.md --skip-save-results --allow-dupe --allow 401 --white-list ddev.site,your-wordpress-url,crowdsec:8080 --base-url http://localhost:8080/docs/
40+
awesome_bot docs/*.md --skip-save-results --allow-dupe --allow 401 --white-list ddev.site,your-wordpress-url,crowdsec:8080,localhost:7422 --base-url http://localhost:8080/docs/

.github/workflows/end-to-end-auto-prepend-test-suite.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,9 @@ jobs:
9595

9696
- name: Prepare for playwright test
9797
run: |
98+
ddev exec -s crowdsec apk add iproute2
99+
cat .ddev/okaeli-add-on/wordpress/custom_files/crowdsec/html/appsec-post.html | ddev wp post create --post_type=page --post_status=publish --post_title="AppSec" -
100+
ddev wp rewrite structure "/%postname%/"
98101
mkdir -p crowdsec/tls
99102
mkdir -p crowdsec/geolocation
100103
cp .ddev/okaeli-add-on/wordpress/custom_files/crowdsec/php/cache-actions-with-wordpress-load.php cache-actions.php
@@ -197,6 +200,21 @@ jobs:
197200
test_path: ${{ github.workspace }}/${{ env.EXTENSION_PATH }}/tests/e2e-ddev
198201
file_path: 8-geolocation.js
199202

203+
- name: Run AppSec tests
204+
uses: ./wp-content/plugins/crowdsec/.github/workflows/end-to-end/run-single-test
205+
with:
206+
test_path: ${{ github.workspace }}/${{ env.EXTENSION_PATH }}/tests/e2e-ddev
207+
file_path: 11-appsec.js
208+
209+
- name: Prepare CrowdSec for AppSec timeout tests
210+
run: ddev exec -s crowdsec tc qdisc add dev eth0 root netem delay 500ms
211+
212+
- name: Run AppSec timeout tests
213+
uses: ./wp-content/plugins/crowdsec/.github/workflows/end-to-end/run-single-test
214+
with:
215+
test_path: ${{ github.workspace }}/${{ env.EXTENSION_PATH }}/tests/e2e-ddev
216+
file_path: 12-appsec-timeout.js
217+
200218
- name: Check tested version
201219
run: |
202220
CURRENT_VERSION=$(ddev wp core version)

.github/workflows/end-to-end-multisite.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -108,6 +108,11 @@ jobs:
108108

109109
- name: Prepare for playwright test
110110
run: |
111+
ddev exec -s crowdsec apk add iproute2
112+
cat .ddev/okaeli-add-on/wordpress/custom_files/crowdsec/html/appsec-post.html | ddev wp post create --url='https://${{ env.WP_VERSION_CODE }}.ddev.site/site1' --post_type=page --post_status=publish --post_title="AppSec" -
113+
cat .ddev/okaeli-add-on/wordpress/custom_files/crowdsec/html/appsec-post.html | ddev wp post create --url='https://${{ env.WP_VERSION_CODE }}.ddev.site/site2' --post_type=page --post_status=publish --post_title="AppSec" -
114+
ddev wp rewrite structure "/%postname%/" --url='https://${{ env.WP_VERSION_CODE }}.ddev.site/site1'
115+
ddev wp rewrite structure "/%postname%/" --url='https://${{ env.WP_VERSION_CODE }}.ddev.site/site2'
111116
mkdir -p crowdsec/tls
112117
mkdir -p crowdsec/geolocation
113118
cp .ddev/okaeli-add-on/wordpress/custom_files/crowdsec/php/cache-actions-with-wordpress-load.php cache-actions.php
@@ -195,6 +200,23 @@ jobs:
195200
file_path: 8-geolocation.js
196201
subsite: ${{ matrix.subsite }}
197202

203+
- name: Run AppSec tests
204+
uses: ./wp-content/plugins/crowdsec/.github/workflows/end-to-end/run-single-test
205+
with:
206+
test_path: ${{ github.workspace }}/${{ env.EXTENSION_PATH }}/tests/e2e-ddev
207+
file_path: 11-appsec.js
208+
subsite: ${{ matrix.subsite }}
209+
210+
- name: Prepare CrowdSec for AppSec timeout tests
211+
run: ddev exec -s crowdsec tc qdisc add dev eth0 root netem delay 500ms
212+
213+
- name: Run AppSec timeout tests
214+
uses: ./wp-content/plugins/crowdsec/.github/workflows/end-to-end/run-single-test
215+
with:
216+
test_path: ${{ github.workspace }}/${{ env.EXTENSION_PATH }}/tests/e2e-ddev
217+
file_path: 12-appsec-timeout.js
218+
subsite: ${{ matrix.subsite }}
219+
198220
- name: Check tested version
199221
run: |
200222
CURRENT_VERSION=$(ddev wp core version)

.github/workflows/end-to-end-test-suite.yml

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,11 @@ on:
66
paths-ignore:
77
- '**.md'
88
workflow_dispatch:
9+
inputs:
10+
debug_enabled:
11+
type: boolean
12+
description: Debug with tmate
13+
default: false
914
schedule:
1015
- cron: '15 3 * * 4'
1116

@@ -36,8 +41,6 @@ jobs:
3641
php-version: '8.0'
3742
- wp-version: '6.6'
3843
php-version: '7.2'
39-
- wp-version: '6.6'
40-
php-version: '8.0'
4144
- wp-version: '6.6'
4245
php-version: '8.3'
4346

@@ -109,6 +112,9 @@ jobs:
109112

110113
- name: Prepare for playwright test
111114
run: |
115+
ddev exec -s crowdsec apk add iproute2
116+
cat .ddev/okaeli-add-on/wordpress/custom_files/crowdsec/html/appsec-post.html | ddev wp post create --post_type=page --post_status=publish --post_title="AppSec" -
117+
ddev wp rewrite structure "/%postname%/"
112118
mkdir -p crowdsec/tls
113119
mkdir -p crowdsec/geolocation
114120
cp .ddev/okaeli-add-on/wordpress/custom_files/crowdsec/php/cache-actions-with-wordpress-load.php cache-actions.php
@@ -189,6 +195,22 @@ jobs:
189195
test_path: ${{ github.workspace }}/${{ env.EXTENSION_PATH }}/tests/e2e-ddev
190196
file_path: 8-geolocation.js
191197

198+
- name: Run AppSec tests
199+
uses: ./wp-content/plugins/crowdsec/.github/workflows/end-to-end/run-single-test
200+
with:
201+
test_path: ${{ github.workspace }}/${{ env.EXTENSION_PATH }}/tests/e2e-ddev
202+
file_path: 11-appsec.js
203+
204+
205+
- name: Prepare CrowdSec for AppSec timeout tests
206+
run: ddev exec -s crowdsec tc qdisc add dev eth0 root netem delay 500ms
207+
208+
- name: Run AppSec timeout tests
209+
uses: ./wp-content/plugins/crowdsec/.github/workflows/end-to-end/run-single-test
210+
with:
211+
test_path: ${{ github.workspace }}/${{ env.EXTENSION_PATH }}/tests/e2e-ddev
212+
file_path: 12-appsec-timeout.js
213+
192214
- name: Check tested version
193215
run: |
194216
CURRENT_VERSION=$(ddev wp core version)
@@ -201,4 +223,12 @@ jobs:
201223
echo ${{ matrix.wp-version }}
202224
exit 1
203225
fi
226+
227+
- name: tmate debugging session
228+
uses: mxschmitt/action-tmate@v3
229+
with:
230+
limit-access-to-actor: true
231+
github-token: ${{ secrets.GITHUB_TOKEN }}
232+
timeout-minutes: 15
233+
if: failure() && github.event.inputs.debug_enabled == 'true'
204234

.github/workflows/release-test.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,9 @@ jobs:
132132
133133
- name: Prepare for playwright test
134134
run: |
135+
ddev exec -s crowdsec apk add iproute2
136+
cat .ddev/okaeli-add-on/wordpress/custom_files/crowdsec/html/appsec-post.html | ddev wp post create --post_type=page --post_status=publish --post_title="AppSec" -
137+
ddev wp rewrite structure "/%postname%/"
135138
mkdir -p crowdsec/tls
136139
mkdir -p crowdsec/geolocation
137140
cp .ddev/okaeli-add-on/wordpress/custom_files/crowdsec/php/cache-actions-with-wordpress-load.php cache-actions.php
@@ -211,6 +214,12 @@ jobs:
211214
test_path: ${{ github.workspace }}/${{ env.EXTENSION_PATH }}/tests/e2e-ddev
212215
file_path: 8-geolocation.js
213216

217+
- name: Run AppSec tests
218+
uses: ./wp-content/plugins/crowdsec/.github/workflows/end-to-end/run-single-test
219+
with:
220+
test_path: ${{ github.workspace }}/${{ env.EXTENSION_PATH }}/tests/e2e-ddev
221+
file_path: 11-appsec.js
222+
214223
- name: tmate debugging session
215224
uses: mxschmitt/action-tmate@v3
216225
with:

0 commit comments

Comments
 (0)