Skip to content

Commit 324385b

Browse files
feat(*): Enable admin bounce by default (#161)
* feat(admin): Enable protection by default on admin * test(end to end): Disable protection on admin for test * fix(captcha): Patch Gregwar Captcha to avoid deprecated error in PHP 8.4 * feat(*): Prepare release 2.8.0
1 parent a8f453a commit 324385b

Some content is hidden

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

60 files changed

+4223
-545
lines changed

.github/workflows/release.yml

Lines changed: 0 additions & 208 deletions
Original file line numberDiff line numberDiff line change
@@ -161,211 +161,3 @@ jobs:
161161
draft: false
162162
prerelease: false
163163

164-
end-to-end-release-zip-test:
165-
strategy:
166-
fail-fast: false
167-
# First and last minor versions of each major version
168-
# Highest compatible PHP version
169-
matrix:
170-
include:
171-
- wp-version: '4.9'
172-
php-version: '7.2'
173-
- wp-version: '5.0'
174-
php-version: '7.2'
175-
- wp-version: '5.9'
176-
php-version: '7.2'
177-
- wp-version: '5.9'
178-
php-version: '8.0'
179-
- wp-version: '6.0'
180-
php-version: '7.2'
181-
- wp-version: '6.0'
182-
php-version: '8.0'
183-
- wp-version: '6.7'
184-
php-version: '7.2'
185-
- wp-version: '6.7'
186-
php-version: '8.3'
187-
188-
name: End-to-end release test suite
189-
runs-on: ubuntu-latest
190-
if: success()
191-
needs: [ deploy-create-release ]
192-
193-
env:
194-
EXTENSION_NAME: "CrowdSec_Bouncer"
195-
EXTENSION_PATH: "wp-content/plugins/crowdsec"
196-
GITHUB_ORIGIN: "crowdsecurity/cs-wordpress-bouncer"
197-
198-
steps:
199-
200-
- name: Install DDEV
201-
# @see https://ddev.readthedocs.io/en/stable/#installationupgrade-script-linux-and-macos-armarm64-and-amd64-architectures
202-
run: |
203-
curl -fsSL https://apt.fury.io/drud/gpg.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/ddev.gpg > /dev/null
204-
echo "deb [signed-by=/etc/apt/trusted.gpg.d/ddev.gpg] https://apt.fury.io/drud/ * *" | sudo tee /etc/apt/sources.list.d/ddev.list
205-
sudo apt-get -q update
206-
sudo apt-get -q -y install libnss3-tools ddev
207-
mkcert -install
208-
ddev config global --instrumentation-opt-in=false --omit-containers=ddev-ssh-agent
209-
210-
- name: Set WP_VERSION_CODE env
211-
# used in some directory path and conventional file naming
212-
# Example : 5.6.5 => wp565
213-
id: set-wp-version-code
214-
run: |
215-
echo "wp_version_code=$(echo wp${{ matrix.wp-version }} | sed 's/\.//g' )" >> $GITHUB_OUTPUT
216-
217-
- name: Create empty WordPress DDEV project (with Apache)
218-
run: ddev config --project-type=wordpress --project-name=${{ steps.set-wp-version-code.outputs.wp_version_code }} --php-version=${{ matrix.php-version }} --webserver-type=apache-fpm
219-
220-
- name: Disable automatic update
221-
run: |
222-
# @see https://wordpress.org/documentation/article/configuring-automatic-background-updates/#constant-to-disable-all-updates
223-
sed -i -e 's/#ddev-generated//g' wp-config-ddev.php
224-
echo "define( 'AUTOMATIC_UPDATER_DISABLED', true );" >> wp-config-ddev.php
225-
226-
- name: Add Redis, Memcached, Crowdsec and Playwright
227-
run: |
228-
ddev get ddev/ddev-redis
229-
ddev get ddev/ddev-memcached
230-
ddev get julienloizelet/ddev-playwright
231-
# override redis.conf
232-
ddev get julienloizelet/ddev-tools
233-
ddev get julienloizelet/ddev-crowdsec-php
234-
235-
- name: Start DDEV
236-
uses: nick-fields/retry@v3
237-
with:
238-
timeout_minutes: 5
239-
max_attempts: 3
240-
shell: bash
241-
command: |
242-
ddev start
243-
244-
- name: Download WordPress
245-
run: ddev wp core download --version=${{ matrix.wp-version }}
246-
247-
- name: Setup WordPress ${{ matrix.wp-version }} with PHP ${{ matrix.php-version }}
248-
run: |
249-
ddev exec wp core install --url='https://${{ steps.set-wp-version-code.outputs.wp_version_code }}.ddev.site' --title='WordPress' --admin_user='admin' --admin_password='admin123' --admin_email='admin@admin.com'
250-
251-
- name: Set LAST_TAG env
252-
id: set-last-tag
253-
run: |
254-
echo "last_tag=$(curl -Ls -o /dev/null -w %{url_effective} https://github.com/${{ env.GITHUB_ORIGIN }}/releases/latest | grep -oP "\/tag\/v\K(.*)$")" >> $GITHUB_OUTPUT
255-
256-
- name: Clone files from last release
257-
uses: actions/checkout@v4
258-
with:
259-
path: raw_sources
260-
ref: "v${{ steps.set-last-tag.outputs.last_tag }}"
261-
repository: "${{ env.GITHUB_ORIGIN }}"
262-
263-
- name: Retrieve last stable release zip
264-
run: |
265-
curl -fL https://downloads.wordpress.org/plugin/crowdsec.${{ steps.set-last-tag.outputs.last_tag }}.zip -o crowdsec.$LAST_TAG.zip
266-
unzip crowdsec.${{ steps.set-last-tag.outputs.last_tag }}.zip -d ${{ github.workspace }}/wp-content/plugins
267-
268-
- name: Copy needed tests files
269-
run: |
270-
cp -r raw_sources/tests wp-content/plugins/crowdsec
271-
cp -r raw_sources/.github wp-content/plugins/crowdsec
272-
273-
- name: Prepare for playwright test
274-
run: |
275-
ddev exec -s crowdsec apk add iproute2
276-
cp .ddev/okaeli-add-on/wordpress/custom_files/crowdsec/php/wp_appsec_custom_upload.php wp_appsec_custom_upload.php
277-
cat .ddev/okaeli-add-on/wordpress/custom_files/crowdsec/html/appsec-upload.html | ddev wp post create --post_type=page --post_status=publish --post_title="AppSec Upload" -
278-
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" -
279-
ddev wp rewrite structure "/%postname%/"
280-
mkdir -p crowdsec/tls
281-
mkdir -p crowdsec/geolocation
282-
cp .ddev/okaeli-add-on/wordpress/custom_files/crowdsec/php/cache-actions-with-wordpress-load.php cache-actions.php
283-
cp -r .ddev/okaeli-add-on/custom_files/crowdsec/cfssl/* crowdsec/tls
284-
ddev maxmind-download DEFAULT GeoLite2-City crowdsec/geolocation
285-
ddev maxmind-download DEFAULT GeoLite2-Country crowdsec/geolocation
286-
cd crowdsec/geolocation
287-
sha256sum -c GeoLite2-Country.tar.gz.sha256.txt
288-
sha256sum -c GeoLite2-City.tar.gz.sha256.txt
289-
tar -xf GeoLite2-Country.tar.gz
290-
tar -xf GeoLite2-City.tar.gz
291-
rm GeoLite2-Country.tar.gz GeoLite2-Country.tar.gz.sha256.txt GeoLite2-City.tar.gz GeoLite2-City.tar.gz.sha256.txt
292-
cd ${{ github.workspace }}/${{ env.EXTENSION_PATH }}/tests/e2e-ddev/__scripts__
293-
chmod +x test-init.sh
294-
./test-init.sh
295-
chmod +x run-tests.sh
296-
297-
- name: Some DEBUG information
298-
run: |
299-
ddev --version
300-
ddev exec php -v
301-
ddev exec -s crowdsec crowdsec -version
302-
303-
- name: Run Plugin activation tests
304-
uses: ./wp-content/plugins/crowdsec/.github/workflows/end-to-end/run-single-test
305-
with:
306-
test_path: ${{ github.workspace }}/${{ env.EXTENSION_PATH }}/tests/e2e-ddev
307-
file_path: 1-activate-plugin.js
308-
309-
- name: Configure CrowdSec and Wordpress bouncer plugin
310-
run: |
311-
ddev crowdsec-config
312-
313-
- name: Run Live mode remediation tests
314-
uses: ./wp-content/plugins/crowdsec/.github/workflows/end-to-end/run-single-test
315-
with:
316-
test_path: ${{ github.workspace }}/${{ env.EXTENSION_PATH }}/tests/e2e-ddev
317-
file_path: 2-live-mode-remediations.js
318-
319-
- name: Run more Live mode remediation tests
320-
uses: ./wp-content/plugins/crowdsec/.github/workflows/end-to-end/run-single-test
321-
with:
322-
test_path: ${{ github.workspace }}/${{ env.EXTENSION_PATH }}/tests/e2e-ddev
323-
file_path: 3-live-mode-more.js
324-
325-
- name: Run Live mode cache tests
326-
uses: ./wp-content/plugins/crowdsec/.github/workflows/end-to-end/run-single-test
327-
with:
328-
test_path: ${{ github.workspace }}/${{ env.EXTENSION_PATH }}/tests/e2e-ddev
329-
file_path: 4-live-mode-cache.js
330-
331-
- name: Prepare cron usage
332-
run: |
333-
sed -i 's/fastcgi_finish_request/\/\/fastcgi_finish_request/g' wp-cron.php
334-
335-
- name: Run Stream mode tests
336-
uses: ./wp-content/plugins/crowdsec/.github/workflows/end-to-end/run-single-test
337-
with:
338-
test_path: ${{ github.workspace }}/${{ env.EXTENSION_PATH }}/tests/e2e-ddev
339-
file_path: 5-stream-mode.js
340-
341-
- name: Run Redis tests
342-
uses: ./wp-content/plugins/crowdsec/.github/workflows/end-to-end/run-single-test
343-
with:
344-
test_path: ${{ github.workspace }}/${{ env.EXTENSION_PATH }}/tests/e2e-ddev
345-
file_path: 6-redis.js
346-
347-
- name: Run Memcached tests
348-
uses: ./wp-content/plugins/crowdsec/.github/workflows/end-to-end/run-single-test
349-
with:
350-
test_path: ${{ github.workspace }}/${{ env.EXTENSION_PATH }}/tests/e2e-ddev
351-
file_path: 7-memcached.js
352-
353-
- name: Run Geolocation tests
354-
uses: ./wp-content/plugins/crowdsec/.github/workflows/end-to-end/run-single-test
355-
with:
356-
test_path: ${{ github.workspace }}/${{ env.EXTENSION_PATH }}/tests/e2e-ddev
357-
file_path: 8-geolocation.js
358-
359-
- name: Run AppSec tests
360-
uses: ./wp-content/plugins/crowdsec/.github/workflows/end-to-end/run-single-test
361-
with:
362-
test_path: ${{ github.workspace }}/${{ env.EXTENSION_PATH }}/tests/e2e-ddev
363-
file_path: 11-appsec.js
364-
365-
- name: tmate debugging session
366-
uses: mxschmitt/action-tmate@v3
367-
with:
368-
limit-access-to-actor: true
369-
github-token: ${{ secrets.GITHUB_TOKEN }}
370-
timeout-minutes: 30
371-
if: failure()

CHANGELOG.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
66

77
---
88

9+
10+
## [2.8.0](https://github.com/crowdsecurity/cs-wordpress-bouncer/releases/tag/v2.8.0) - 2024-12-13
11+
[_Compare with previous release_](https://github.com/crowdsecurity/cs-wordpress-bouncer/compare/v2.7.0...v2.8.0)
12+
13+
14+
### Changed
15+
16+
- Set the "Public website only" setting to OFF by default
17+
18+
### Fixed
19+
20+
- Fix deprecated warning in PHP 8.4 for Captcha
21+
22+
---
23+
24+
925
## [2.7.0](https://github.com/crowdsecurity/cs-wordpress-bouncer/releases/tag/v2.7.0) - 2024-12-12
1026
[_Compare with previous release_](https://github.com/crowdsecurity/cs-wordpress-bouncer/compare/v2.6.7...v2.7.0)
1127

composer.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,17 @@
1616
"config" : {
1717
"platform": {
1818
"php": "7.2.5"
19+
},
20+
"allow-plugins": {
21+
"cweagans/composer-patches": true
1922
}
2023
},
2124
"require": {
2225
"crowdsec/bouncer": "^3.2.0",
2326
"symfony/cache": "5.4.40",
2427
"symfony/polyfill-mbstring": "^1.31.0",
25-
"symfony/service-contracts": "^2.5.3"
28+
"symfony/service-contracts": "^2.5.3",
29+
"cweagans/composer-patches": "^1.7"
2630
},
2731
"replace": {
2832
"twig/twig": "*"
@@ -31,5 +35,12 @@
3135
"psr-4": {
3236
"CrowdSecWordPressBouncer\\": "./inc/"
3337
}
38+
},
39+
"extra": {
40+
"patches": {
41+
"gregwar/captcha": {
42+
"Fix deprecation in CaptchaBuilder constructor": "patches/gregwar-captcha-constructor.patch"
43+
}
44+
}
3445
}
3546
}

0 commit comments

Comments
 (0)