Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
efffa9d
alert init (#3)
gam6itko Nov 7, 2025
491b40d
try to fix phpmd
gam6itko Nov 7, 2025
7edec8e
up
gam6itko Nov 7, 2025
46c399d
up
gam6itko Nov 7, 2025
444dd53
up
gam6itko Nov 7, 2025
046dc78
up
gam6itko Nov 7, 2025
a782589
up
gam6itko Nov 7, 2025
dc0ce78
up
gam6itko Nov 7, 2025
cb0e8b2
try to satisfy psalm
gam6itko Nov 7, 2025
10f445d
try to satisfy psalm
gam6itko Nov 7, 2025
9cbce91
try to satisfy psalm
gam6itko Nov 7, 2025
b64740f
try to satisfy psalm
gam6itko Nov 7, 2025
4caf39e
try to satisfy psalm
gam6itko Nov 8, 2025
7371ba5
try to satisfy psalm
gam6itko Nov 8, 2025
31ccc2e
try to satisfy psalm
gam6itko Nov 8, 2025
be4a990
try to satisfy psalm
gam6itko Nov 8, 2025
6d2f3b7
try to satisfy psalm
gam6itko Nov 8, 2025
c3cdd17
try to satisfy psalm
gam6itko Nov 8, 2025
7d67121
try to satisfy psalm
gam6itko Nov 8, 2025
a6a6b70
try to satisfy psalm
gam6itko Nov 10, 2025
0d31985
try to satisfy psalm
gam6itko Nov 10, 2025
b697bb4
try to satisfy psalm
gam6itko Nov 10, 2025
f94b4b1
try to satisfy psalm
gam6itko Nov 10, 2025
f95c73e
try to satisfy psalm
gam6itko Nov 10, 2025
702ba3a
try to satisfy psalm
gam6itko Nov 10, 2025
fb8586c
try to satisfy psalm
gam6itko Nov 10, 2025
cc31e1a
try to satisfy psalm
gam6itko Nov 10, 2025
d712b7d
try to satisfy psalm
gam6itko Nov 10, 2025
e118d05
try to satisfy psalm
gam6itko Nov 10, 2025
c3def61
test(unit): Fix unit tests
julienloizelet Nov 28, 2025
0f5d74f
test(integration): Fix integration tests
julienloizelet Nov 28, 2025
57b086b
test(coding standards): Fix some psalm errors
julienloizelet Nov 28, 2025
4558764
test(integration): Always use login/password for alert client test
julienloizelet Nov 28, 2025
fa795a2
test(unit): Fix test for php 7.2
julienloizelet Nov 28, 2025
b3bf5fb
ci(sdk test): Remove chore exclusion
julienloizelet Dec 12, 2025
b72c164
ci(*): Various updates
julienloizelet Dec 12, 2025
1780da6
style(*): Pass through coding standards
julienloizelet Dec 12, 2025
6c33468
feat(config): Use separate configuration for watcher
julienloizelet Dec 12, 2025
dcac504
docs(watcher): Add Wathcer and Alert client doc
julienloizelet Dec 12, 2025
7ffba0c
feat(watcher): Refactor an use only WatcherClient
julienloizelet Dec 12, 2025
94f5838
test(*): Refactor tests
julienloizelet Dec 12, 2025
1423771
test(integration): Remove risky tests
julienloizelet Dec 12, 2025
ff63245
style(*): Rename WatcherClient in Watcher
julienloizelet Dec 12, 2025
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
10 changes: 4 additions & 6 deletions .github/workflows/coding-standards.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: Coding Standards
on:
push:
branches:
- main
paths-ignore:
- '**.md'
pull_request:
Expand All @@ -29,7 +27,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php-version: ['7.4', '8.0', '8.1', '8.2', '8.3', '8.4']
php-version: [ '7.4', '8.0', '8.1', '8.2', '8.3', '8.4' ]

name: Coding standards test
runs-on: ubuntu-latest
Expand All @@ -52,7 +50,7 @@ jobs:
run: ddev config --project-type=php --project-name=crowdsec-lapi-client --php-version=${{ matrix.php-version }}

- name: Add-ons install
run: ddev get julienloizelet/ddev-tools
run: ddev add-on get julienloizelet/ddev-tools

- name: Start DDEV
uses: nick-fields/retry@v3
Expand All @@ -68,12 +66,12 @@ jobs:
ddev exec php -v

- name: Clone sources
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
path: ${{env.EXTENSION_PATH}}

- name: Validate composer.json
run: |
run: |
ddev composer validate --strict --working-dir ./${{env.EXTENSION_PATH}}

- name: Install dependencies and Coding standards tools
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/doc-links.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
steps:

- name: Clone sources
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
path: extension

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/keepalive.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
steps:

- name: Clone project files
uses: actions/checkout@v4
uses: actions/checkout@v5

# keepalive-workflow keeps GitHub from turning off tests after 60 days
- uses: gautamkrishnar/keepalive-workflow@v2
Expand Down
10 changes: 6 additions & 4 deletions .github/workflows/php-sdk-development-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php-version: ["7.2", "7.3", "7.4", "8.0", "8.1", "8.2", "8.3", "8.4"]
php-version: [ "7.2", "7.3", "7.4", "8.0", "8.1", "8.2", "8.3", "8.4" ]

name: Unit and integration test
runs-on: ubuntu-20.04
Expand Down Expand Up @@ -99,23 +99,25 @@ jobs:
- name: Set BOUNCER_KEY env
run: |
echo "BOUNCER_KEY=$(ddev create-bouncer)" >> $GITHUB_ENV
- name: Create watcher
run: ddev create-watcher

- name: Clone Lapi Client files
if: inputs.is_call != true
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
path: ${{env.EXTENSION_PATH}}

- name: Clone Lapi Client files
if: inputs.is_call == true
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
repository: ${{ env.LAPI_CLIENT_REPO }}
path: ${{env.EXTENSION_PATH}}
ref: "main"

- name: Clone PHP common files
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
repository: ${{ steps.set-common-data.outputs.repo}}
ref: ${{ steps.set-common-data.outputs.branch }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
echo "version_number=$(echo ${{ env.TAG_NAME }} | sed 's/v//g' )" >> $GITHUB_OUTPUT

- name: Clone sources
uses: actions/checkout@v4
uses: actions/checkout@v5

- name: Check version consistency in files
# Check src/Constants.php and CHANGELOG.md
Expand Down
6 changes: 1 addition & 5 deletions .github/workflows/sdk-chain-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@ env:
jobs:
test-standalone-bouncer:
name: Run Standalone Bouncer tests
if: ${{ !contains(github.event.head_commit.message, 'chore(') }}
uses: crowdsecurity/cs-standalone-php-bouncer/.github/workflows/php-sdk-development-tests.yml@21a85d5696ba607e2028330c4ddda4b5e361547a
uses: crowdsecurity/cs-standalone-php-bouncer/.github/workflows/php-sdk-development-tests.yml@main
with:
php_common_json: '["main"]'
lapi_client_json: '["${{ github.ref_name }}"]'
Expand All @@ -26,7 +25,6 @@ jobs:

test-bouncer-lib:
name: Run Bouncer lib tests
if: ${{ !contains(github.event.head_commit.message, 'chore(') }}
uses: crowdsecurity/php-cs-bouncer/.github/workflows/php-sdk-development-tests.yml@main
with:
php_common_json: '["main"]'
Expand All @@ -36,7 +34,6 @@ jobs:

test-remediation-engine:
name: Run Remediation Engine tests
if: ${{ !contains(github.event.head_commit.message, 'chore(') }}
uses: crowdsecurity/php-remediation-engine/.github/workflows/php-sdk-development-tests.yml@main
with:
php_common_json: '["main"]'
Expand All @@ -48,7 +45,6 @@ jobs:

test-magento-engine:
name: Run Magento 2 Engine module tests
if: ${{ !contains(github.event.head_commit.message, 'chore(') }}
uses: crowdsecurity/magento-cs-extension/.github/workflows/php-sdk-development-tests.yml@main
with:
php_common_json: '["main"]'
Expand Down
37 changes: 24 additions & 13 deletions .github/workflows/unit-and-integration-test.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: Unit & integration tests
on:
push:
branches:
- main
paths-ignore:
- "**.md"
pull_request:
Expand Down Expand Up @@ -35,7 +33,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php-version: ["7.2", "7.3", "7.4", "8.0", "8.1", "8.2", "8.3", "8.4"]
php-version: [ "7.2", "7.3", "7.4", "8.0", "8.1", "8.2", "8.3", "8.4" ]

name: Unit and integration test
runs-on: ubuntu-latest
Expand All @@ -59,8 +57,8 @@ jobs:

- name: Add-ons install
run: |
ddev get julienloizelet/ddev-tools
ddev get julienloizelet/ddev-crowdsec-php
ddev add-on get julienloizelet/ddev-tools
ddev add-on get julienloizelet/ddev-crowdsec-php

- name: Prepare for TLS tests
run: |
Expand All @@ -85,8 +83,11 @@ jobs:
run: |
echo "BOUNCER_KEY=$(ddev create-bouncer)" >> $GITHUB_ENV

- name: Create Watcher for Integration tests
run: ddev create-watcher

- name: Clone sources
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
path: ${{env.EXTENSION_PATH}}

Expand All @@ -101,32 +102,42 @@ jobs:
- name: Run Unit tests
if: |
github.event.inputs.unit_tests == 'true' ||
github.event_name == 'push'
github.event_name == 'push' ||
github.event_name == 'pull_request'
run: ddev php ./${{env.EXTENSION_PATH}}/vendor/bin/phpunit --debug ./${{env.EXTENSION_PATH}}/tests/Unit --testdox

- name: Run Integration tests (without TLS)
if: |
github.event.inputs.integration_tests == 'true' ||
github.event_name == 'push'
run: ddev exec BOUNCER_KEY=${{ env.BOUNCER_KEY }} AGENT_TLS_PATH=/var/www/html/cfssl APPSEC_URL=http://crowdsec:7422 LAPI_URL=https://crowdsec:8080 /usr/bin/php ./${{env.EXTENSION_PATH}}/vendor/bin/phpunit --testdox --colors --exclude-group timeout,appsec ./${{env.EXTENSION_PATH}}/tests/Integration
github.event_name == 'push' ||
github.event_name == 'pull_request'
run: |
ddev exec -s crowdsec cscli alerts delete --all
ddev exec BOUNCER_KEY=${{ env.BOUNCER_KEY }} AGENT_TLS_PATH=/var/www/html/cfssl APPSEC_URL=http://crowdsec:7422 LAPI_URL=https://crowdsec:8080 /usr/bin/php ./${{env.EXTENSION_PATH}}/vendor/bin/phpunit --configuration ./${{env.EXTENSION_PATH}}/tools/coding-standards/phpunit/phpunit.xml --testsuite Integration-Watcher,Integration-Bouncer --testdox --colors --exclude-group timeout,appsec

- name: Run Integration tests (with TLS)
if: |
github.event.inputs.integration_tests == 'true' ||
github.event_name == 'push'
run: ddev exec BOUNCER_KEY=${{ env.BOUNCER_KEY }} AGENT_TLS_PATH=/var/www/html/cfssl BOUNCER_TLS_PATH=/var/www/html/cfssl APPSEC_URL=http://crowdsec:7422 LAPI_URL=https://crowdsec:8080 /usr/bin/php ./${{env.EXTENSION_PATH}}/vendor/bin/phpunit --testdox --colors --exclude-group timeout,appsec ./${{env.EXTENSION_PATH}}/tests/Integration
github.event_name == 'push' ||
github.event_name == 'pull_request'
run: |
ddev exec -s crowdsec cscli alerts delete --all
ddev exec BOUNCER_KEY=${{ env.BOUNCER_KEY }} AGENT_TLS_PATH=/var/www/html/cfssl BOUNCER_TLS_PATH=/var/www/html/cfssl APPSEC_URL=http://crowdsec:7422 LAPI_URL=https://crowdsec:8080 /usr/bin/php ./${{env.EXTENSION_PATH}}/vendor/bin/phpunit --configuration ./${{env.EXTENSION_PATH}}/tools/coding-standards/phpunit/phpunit.xml --testsuite Integration-Watcher,Integration-Bouncer --testdox --colors --exclude-group timeout,appsec


- name: Run AppSec tests
if: |
github.event.inputs.integration_tests == 'true' ||
github.event_name == 'push'
github.event_name == 'push' ||
github.event_name == 'pull_request'
run: |
ddev exec BOUNCER_KEY=${{ env.BOUNCER_KEY }} AGENT_TLS_PATH=/var/www/html/cfssl APPSEC_URL=http://crowdsec:7422 LAPI_URL=https://crowdsec:8080 /usr/bin/php ./${{env.EXTENSION_PATH}}/vendor/bin/phpunit --testdox --colors --group appsec ./${{env.EXTENSION_PATH}}/tests/Integration

- name: Run AppSec tests with timeout
if: |
github.event.inputs.integration_tests == 'true' ||
github.event_name == 'push'
github.event_name == 'push' ||
github.event_name == 'pull_request'
run: |
ddev exec -s crowdsec apk add iproute2
ddev exec -s crowdsec tc qdisc add dev eth0 root netem delay 500ms
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,5 @@ composer-dev*

#log
*.log

/cfssl
6 changes: 4 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,16 @@
},
"require": {
"php": "^7.2.5 || ^8.0",
"crowdsec/common": "^3.0.0",
"ext-json": "*",
"crowdsec/common": "^3.0.0",
"psr/cache": "^1.0 || ^2.0 || ^3.0",
"symfony/config": "^4.4.44 || ^5.4.11 || ^6.0.11 || ^7.2.0"
},
"require-dev": {
"ext-curl": "*",
"phpunit/phpunit": "^8.5.30 || ^9.3",
"mikey179/vfsstream": "^1.6.11",
"ext-curl": "*"
"symfony/cache": "^5.4.11 || ^6.0.11 || ^7.2.1"
},
"suggest": {
"ext-curl": "*"
Expand Down
Loading
Loading