Skip to content

[dotnet] Add the normalized route endpoints and enable test_normalized_route.py - #8658

Draft
dromanol wants to merge 1 commit into
mainfrom
dani/aap/dotnet-normalized-route
Draft

dromanol wants to merge 1 commit into
mainfrom
dani/aap/dotnet-normalized-route

Conversation

@dromanol

@dromanol dromanol commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

dd-trace-dotnet emits _dd.appsec.normalized_route following the approved RFC-1125 from 3.60.0 (DataDog/dd-trace-dotnet#9552), but the .NET weblog doesn't implement the /api_security/* normalized route endpoints, so test_normalized_route.py is missing_feature / incomplete_test_app for .NET. Jira: APPSEC-62079.

Changes

  • Add the RFC-1125 normalized route endpoints to the .NET weblog (ApiSecController, shared by poc and uds), as attribute routes on one action. ASP.NET Core doesn't allow an optional parameter after static text (search.{format?}), so /api_security/search and /api_security/search.{format} are declared as two routes, as the weblog docs allow.
  • Enable every test_normalized_route.py class for .NET from v3.60.0.

All 27 tests pass locally (APPSEC_API_SECURITY, poc) against a dd-trace-dotnet build of #9552.

Workflow

  1. ⚠️ Create your PR as draft ⚠️
  2. Work on you PR until the CI passes
  3. Mark it as ready for review
    • Tests, manifest, weblog are modified -> you'll need a review from system-tests-reviewers: ask to one of youre co-worker familiar with the tested feature.
    • Framework is modified, or non obvious usage of it -> get a review from system-tests-core (slack)

🚀 Once your PR is reviewed and the CI green, you can merge it!

🛟 #apm-shared-testing 🛟

🤖 Generated with Claude Code

…d_route.py

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown
Contributor

CODEOWNERS have been resolved as:

manifests/dotnet.yml                                                    @DataDog/system-tests-reviewers
utils/build/docker/dotnet/weblog/Controllers/ApiSecController.cs        @DataDog/system-tests-reviewers

@datadog-datadog-us1-prod

datadog-datadog-us1-prod Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Pipelines  Tests

❌ Errors

Your PR has failed checks. Please review the issues below and take necessary action before merging.

🚦 3 Pipeline jobs failed

Testing the test | System Tests (dotnet, dev) / End-to-end #18 / poc 18 — ❌ 27 tests failed · 🔧 Needs a code fix, caused by this PR

View more details · View in GitHub Actions

❌ tests.appsec.api_security_testing.test_normalized_route.Test_NormalizedRoute.test_query_string_not_in_route[poc] from system_tests_suite
AssertionError: _dd.appsec.normalized_route must be set when http.route=&#39;/headers&#39;
assert None is not None

self = &lt;tests.appsec.api_security_testing.test_normalized_route.Test_NormalizedRoute object at 0x7e49df8697f0&gt;

    def test_query_string_not_in_route(self):
        &#34;&#34;&#34;Rule 5 reminder: query parameters are not part of the normalized route.&#34;&#34;&#34;
        meta = _get_meta(self.r_with_qs)
&gt;       normalized = _require_normalized(meta)

...
❌ tests.appsec.api_security_testing.test_normalized_route.Test_NormalizedRoute.test_single_param_route_with_static_prefix[poc] from system_tests_suite
AssertionError: _dd.appsec.normalized_route must be set when http.route=&#39;/sample_rate_route/{i:int}&#39;
assert None is not None

self = &lt;tests.appsec.api_security_testing.test_normalized_route.Test_NormalizedRoute object at 0x7e49df86a180&gt;

    def test_single_param_route_with_static_prefix(self):
        &#34;&#34;&#34;Rule 3 &#43; rule 5: underscore stays unencoded in the static segment;
        the trailing segment is exactly one \`{name}\` (single-param-per-segment).
        &#34;&#34;&#34;
        meta = _get_meta(self.r_single_param)
...
↳ and 25 more — View all
Testing the test | System Tests (dotnet, dev) / End-to-end #23 / uds 23 — ❌ 27 tests failed · 🔧 Needs a code fix, caused by this PR

View more details · View in GitHub Actions

❌ tests.appsec.api_security_testing.test_normalized_route.Test_NormalizedRoute.test_query_string_not_in_route[uds] from system_tests_suite
AssertionError: _dd.appsec.normalized_route must be set when http.route=&#39;/headers&#39;
assert None is not None

self = &lt;tests.appsec.api_security_testing.test_normalized_route.Test_NormalizedRoute object at 0x7f7f30eb0500&gt;

    def test_query_string_not_in_route(self):
        &#34;&#34;&#34;Rule 5 reminder: query parameters are not part of the normalized route.&#34;&#34;&#34;
        meta = _get_meta(self.r_with_qs)
&gt;       normalized = _require_normalized(meta)

...
❌ tests.appsec.api_security_testing.test_normalized_route.Test_NormalizedRoute.test_single_param_route_with_static_prefix[uds] from system_tests_suite
AssertionError: _dd.appsec.normalized_route must be set when http.route=&#39;/sample_rate_route/{i:int}&#39;
assert None is not None

self = &lt;tests.appsec.api_security_testing.test_normalized_route.Test_NormalizedRoute object at 0x7f7f30eb3fe0&gt;

    def test_single_param_route_with_static_prefix(self):
        &#34;&#34;&#34;Rule 3 &#43; rule 5: underscore stays unencoded in the static segment;
        the trailing segment is exactly one \`{name}\` (single-param-per-segment).
        &#34;&#34;&#34;
        meta = _get_meta(self.r_single_param)
...
↳ and 25 more — View all
Testing the test | all-jobs-are-green

View more details · View in GitHub Actions

ℹ️ Info

No other issues found (see more)

❄️ No new flaky tests detected

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 6cf6406 | Docs | View more details | Give us feedback!

This branch has not been deployed

No deployments
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.

1 participant