Commit 5d56f69
fix(appsec): text/plain response bodies must not be parsed (#13897)
Quick fix to remove parsing of plain text bodies:
matching failing system test:
https://github.com/DataDog/system-tests/blob/9a0d53da8e422e7ff84e2690038daa0ceaeaa0f0/tests/appsec/test_blocking_addresses.py#L479-L493
```python
def setup_non_blocking_plain_text(self):
self.setup_blocking()
self.rm_req_nonblock_plain_text = weblog.post(
"/waf", data=b'{"value4": "bsldhkuqwgervf"}', headers={"content-type": "text/plain"}
)
@Irrelevant(
context.weblog_variant in ("akka-http", "play", "jersey-grizzly2", "resteasy-netty3"),
reason="Blocks on text/plain if parsed to a String",
)
def test_non_blocking_plain_text(self):
self.test_blocking()
# TODO: This test is pending a better definition of when text/plain is considered parsed body,
# which depends on application logic.
assert self.rm_req_nonblock_plain_text.status_code == 200
```
## Checklist
- [x] PR author has checked that all the criteria below are met
- The PR description includes an overview of the change
- The PR description articulates the motivation for the change
- The change includes tests OR the PR description describes a testing
strategy
- The PR description notes risks associated with the change, if any
- Newly-added code is easy to change
- The change follows the [library release note
guidelines](https://ddtrace.readthedocs.io/en/stable/releasenotes.html)
- The change includes or references documentation updates if necessary
- Backport labels are set (if
[applicable](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting))
## Reviewer Checklist
- [x] Reviewer has checked that all the criteria below are met
- Title is accurate
- All changes are related to the pull request's stated goal
- Avoids breaking
[API](https://ddtrace.readthedocs.io/en/stable/versioning.html#interfaces)
changes
- Testing strategy adequately addresses listed risks
- Newly-added code is easy to change
- Release note makes sense to a user of the library
- If necessary, author has acknowledged and discussed the performance
implications of this PR as reported in the benchmarks PR comment
- Backport labels are set in a manner that is consistent with the
[release branch maintenance
policy](https://ddtrace.readthedocs.io/en/latest/contributing.html#backporting)1 parent 6180246 commit 5d56f69
File tree
2 files changed
+4
-11
lines changed- ddtrace/appsec
- tests/appsec/appsec
2 files changed
+4
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
| 60 | + | |
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | 26 | | |
34 | 27 | | |
35 | 28 | | |
36 | 29 | | |
37 | 30 | | |
38 | 31 | | |
39 | 32 | | |
40 | | - | |
| 33 | + | |
41 | 34 | | |
42 | | - | |
| 35 | + | |
43 | 36 | | |
44 | 37 | | |
45 | 38 | | |
| |||
59 | 52 | | |
60 | 53 | | |
61 | 54 | | |
62 | | - | |
| 55 | + | |
63 | 56 | | |
64 | 57 | | |
65 | 58 | | |
| |||
0 commit comments