Skip to content

docs(appsec): add AppSec developer reference docs and module AGENTS.md files#11454

Draft
jandro996 wants to merge 1 commit into
masterfrom
alejandro.gonzalez/docs-appsec
Draft

docs(appsec): add AppSec developer reference docs and module AGENTS.md files#11454
jandro996 wants to merge 1 commit into
masterfrom
alejandro.gonzalez/docs-appsec

Conversation

@jandro996
Copy link
Copy Markdown
Member

@jandro996 jandro996 commented May 25, 2026

Summary

  • Adds docs/appsec/ with six reference documents: blocking patterns per framework, WAF API reference, IG event wiring checklist, multipart file content reading, RASP CSI pattern, and multipart framework invariants (Jersey/RESTEasy/Jetty/GlassFish)
  • Adds lean AGENTS.md files in netty-4.1, tomcat-appsec, akka-http, jetty-appsec, vertx-web, undertow, and the appsec module - each pointing to the extended docs
  • Updates top-level AGENTS.md with an AppSec entry in the index table

No functional code changes.

…d files

Adds docs/appsec/ with six reference documents covering blocking patterns,
WAF API, IG event wiring, file content reading, RASP CSI, and multipart
framework invariants. Adds lean AGENTS.md files in netty-4.1, tomcat-appsec,
akka-http, jetty-appsec, vertx-web, undertow, and the appsec module pointing
to the extended docs.
@dd-octo-sts
Copy link
Copy Markdown
Contributor

dd-octo-sts Bot commented May 25, 2026

🟢 Java Benchmark SLOs — All performance SLOs passed

Suite Status
Startup 🟢 pass

SLO thresholds are defined here based on automatically generated metrics. A warning is raised when results are within 5% of the threshold.

PR vs. master results

Startup Time

Scenario This PR master Change
insecure-bank / iast 13,996 ms 13,903 ms +0.7%
insecure-bank / tracing 12,888 ms 13,026 ms -1.1%
petclinic / appsec 16,476 ms 16,355 ms +0.7%
petclinic / iast 16,355 ms 15,511 ms +5.4%
petclinic / profiling 16,306 ms 16,403 ms -0.6%
petclinic / tracing 15,869 ms 15,063 ms +5.3%

Commit: 5886d777 · CI Pipeline · Benchmarking Platform UI


Load and DaCapo benchmarks can be triggered manually in the GitLab pipeline. Results will appear in the Benchmarking Platform UI after completion.

@jandro996 jandro996 added type: documentation tag: no release notes Changes to exclude from release notes comp: asm waf Application Security Management (WAF) labels May 25, 2026
Copy link
Copy Markdown
Member

@smola smola left a comment

Choose a reason for hiding this comment

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

A few comments. A lot of things here do need documentation but:

  • We should avoid large snippets of code copied to agent guidance. They'll go out of sync. Just use paths to the relevant files.
  • A lot of guidance very specific to a single instrumentation or class is better handled by comments in the relevant code, not as general guidance. When you're not working in that file, they are noise. And you risk missing the doc when you're actually working in the file.
  • Some things should be tests, not agent guidance.


## Adding a new WAF address: 4-file checklist

Every new WAF address requires changes in exactly 4 files. Missing any one causes a silent no-op:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Missing any one causes a silent no-op -> Maybe we could add a test that checks all these 4 files are coherent in their registered addresses?

Then we wouldn't need to document it at all. If you miss them, you get a test error explaining the issue.

Comment thread docs/appsec/ig-events.md
}
```

The ID must be unique and sequential. Check the last used ID before assigning.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could we add a test for this instead?

Comment thread docs/appsec/ig-events.md
### 1. `Events.java` — declare the event type

```java
static final int REQUEST_FILES_CONTENT_ID = 31; // unique, increment from last used
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This snippet will easily go out of date. I think agents will pick up the pattern just correctly if you say here that the event type must be declared in Events.java (maybe use full path).

Comment thread docs/appsec/ig-events.md
new Address<>("server.request.body.files_content");
```

Also add it to the `fromString()` switch.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Can we add a test that verifies this is done correctly, instead of documenting it?

Comment thread docs/appsec/ig-events.md
All handlers follow the same retry-on-expiry pattern:

```java
private Flow<Void> onRequestFilesContent(RequestContext ctx_, List<String> filesContent) {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ideally we shouldn't have this big snippet in the docs. It'll get out of sync. I'm sure agents will pick up the pattern from the surrounding context.

@@ -0,0 +1,168 @@
# Multipart AppSec — Framework-Specific Patterns
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

All or most of this should be comments right in the instrumentation code or closer to the relevant code.


## Do not extract filenames callback dispatch into `UnmarshallerHelpers`

Extracting the `requestFilesFilenames` callback dispatch into a shared helper method in
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Which problems does it cause? Unless more detail is given, this risks becoming cargo cult and nobody remembers why we do it.


## Jetty 8.x: no `getSubmittedFileName()`, manual parsing required

`Part.getSubmittedFileName()` (Servlet 3.1) is not available in Jetty 8.x (Servlet 3.0). Filenames
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Better documneted in the code, not here.

Comment thread docs/appsec/waf-api.md
@@ -0,0 +1,286 @@
# WAF API Reference — libddwaf-java

Reference for the `libddwaf-java` binding used by the AppSec module. Based on libddwaf-java v1.30.0 / libddwaf v1.30.0.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Link github.com/datadog/libddwaf-java here. I'll help agents accessing its source code.

Comment thread docs/appsec/waf-api.md
```

**Values used in dd-trace-java** (see `AppSecSystem` / `WafInitialization`):
- `maxDepth = 20`
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Let's not copy values here, it'll go out of sync. Referencing the path to the relevant files is enough.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp: asm waf Application Security Management (WAF) tag: no release notes Changes to exclude from release notes type: documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants