Skip to content

test(appsec): Add system tests for server.io.fs.file_write address#6740

Merged
jandro996 merged 20 commits into
mainfrom
alejandro.gonzalez/APPSEC-61874
Apr 21, 2026
Merged

test(appsec): Add system tests for server.io.fs.file_write address#6740
jandro996 merged 20 commits into
mainfrom
alejandro.gonzalez/APPSEC-61874

Conversation

@jandro996

@jandro996 jandro996 commented Apr 14, 2026

Copy link
Copy Markdown
Member
  • Add new test to check server.io.fs.file_write address
  • Java endpoints implementation

…s.file_write)

New test class Test_Lfi_Write_UrlQuery verifies that file write operations
via FileOutputStream are intercepted by RASP and block LFI attacks. The
test checks the server.io.fs.file_write address which is the new address
published by the Java agent on file write instrumentation.

- Add Test_Lfi_Write_UrlQuery to tests/appsec/rasp/test_lfi.py
- Add /rasp/lfi_write endpoint (FileOutputStream) to spring-boot weblog
- Mark as missing_feature for Java (APPSEC-61874): requires ddwaf support
  for server.io.fs.file_write as a RASP ephemeral address
- Mark as irrelevant for all other languages (Java-only address)
Add Test_IoFsFileWrite to test_addresses.py to verify that the WAF
evaluates dog-920-110 (Zipslip Attack) against the server.io.fs.file_write
address published by Java's RASP file-write hook.

- Add dog_920_110 constant to waf_rules.lfi StrEnum
- Add Test_IoFsFileWrite test class using /rasp/lfi_write endpoint with
  x-filename: archive.zip header to satisfy both dog-920-110 conditions
- Mark as missing_feature for Java (APPSEC-61874: ddwaf must evaluate WAF
  rules against ephemeral server.io.fs.file_write data)
- Mark as irrelevant for all other languages (Java-only address)
@jandro996
jandro996 requested review from a team as code owners April 14, 2026 08:51
@jandro996
jandro996 requested review from brettlangdon, claponcet, mabdinur and manuel-alvarez-alvarez and removed request for a team April 14, 2026 08:51
@github-actions

github-actions Bot commented Apr 14, 2026

Copy link
Copy Markdown
Contributor

CODEOWNERS have been resolved as:

manifests/cpp_nginx.yml                                                 @DataDog/dd-trace-cpp
manifests/dotnet.yml                                                    @DataDog/apm-dotnet @DataDog/asm-dotnet
manifests/golang.yml                                                    @DataDog/dd-trace-go-guild
manifests/java.yml                                                      @DataDog/asm-java @DataDog/apm-java
manifests/nodejs.yml                                                    @DataDog/dd-trace-js
manifests/php.yml                                                       @DataDog/apm-php @DataDog/asm-php
manifests/python.yml                                                    @DataDog/apm-python @DataDog/asm-python
manifests/python_lambda.yml                                             @DataDog/apm-python @DataDog/asm-python
manifests/ruby.yml                                                      @DataDog/ruby-guild @DataDog/asm-ruby
tests/appsec/custom_rules.json                                          @DataDog/asm-libraries @DataDog/system-tests-core
tests/appsec/waf/test_addresses.py                                      @DataDog/asm-libraries @DataDog/system-tests-core
utils/build/docker/java/akka-http/src/main/scala/com/datadoghq/akka_http/RaspRoutes.scala  @DataDog/apm-java @DataDog/asm-java @DataDog/system-tests-core
utils/build/docker/java/jersey-grizzly2/src/main/java/com/datadoghq/jersey/RaspResource.java  @DataDog/apm-java @DataDog/asm-java @DataDog/system-tests-core
utils/build/docker/java/play/app/controllers/RaspController.scala       @DataDog/apm-java @DataDog/asm-java @DataDog/system-tests-core
utils/build/docker/java/play/conf/routes                                @DataDog/apm-java @DataDog/asm-java @DataDog/system-tests-core
utils/build/docker/java/ratpack/src/main/java/com/datadoghq/ratpack/RaspHandlers.java  @DataDog/apm-java @DataDog/asm-java @DataDog/system-tests-core
utils/build/docker/java/resteasy-netty3/src/main/java/com/datadoghq/resteasy/RaspResource.java  @DataDog/apm-java @DataDog/asm-java @DataDog/system-tests-core
utils/build/docker/java/spring-boot/src/main/java/com/datadoghq/system_tests/springboot/rasp/RaspController.java  @DataDog/apm-java @DataDog/asm-java @DataDog/system-tests-core
utils/build/docker/java/vertx3/src/main/java/com/datadoghq/vertx3/Main.java  @DataDog/apm-java @DataDog/asm-java @DataDog/system-tests-core
utils/build/docker/java/vertx3/src/main/java/com/datadoghq/vertx3/rasp/RaspRouteProvider.java  @DataDog/apm-java @DataDog/asm-java @DataDog/system-tests-core
utils/build/docker/java/vertx4/src/main/java/com/datadoghq/vertx4/rasp/RaspRouteProvider.java  @DataDog/apm-java @DataDog/asm-java @DataDog/system-tests-core
utils/waf_rules.py                                                      @DataDog/system-tests-core

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1dbb0a22a2

ℹ️ 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".

Comment thread tests/appsec/waf/test_addresses.py
…r Zipslip test

- Add GET /rasp/lfi_write and POST /rasp/lfi_write endpoints to all Java
  weblog variants (akka-http, jersey-grizzly2, play, ratpack, resteasy-netty3,
  spring-boot, vertx3, vertx4) using FileOutputStream to trigger
  server.io.fs.file_write RASP address
- Replace Test_IoFsFileWrite with Test_Zipslip in test_addresses.py: uses
  multipart POST with evil.zip filename to trigger server.request.body.filenames
  alongside server.io.fs.file_write, asserting dog-920-110 (Zipslip) rule
- Update all language manifests: Test_Zipslip is missing_feature for Java
  (APPSEC-61874), irrelevant for all other languages
@jandro996 jandro996 changed the title test(appsec): add system tests for server.io.fs.file_write RASP address (APPSEC-61874) test(appsec): Add system tests for server.io.fs.file_write address Apr 14, 2026

@nccatoni nccatoni left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM (for @DataDog/system-tests-core) but you should get a review from someone familiar with the feature

@jandro996
jandro996 marked this pull request as draft April 15, 2026 14:46
…Zipslip

- Add POST /waf/zipslip multipart endpoint to spring-boot, akka-http,
  jersey-grizzly2, ratpack, resteasy-netty3, vertx3, vertx4, and play
- Add dog-920-110 WAF rule (Zipslip Attack) to rasp_ruleset.json and
  rasp_non_blocking_ruleset.json with server.request.body.filenames and
  server.io.fs.file_write conditions
- Add Test_Zipslip test in tests/appsec/waf/test_addresses.py
- Remove Test_Lfi_Write_UrlQuery from test_lfi.py and all language manifests
- Update manifests/java.yml: only spring-boot enabled for Test_Zipslip
  (other weblogs missing_feature, matching Test_Blocking_request_body_filenames pattern)
…server.io.fs.file_write

Testing server.io.fs.file_write via a custom WAF rule is simpler and
works on all weblogs: use existing /rasp/lfi_write?file=../../evil.txt
endpoint instead of requiring a multipart ZIP upload endpoint on every
framework.

- Add custom-test-file-write rule to custom_rules.json (single condition:
  server.io.fs.file_write matches path traversal)
- Replace Test_Zipslip (appsec_rasp + multipart /waf/zipslip) with
  Test_IoFsFileWrite (appsec_custom_rules + GET /rasp/lfi_write)
- Remove /waf/zipslip endpoints from all Java weblogs (akka-http,
  jersey-grizzly2, play, ratpack, resteasy-netty3, spring-boot,
  vertx3, vertx4) and related multipart dependencies
- Remove dog-920-110 from rasp_ruleset.json and rasp_non_blocking_ruleset.json
- Enable Test_IoFsFileWrite for all Java weblogs in manifests/java.yml
- Rename Test_Zipslip -> Test_IoFsFileWrite in all other language manifests
…amlfmt

- Add missing irrelevant entries for Test_IoFsFileWrite in ruby.yml and
  cpp_nginx.yml (Java-only address: server.io.fs.file_write)
- Apply yamlfmt ordering to all affected manifests
rasp_ruleset.json and rasp_non_blocking_ruleset.json had cosmetic JSON
formatting changes from the add/remove cycle of dog-920-110.
vertx4/Main.java had unused File/FileInputStream imports left over from
the zipslip endpoint cycle.
@datadog-prod-us1-5

datadog-prod-us1-5 Bot commented Apr 17, 2026

Copy link
Copy Markdown

Tests

🎉 All green!

❄️ No new flaky tests detected
🧪 All tests passed

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 628da20 | Docs | Datadog PR Page | Give us feedback!

@jandro996
jandro996 marked this pull request as ready for review April 20, 2026 12:25
@jandro996
jandro996 requested review from a team as code owners April 20, 2026 12:25
@jandro996
jandro996 requested review from xlamorlette-datadog and removed request for a team April 20, 2026 12:25
…tch conflict

pathPrefix("lfi") was matching /rasp/lfi_write requests because "lfi_write"
starts with "lfi", causing executeFli (FileInputStream) to be called instead
of executeLfiWrite (FileOutputStream). This prevented the server.io.fs.file_write
RASP address from being populated, making Test_IoFsFileWrite fail on akka-http.
@jandro996
jandro996 enabled auto-merge (squash) April 20, 2026 14:32
@jandro996
jandro996 merged commit 568ddaa into main Apr 21, 2026
2816 of 2818 checks passed
@jandro996
jandro996 deleted the alejandro.gonzalez/APPSEC-61874 branch April 21, 2026 13:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants