Repository navigation
Expand appsec laravel integration testing to all versions - #4277
estringana wants to merge 7 commits into
Conversation
🎉 All green!🧪 All tests passed 🎯 Code Coverage (details) 🔗 Commit SHA: 59e2f36 | Docs | View more details | Give us feedback! |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Supported older Laravel versions remain uncovered, and endpoint/debug-build coverage is reduced.
Review effort: Balanced
Findings: 2
Open (3)
What changed in this PR
Expands Laravel AppSec integration testing by extracting shared tests and adding coverage for Laravel 9.x–12.x.
Changes:
- Introduces a shared Laravel AppSec test suite and version-specific containers.
- Adds authentication, endpoint, telemetry, and SQLite fixture setup.
- Seeds users consistently for authentication-event testing.
| File | Description |
|---|---|
tests/Frameworks/Laravel/Version_9_x/routes/web.php |
Adds endpoint-test routes. |
tests/Frameworks/Laravel/Version_9_x/public/outside_of_framework.php |
Exposes endpoint-collection state. |
tests/Frameworks/Laravel/Version_9_x/docker-init.sh |
Initializes the test fixture. |
tests/Frameworks/Laravel/Version_9_x/database/seeders/DatabaseSeeder.php |
Seeds the authentication user. |
tests/Frameworks/Laravel/Version_9_x/app/Http/Controllers/LoginTestController.php |
Supports failed-password testing. |
tests/Frameworks/Laravel/Version_10_x/routes/web.php |
Adds endpoint-test routes. |
tests/Frameworks/Laravel/Version_10_x/public/outside_of_framework.php |
Exposes endpoint-collection state. |
tests/Frameworks/Laravel/Version_10_x/docker-init.sh |
Initializes the test fixture. |
tests/Frameworks/Laravel/Version_10_x/database/seeders/DatabaseSeeder.php |
Seeds the authentication user. |
tests/Frameworks/Laravel/Version_10_x/app/Http/Controllers/LoginTestController.php |
Supports failed-password testing. |
tests/Frameworks/Laravel/Version_11_x/routes/web.php |
Adds authentication and endpoint routes. |
tests/Frameworks/Laravel/Version_11_x/public/outside_of_framework.php |
Exposes endpoint-collection state. |
tests/Frameworks/Laravel/Version_11_x/docker-init.sh |
Initializes the test fixture. |
tests/Frameworks/Laravel/Version_11_x/database/seeders/DatabaseSeeder.php |
Seeds the authentication user. |
tests/Frameworks/Laravel/Version_11_x/app/Http/Controllers/LoginTestController.php |
Implements authentication test actions. |
tests/Frameworks/Laravel/Latest/routes/web.php |
Adds authentication and endpoint routes. |
tests/Frameworks/Laravel/Latest/public/outside_of_framework.php |
Exposes endpoint-collection state. |
tests/Frameworks/Laravel/Latest/docker-init.sh |
Initializes the latest fixture. |
tests/Frameworks/Laravel/Latest/database/seeders/DatabaseSeeder.php |
Seeds the authentication user. |
tests/Frameworks/Laravel/Latest/app/Http/Controllers/LoginTestController.php |
Implements authentication test actions. |
appsec/tests/integration/src/test/groovy/com/datadog/appsec/php/integration/LaravelLatestTests.groovy |
Configures latest-Laravel tests. |
appsec/tests/integration/src/test/groovy/com/datadog/appsec/php/integration/Laravel9xTests.groovy |
Configures Laravel 9 tests. |
appsec/tests/integration/src/test/groovy/com/datadog/appsec/php/integration/Laravel8xTests.groovy |
Migrates Laravel 8 to shared tests. |
appsec/tests/integration/src/test/groovy/com/datadog/appsec/php/integration/Laravel11xTests.groovy |
Configures Laravel 11 tests. |
appsec/tests/integration/src/test/groovy/com/datadog/appsec/php/integration/Laravel10xTests.groovy |
Configures Laravel 10 tests. |
appsec/tests/integration/src/test/groovy/com/datadog/appsec/php/integration/AbstractLaravelAppsecTests.groovy |
Defines reusable Laravel AppSec tests. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 3aca3a6d55
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Benchmarks [ tracer ]Benchmark execution time: 2026-10-08 13:46:34 Comparing candidate commit 59e2f36 in PR branch Found 1 performance improvements and 0 performance regressions! Performance is the same for 193 metrics, 0 unstable metrics.
|
| if [[ -f composer.lock ]]; then | ||
| composer install --no-dev --no-scripts | ||
| else | ||
| composer update --no-dev --no-scripts | ||
| fi |
There was a problem hiding this comment.
It should always be there, no?
| /** Expected total endpoints count; return negative to skip exact check. */ | ||
| int expectedEndpointCount() { -1 } |
There was a problem hiding this comment.
Just make it a bool like allowUnenumeratedRoutes. expectedEndpoints already implicitly carries a count
| /** Expected total endpoints count; return negative to skip exact check. */ | ||
| int expectedEndpointCount() { -1 } | ||
|
|
||
| /** | ||
| * Status code the fixture's /login/signup endpoint returns. | ||
| * Laravel 8.x returns 200 explicitly; 9.x+ scaffolded `register()` redirects | ||
| * (`return redirect('/simple')`) which produces 302. | ||
| */ | ||
| int expectedSignupStatus() { 200 } | ||
|
|
||
| /** List of {@code [path, method, resourceName]} entries that must be present. */ | ||
| List<List<String>> expectedEndpoints() { [] } |
There was a problem hiding this comment.
nit: these would be nicer is they were named is* (for bools) or get* (otherwise) because then in groovy you could use property syntax (expectedEndpoints rather than expectedEndpoints())
| // Not a @Test on purpose — pre-existing behaviour of Laravel8xTests. The | ||
| // tracer bookkeeping is per-request, so re-asserting the flag on a | ||
| // subsequent request to outside_of_framework.php was unreliable. | ||
| @Order(3) | ||
| void 'Endpoints are collected after the first request to framework'() { | ||
| HttpRequest req = container.buildReq('/outside_of_framework.php').GET().build() | ||
| container.traceFromRequest(req, ofString()) { HttpResponse<String> re -> | ||
| assert re.statusCode() == 200 | ||
| assert re.body().contains('are_endpoints_collected: true') | ||
| } | ||
| } |
There was a problem hiding this comment.
What does this mean "tracer bookkeeping is per-request" ??
Either way, it seems the test should be fixed.
There was a problem hiding this comment.
Is this introduced by this PR? This is just moved from somewhere else


Description
Following #4268 this pr expand tests on Laravel
Reviewer checklist