[SPIP WAF ↪ worktree-2026-05-12T19-06-21] 7 commits

technova69/waf | 7 commits

Par gilles, le 12 mai 2026 à 23h16min :

tests: extend coverage with 5 more test classes

Unit tests (+44 tests → 147 total, 479 assertions):

  • WafIpResolverTest: waf_ip() header-absent path, waf_ips() (empty/single
    IP, XFF splitting, header name, sanitization)
  • WafPrefixTreeV6Test: waf_ti_build_prefix_tree_v6 + waf_ti_lookup_ip6_tree
    (/128, /48, /7 ULA, IPv4 entries skipped, empty tree, invalid input,
    leaf-value format)
  • WafCachePrimitivesTest: _waf_cache_write + _waf_cache_read (file creation,
    parent dir, scalar/array roundtrip, zero-TTL, expiry value, missing file,
    expired → deleted, corrupt file, missing v-key, fresh read)
  • WafCmsProbeTest: waf_cms_probe_patterns (WordPress, Drupal, Joomla,
    .env, phpMyAdmin, webshells, PHPUnit-RCE, Spring actuator, legitimate
    SPIP URIs not flagged, caching)
  • tests/stubs/SpipLeagueKernelApp.php: namespace stub for unit bootstrap

Integration tests (+12 tests → 23 total, 42 assertions):

  • WafStrikeBanIntegrationTest: waf_event_save (JSONL creation + append),
    waf_get/increment_strike_count, waf_get/increment_ban_count,
    waf_is_ip_banned, waf_is_ip_unblocked, waf_revoke_unblock

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

Ajouté
tests/integration/WafStrikeBanIntegrationTest.php
tests/stubs/SpipLeagueKernelApp.php
tests/unit/WafCachePrimitivesTest.php
tests/unit/WafCmsProbeTest.php
tests/unit/WafIpResolverTest.php
tests/unit/WafPrefixTreeV6Test.php
Modifié
tests/bootstrap.php

Détails : tests: extend coverage with 5 more test classes (7b7d52c5) · Validations · GILLES VINCENT / SPIP WAF · GitLab

==============================
Par gilles, le 12 mai 2026 à 21h14min :

tests: add comprehensive unit and integration test suite

Unit tests (103 tests, 410 assertions):

  • WafIpUtilsTest: waf_sanitize_ip, waf_parse_ip_list, waf_ip_in_list
  • WafCidrTest: waf_ti_ip_in_cidr, waf_ti_ip6_in_cidr, waf_ti_is_local_ip,
    waf_ti_local_cidrs, waf_ti_local_cidrs_v6
  • WafPrefixTreeTest: waf_ti_build_prefix_tree, waf_ti_lookup_ip (exact,
    /8, /16, /24, non-octet-aligned CIDRs, ancestor-override, edge cases)
  • WafBadgeFiltersTest: waf_type_badge (all event types + XSS escape),
    waf_reason_class
  • WafPatternDetectionTest: waf_malicious_payload_patterns (data-provider
    with 12 attack vectors + 5 safe payloads), waf_suspicious_ua_patterns
    (11 scanner UAs), waf_ti_parse_lines
  • WafCachePathTest: _waf_cache_path (subdirectory layout, extension)
  • WafFlattenTest: waf_flatten_to_strings (nested arrays, scalar casts)

Integration tests (11 tests, 24 assertions):

  • WafCacheIntegrationTest: file-based cache round-trip (scalar + array),
    miss, delete, TTL expiry, no-expiry, waf_cache_clean (expired vs fresh),
    overwrite

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

Ajouté
tests/integration/WafCacheIntegrationTest.php
tests/unit/WafBadgeFiltersTest.php
tests/unit/WafCachePathTest.php
tests/unit/WafCidrTest.php
tests/unit/WafFlattenTest.php
tests/unit/WafIpUtilsTest.php
tests/unit/WafPatternDetectionTest.php
tests/unit/WafPrefixTreeTest.php

Détails : tests: add comprehensive unit and integration test suite (7caf6405) · Validations · GILLES VINCENT / SPIP WAF · GitLab

==============================
Par gilles, le 12 mai 2026 à 20h55min :

Add integration test for WAF cron tasks registration and intervals

Ajouté
tests/integration/WafEventFlushIntegrationTest.php

Détails : Add integration test for WAF cron tasks registration and intervals (72ac041b) · Validations · GILLES VINCENT / SPIP WAF · GitLab

==============================
Par gilles, le 12 mai 2026 à 20h55min :

Add unit tests for WAF unblock token functionality

Ajouté
tests/unit/WafUnblockTokenTest.php

Détails : Add unit tests for WAF unblock token functionality (54b4cb9f) · Validations · GILLES VINCENT / SPIP WAF · GitLab

==============================
Par gilles, le 12 mai 2026 à 20h55min :

Add PHPUnit configuration and bootstrap files for testing

Ajouté
phpunit.xml
tests/bootstrap.php
tests/bootstrap_integration.php

Détails : Add PHPUnit configuration and bootstrap files for testing (6f514794) · Validations · GILLES VINCENT / SPIP WAF · GitLab

==============================
Par gilles, le 12 mai 2026 à 20h54min :

Add composer.json and install script for SPIP plugin setup

Ajouté
composer.json
scripts/install-spip-test.sh

Détails : Add composer.json and install script for SPIP plugin setup (ccffae31) · Validations · GILLES VINCENT / SPIP WAF · GitLab

==============================
Par gilles, le 12 mai 2026 à 20h51min :

.gitignore for this plugin

Ajouté
.gitignore

Détails : .gitignore for this plugin (fb68be36) · Validations · GILLES VINCENT / SPIP WAF · GitLab