Skip to content

Commit 0fec1e6

Browse files
mauricesvayclaudedomalessi
authored
📝 Add schema view and drift comparison to API endpoints docs (#37785)
* docs(aap): add schema view and drift comparison section to API endpoints Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * docs(appsec): fix copy and style issues in API Endpoints page Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * docs(appsec): restore local schema section on API Endpoints page Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * docs(appsec): enhance schema comparison section in API Endpoints page Expanded the comparison of declared and inferred schemas by adding severity levels and detailed descriptions of potential differences. Included specific areas of schema changes that can occur and clarified which differences are excluded to reduce noise. This improves the clarity and usability of the documentation for users comparing API schemas. * docs(appsec): clarify inferred schema noise reduction Explain that the inferred schema filters fields by observation count and recency, reducing false-positive drift from one-off or attacker traffic. * docs(appsec): add Oxford comma in schema definition sentence Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> * docs(appsec): fix bullet list style consistency for schema actions Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> * docs(appsec): clarify schema comparison prerequisites wording Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> * docs(appsec): point to where the schema comparison surfaces in the UI Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> * Update content/en/security/application_security/api_posture/api_inventory/api_endpoints.md Co-authored-by: domalessi <111786334+domalessi@users.noreply.github.com> * Update content/en/security/application_security/api_posture/api_inventory/api_endpoints.md Co-authored-by: domalessi <111786334+domalessi@users.noreply.github.com> * Update content/en/security/application_security/api_posture/api_inventory/api_endpoints.md Co-authored-by: domalessi <111786334+domalessi@users.noreply.github.com> * Update content/en/security/application_security/api_posture/api_inventory/api_endpoints.md Co-authored-by: domalessi <111786334+domalessi@users.noreply.github.com> * Update content/en/security/application_security/api_posture/api_inventory/api_endpoints.md Co-authored-by: domalessi <111786334+domalessi@users.noreply.github.com> * Update content/en/security/application_security/api_posture/api_inventory/api_endpoints.md Co-authored-by: domalessi <111786334+domalessi@users.noreply.github.com> * Update content/en/security/application_security/api_posture/api_inventory/api_endpoints.md Co-authored-by: domalessi <111786334+domalessi@users.noreply.github.com> * Update content/en/security/application_security/api_posture/api_inventory/api_endpoints.md Co-authored-by: domalessi <111786334+domalessi@users.noreply.github.com> * Update content/en/security/application_security/api_posture/api_inventory/api_endpoints.md Co-authored-by: domalessi <111786334+domalessi@users.noreply.github.com> * Update content/en/security/application_security/api_posture/api_inventory/api_endpoints.md Co-authored-by: domalessi <111786334+domalessi@users.noreply.github.com> * docs(appsec): clarify schema view terminology and thresholds Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> * Use declared schema consistently * docs(appsec): add endpoint definition screenshot and match UI labels Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> * Apply suggestions from code review Co-authored-by: domalessi <111786334+domalessi@users.noreply.github.com> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com> Co-authored-by: domalessi <111786334+domalessi@users.noreply.github.com>
1 parent 91325f1 commit 0fec1e6

2 files changed

Lines changed: 55 additions & 5 deletions

File tree

content/en/security/application_security/api_posture/api_inventory/api_endpoints.md

Lines changed: 55 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Using API Endpoints you can:
2323

2424
## Configuration
2525

26-
To view API Endpoints on your services, **you must have App and API Protection Threats Protection enabled**.
26+
To view API Endpoints on your services, **you must have App and API Protection Threat Detection enabled**.
2727

2828
For Amazon Web Services (AWS) API Gateway integration, you must set up the following:
2929

@@ -49,7 +49,7 @@ For information on what library versions are compatible with API Inventory, see
4949

5050
## How it works
5151

52-
API Endpoints gathers security metadata about API traffic by leveraging the Datadog SDK with App and API Protection enabled, alongside configurations from Amazon API Gateway and uploaded API Definitions. This data includes the discovered API schema, the types of sensitive data (PII) processed, and the authentication scheme in use. The API information is continuously evaluated, ensuring a comprehensive and up-to-date view of your entire API attack surface.
52+
API Endpoints gathers security metadata about API traffic by using the Datadog SDK with App and API Protection enabled, alongside configurations from Amazon API Gateway and uploaded API Definitions. This data includes the discovered API schema, the types of sensitive data (PII) processed, and the authentication scheme in use. The API information is continuously evaluated, helping ensure a comprehensive and up-to-date view of your entire API attack surface.
5353

5454
API Endpoints uses [Remote Configuration][10] to manage and configure scanning rules that detect sensitive data and authentication.
5555

@@ -81,7 +81,7 @@ This source ensures that your API inventory is complete by including all planned
8181

8282
The {{< ui >}}Spans{{< /ui >}} data source shows real traffic and data exposure. Remediation should be performed in code, config, or access controls immediately.
8383

84-
What actions you take depend on each of the attack surfaces:
84+
The actions you take depend on the attack surface:
8585

8686
- **Vulnerabilities:** Patch any vulnerable libraries surfaced by SCA or Runtime Code Analysis, then redeploy the service.
8787
- **API findings discovered:** Review each issue in context of the traced service, fix any code or configurations, and then validate using new traces.
@@ -129,6 +129,56 @@ datadog:
129129
130130
Without explicit `codeLocations`, endpoints may not merge correctly with data from other sources.
131131

132+
## View and compare endpoint schemas
133+
134+
API Posture builds an OpenAPI schema for each endpoint from the traffic it observes. This **inferred** schema describes what your API exposes in production: its paths, parameters, request and response bodies, and authentication. When your team also publishes a **declared** schema, an OpenAPI definition registered in the Datadog Software Catalog, you can compare the two to find where the running API has diverged from its documentation.
135+
136+
### View an endpoint's schema
137+
138+
In [API Endpoints][1], click an endpoint to open its detail panel. The **Definition** section displays the endpoint's request parameters, request body, and responses. Fields that contain sensitive data are marked with the type of sensitive data observed.
139+
140+
{{< img src="/security/application_security/api/api_endpoint_definition_schema.png" alt="The Definition section of an endpoint's detail panel, showing its request parameters and the View Raw Schema and View Inferred Schemas buttons" style="width:100%;" >}}
141+
142+
When the endpoint is associated with an API in Datadog Software Catalog, the **Definition** section displays the declared OpenAPI specification. Otherwise, it displays the schema inferred from live traffic.
143+
144+
In the **Definition** section, you can:
145+
146+
- {{< ui >}}View Raw Schema{{< /ui >}}: View the displayed schema as raw YAML.
147+
- {{< ui >}}View Inferred Schemas{{< /ui >}}: View the schema inferred from live traffic as a preview or YAML, even when a declared schema is available. The inferred schema can be exported as an OpenAPI file in YAML or JSON.
148+
149+
To reduce noise, the inferred schema only includes fields observed at least three times, and drops fields that haven't been observed again within 7 days. This keeps one-off traffic, such as a single malformed request or an attacker probing an endpoint with an unexpected field, from polluting the inferred schema. Otherwise, it could appear as drift when compared against the declared schema.
150+
151+
### Compare declared and inferred schemas
152+
153+
To compare inferred and declared schemas, you must:
154+
155+
- [Enable App and API Protection][9] on the service so endpoints are discovered from live traffic.
156+
- Register the declared schema's OpenAPI definition in the Datadog Software Catalog. See [Create Entities][8].
157+
158+
The schema differences appear directly in the endpoint's schema view, highlighted by severity:
159+
160+
| Severity | Meaning |
161+
|----------|---------|
162+
| Breaking | The change likely breaks clients that rely on the declared contract, such as a field that became required or a parameter type change. |
163+
| Warning | The change is drift worth reviewing, such as an undeclared field observed in traffic or a parameter that became optional. |
164+
| Info | The difference is low risk, such as an endpoint that is declared but has no observed traffic. |
165+
166+
Differences can appear in the following areas of the schema:
167+
168+
- **Parameters**: A parameter added, removed, or changed from optional to required (or the reverse).
169+
- **Request body**: A request body added, removed, or changed from optional to required (or the reverse).
170+
- **Schema properties**: A property added, removed, changed from optional to required (or the reverse), or changed type, format, nullability, or enum values.
171+
- **Value constraints**: A numeric or length limit (`minimum`, `maximum`, `minLength`, `maxLength`), pattern, or uniqueness constraint changed.
172+
- **Schema composition**: A mismatch introduced in `oneOf` or `allOf` composition, or in a discriminator.
173+
- **Responses**: A status code, response header, or content type added or removed.
174+
175+
To reduce noise, some differences are excluded because they don't represent meaningful contract drift:
176+
177+
- **Request header and cookie parameters:** They often carry values such as authentication tokens or session identifiers that aren't part of the API contract.
178+
- **Type changes on query parameters:** Query parameters are always observed as strings in traffic, even when declared as another type, such as an integer or Boolean.
179+
- **Removed status codes:** The inferred schema only includes status codes observed in traffic, so a declared status code that hasn't occurred yet during observation always appears as removed.
180+
- **`anyOf` composition mismatches:** The declared and inferred schemas can use `anyOf` at different levels of the schema while remaining equivalent.
181+
132182
## Processing sensitive data
133183

134184
App and API Protection detects and classifies sensitive data processed by your endpoints, tagging each endpoint with the category and type of data found. To see which endpoints process sensitive data and to create custom API data scanners, see [Sensitive Data][16].
@@ -154,9 +204,9 @@ See [Configuring a client IP header][14] for more information on the required li
154204

155205
Authentication is determined by:
156206

157-
- The presence of `Authorization`, `Token` or `X-Api-Key` headers.
207+
- The presence of `Authorization`, `Token`, or `X-Api-Key` headers.
158208
- The presence of a user ID within the trace (for example, the `@usr.id` APM attribute).
159-
- The request has responded with a 401 or 403 status code.
209+
- A 401 or 403 status code returned by the endpoint.
160210
- Custom [Endpoint Tagging][15] rules that you configured
161211

162212

797 KB
Loading

0 commit comments

Comments
 (0)