Repository navigation
fix(server): send no message for a body with a JSON syntax fault - #1261
LeeroyHannigan wants to merge 8 commits into
Conversation
For a signed request body with a JSON syntax fault, DynamoDB sends
HTTP 400 and {"__type":"com.amazon.coral.service#SerializationException"}
alone. ExtendDB sent that type with the message "Start of structure or
map found where not expected: " and the JSON parser's error text.
Measured in us-east-1 on 2026-11-20, with each body sent signed at
least twice. Some bodies were empty, white space only or cut short.
Others held a byte order mark, a bad literal or escape, a trailing
comma, NaN or a raw control byte. No answer had a message field.
Unsigned, bodies cut short and bodies with a bad literal got the same
answer on 2026-11-19.
ExtendDB now answers such a body as it answers a body nested past its
depth ceiling: a SerializationException with no message. This also
drops the message for bodies that #1008, #1196 and #1257 track.
Fixes #1195.
Merges 4c2995c of fix/request-nesting-depth. That is its four commits since 1f49125 and its two merges of main (44cd436 and 6aef346). The four commits are the syntax scan with the service's grammar in request_syntax.rs, the message boundary test, the manual paragraph and the module split. Conflicts and their resolution: - crates/server/src/request_parse.rs, check_request_syntax: the other branch calls request_syntax::skip_value and keeps the depth branch that picks the message. This branch has one argument and no message for any refusal. Kept: one argument, skip_value, and every error mapped to serialization_refusal. The depth branch, over_ceiling_refusal and serialization_error go. The doc comment keeps the other branch's grammar and measurements and this branch's message sentence. - crates/server/src/request_parse.rs, the refusal test: this branch renamed it a_body_with_a_syntax_fault_is_refused_with_no_message with (body, read) rows that run the parse and the check. The other branch added seven leaf faults and two rows of exactly 5200 and 5201 openers that pin where the message stopped. Kept: this branch's shape, with the seven leaf faults as rows that are not read. The two boundary rows go: no refusal has a message now. - tests/test_request_nesting_depth.py, the refusal test: the other branch added the leaf parameter and seven rows. This branch replaced the message check with _is_messageless_serialization_error. Kept: both, and one comment that names the dates and the missing message. Auto-merged: handler.rs (the one-argument call beside main's point-in-time recovery refusal), the pass test's one-argument call, and the files of main.
Merges b9baaf5 of fix/request-nesting-depth. That commit merges main at 018715e into the other branch, five commits past 6aef346: - #503: the stream retention cutoff shape on SQLite - #526: the Return fields on a TransactWriteItems token replay - #690: catalog-check matches data relations by catalog id - #765: the FilterExpression suffix in the values message - #774: the Message key on two errors No conflicts. None of the five changes a file of this branch. #774 changes crates/server/src/response.rs, which renders the refusals that this branch's tests assert. SerializationException keeps the message key, and a refusal with an empty message still has no message key.
Merges 1a9efd7 of fix/request-nesting-depth. That brings its merge of main at b0d1c64 (#1280, #1009 and #596). It also brings the commit that makes the handler call extenddb_engine::check_operation before its body checks, and with_body(input).admit() after authentication. No conflicts. crates/server/src/handler.rs auto-merged. The two hunks of the other branch are the name check and the point-in-time refusal. This branch's one-argument check_request_syntax call sits between them. request_parse.rs and the two test files are as on this branch. One edit to the merge result is in README.md. #1009's item on the PartiQL operations gives a server's answer to a body that does not parse. That answer has the message "Start of structure or map found where not expected: …". This branch answers such a body with no message, so the item now says that.
Merges 027483d of fix/request-nesting-depth. That commit changes one sentence of the WebAssembly adapter's module doc in crates/wasm-adapter/src/runtime.rs. No conflicts. The commit changes no file of this branch.
_is_messageless_serialization_error in tests/test_request_nesting_depth.py
checked the type and that the error had no "message" key. A refusal with
its message under "Message" passed it. The helper now compares the whole
error document with {"__type": SERIALIZATION_TYPE}, as
tests/test_syntax_fault_message.py does.
On the server, each refusal that the helper checks is that document
alone. The service answered each malformed deep body with that document
alone, unsigned and badly signed.
REQ-ERR-002 in docs/design/01-requirements.md said that an error must have a message field, and it listed SerializationException among the errors that carry "Message". The server now sends a SerializationException with no message field for a body that does not parse as JSON, as the service does. The depth ceiling's refusal has no message field either. REQ-ERR-002 now says so.
Merges 71b3e1b of fix/request-nesting-depth, the rows at the edges of the syntax check's looser rules. At 63 and at 20000 wrappers, the numbers 1+, 1e+5 and 1.eE-+ and the escape \ugggg reach authentication. The numbers +1 and .5 and the escapes \u000/ and \u000h get a refusal before it. Two conflicts, both in the refusal tests: - crates/server/src/request_parse.rs: this branch replaced the other branch's refusal test with a_body_with_a_syntax_fault_is_refused_with_no_message. The eight refused rows go into its table as rows the server does not read. The parse and the check must each refuse them with no message. Its comment names them with their measurement. - tests/test_request_nesting_depth.py: the comment of test_a_malformed_deep_body_is_refused_before_authentication keeps this branch's words "and no message field" and takes the other branch's dates for the eight new rows. This branch's assertion, a SerializationException with no message field, applies to each of them. The four new leaves of LOOSE_LEAVES auto-merged in both files.
navareamol
left a comment
There was a problem hiding this comment.
I found no defect in the change itself. Two items on the PR:
-
This head does not merge with current main.
git merge-treeof the head with main (222d80a) reports one conflict, incrates/engine/src/lib.rs, a file this PR does not change. The conflict is between the base branch and main: the base branch changes thepub use pre_dispatch::{...}line and main added#[cfg(test)] mod test_context;just above it. I kept both lines, built the merged tree and rantests/test_syntax_fault_message.pyandtests/test_request_nesting_depth.pyon SQLite: 120 passed. CI ran on the head, not on that merged tree. I think the base branch needs to be updated with main first, then this branch. Is that planned? -
The checklist and the Testing done section disagree. The checklist ticks "All tests pass (
cargo test --workspace)". Testing done givescargo test -p extenddb-server --libat e7ef4ad (506 passed, 5 failing on that host), and no workspace run for any later commit. The bullet for 600726b lists fmt, clippy, the 11request_parsetests and the two Python files. I think either the box should be unticked, or the section should name a workspace run at the current head. I ran the 11request_parsetests at the head and they pass.
What I ran, so you can skip it: with serialization_refusal changed back to return the old message, 3 of the 11 unit tests fail (the new test fails at the empty body) and 54 of the 120 Python tests fail. A build of the base branch fails 41 of the 120 (13 of the 15 new rows plus 28 nesting rows), so the new rows do detect this change. Bodies with invalid UTF-8, an oversized body, and bodies nested 1,000,000 deep: no panic, the server keeps answering, and neither the default log nor trace level repeats any text from the body. I did not run this against the live service, PostgreSQL or Cassandra.
I will approve once the base branch and this branch are updated with main and the checklist matches what was run.
|
|
The README item and the stale text. On main the sentence you changed in README.md (the PartiQL refusal that says the build answers a body that does not parse with no message) now lives in docs/webassembly.md, lines 166 to 172, and it still says "Start of structure or map found where not expected". When the stack takes main and the README conflict is resolved, that edit has to go into docs/webassembly.md, or the page will contradict the server again. I checked your description of the three conflicting files against git and it matches what I get at c057660. I think this needs a note in the rebase step. Is the plan to carry the sentence over to docs/webassembly.md? The description. The Testing done section now names run 45570294136 at 600726b with the workspace command and 530 passed. I read both run-tests jobs (stable and 1.91.1) and they show the same, with no failed test, so the ticked box now has a run behind it. The conflict list of #530 and #537 in the description: I could confirm #530 changes README.md, but not that #537 does. Can you check that line? I will approve once the PartiQL sentence is carried into docs/webassembly.md when the stack is rebased onto main, and the #537 line in the description is checked. |
navareamol
left a comment
There was a problem hiding this comment.
Both points are answered, and I found nothing new at 600726b.
-
The conflicts. With main at 5826e1b, git merge-tree gives the same three conflicts for this head and for #807's head (71b3e1b): README.md, crates/engine/src/lib.rs and crates/wasm-adapter/src/runtime.rs. Of the three, this PR changes only README.md, so the other two come from #807. On main, docs/webassembly.md lines 166 to 174 still say "Start of structure or map found where not expected" for a body that does not parse, so the sentence this PR changes has to go into that item when the stack takes #807's new head. The description now says this, which answers my question.
-
The #537 line. You are right. #537's own change does not touch README.md. Its head contains #530's head 469669e, and git merge-tree of #537's head and of #530's head each report README.md against this head, while #807's head merges with both with no conflict. #530 changes README.md. The description now names #530 and says #537 gets the conflict through it.
CI at 600726b shows 54 of 54 checks passed and the merge state is CLEAN.
I approve this PR.
Changes since the last review
README.md. docs: configuration reference generated from the sample file, pinned to the structs #537's own change leavesREADME.mdas it is, and its head gets the conflict through docs: architecture dash sweep and one feature status owner #530's head, which it contains. The section also gives the trial merge withmainat 5826e1b, and says how this PR's sentence on the PartiQL operations gets todocs/webassembly.md.Merge fix/request-nesting-depth into fix/1195-syntax-fault-message. It merges fix(server): parse request bodies nested to the depth the service validates #807 at 71b3e1b, which adds rows at the edges of the syntax check's looser rules. At 63 and at 20000 wrappers,1+,1e+5,1.eE-+and\uggggreach authentication.+1,.5,\u000/and\u000hget a refusal before it. Two files conflicted, both in the refusal tests. Incrates/server/src/request_parse.rs, the eight refused rows go into this PR's(body, read)table ofa_body_with_a_syntax_fault_is_refused_with_no_message. The parse and the check must each refuse them with no message. Intests/test_request_nesting_depth.py, the comment of the refusal test keeps this PR's words "and no message field" and takes fix(server): parse request bodies nested to the depth the service validates #807's dates for the new rows. This PR's assertion, aSerializationExceptionwith no message field, applies to them. At 600726b,cargo fmt --all -- --checkandcargo +1.97.0 clippy -p extenddb-server --all-targets -- -D warningsare clean. So iscargo +1.91.1 check -p extenddb-server --all-targets. The 11request_parseunit tests pass. Three changes to the check each fail a new row. Taking any printable byte after\ufails a refusal row, and so does letting a number start with+or.. Taking+out of the number bytes fails the1+row of the pass test.tests/test_request_nesting_depth.py(105) andtests/test_syntax_fault_message.py(15) pass 120 tests against SQLite. The clippy step ofwasm.ymlis clean, run locally with a stand-in C compiler because clippy does not link.pytest --collect-onlycollectstests/(6780) andtests/python(672) with no error.docs(design): say that a body that does not parse gets no message. REQ-ERR-002 indocs/design/01-requirements.mdsaid that an error has a message field, and it listedSerializationExceptionamong the errors withMessage. It now also says that theSerializationExceptionfor a syntax fault or for a body past the depth ceiling has no message field. The service sends no message field for these bodies. At 7d7a089,cargo fmt --all -- --checkandcargo +1.97.0 clippy -p extenddb-server --all-targets -- -D warningsare clean. The 11request_parseunit tests pass.tests/test_request_nesting_depth.pyandtests/test_syntax_fault_message.pypass 88 tests against SQLite. The clippy step ofwasm.ymlis clean, run locally with a stand-in C compiler because clippy does not link.pytest --collect-onlycollectstests/(6748) andtests/python(672) with no error.test(server): compare the whole refusal in the nesting test's helper._is_messageless_serialization_errorintests/test_request_nesting_depth.pychecked the type and that the error had nomessagekey. A refusal with its message underMessagepassed it, and fix(server): send Message on a SerializationException #1220 writes aSerializationExceptionmessage under that key. The helper now compares the whole error document with{"__type": SERIALIZATION_TYPE}, astests/test_syntax_fault_message.pydoes. Given a document with aMessagemember, the old helper returns true and the new one returns false. The tests that call the helper pass against SQLite at 7d7a089.Merge fix/request-nesting-depth into fix/1195-syntax-fault-message. It merges fix(server): parse request bodies nested to the depth the service validates #807 at 027483d, which changes one sentence of the WebAssembly adapter's module doc. No file conflicted, and this PR's change over fix(server): parse request bodies nested to the depth the service validates #807 is byte for byte its change before the merge.Merge fix/request-nesting-depth into fix/1195-syntax-fault-message. It merges fix(server): parse request bodies nested to the depth the service validates #807 at 1a9efd7, which merges main at b0d1c64: test(storage-mongodb): end the killed holder's lease by data, not by waiting #1280, feat(wasm): [Add WebAssembly browser support for ExtendDB #1009 and UpdateExpression ADD creates no missing map on its path #596. fix(server): parse request bodies nested to the depth the service validates #807's 1a9efd7 makes the handler callextenddb_engine::check_operationbefore its body checks andwith_body(input).admit()after authentication. No file conflicted. Incrates/server/src/handler.rs, those two hunks auto-merged around this PR's one-argumentcheck_request_syntaxcall. The merge result has one edit, inREADME.md. feat(wasm): [Add WebAssembly browser support for ExtendDB #1009's item on the PartiQL operations gave a server's answer to a body that does not parse. That answer had the message "Start of structure or map found where not expected: …". The item now says that a server answers such a body with no message. Apart from that edit, this PR's change over fix(server): parse request bodies nested to the depth the service validates #807 is its change before the merge. At 654fef3,cargo fmt --all -- --checkandcargo +1.97.0 clippy -p extenddb-server --all-targets -- -D warningsare clean. The 11request_parseunit tests pass.tests/test_request_nesting_depth.pyandtests/test_syntax_fault_message.pypass 88 tests against SQLite. The clippy step ofwasm.ymlis clean, run locally with a stand-in C compiler because clippy does not link.pytest --collect-onlycollectstests/(6748) andtests/python(672) with no error.Merge fix/request-nesting-depth into fix/1195-syntax-fault-message. It merges fix(server): parse request bodies nested to the depth the service validates #807 at b9baaf5, which merges main at 018715e: fix(sqlite): render the stream retention cutoff in the created_at column shape #503, fix(engine): compare the Return fields on a TransactWriteItems token replay #526, fix: match data relations by catalog id in catalog-check, so --fix keeps live tables #690, fix(scan): drop the FilterExpression suffix from the values message #765 and fix(server): send Message on the two errors the service sends it on #774. No file conflicted, and this PR's change over fix(server): parse request bodies nested to the depth the service validates #807 is byte for byte its change before the merge. fix(server): send Message on the two errors the service sends it on #774 changescrates/server/src/response.rs, which renders the refusals these tests assert. ASerializationExceptionkeeps themessagekey, and a refusal with an empty message still has no message key. At 0986467,cargo fmt --all -- --checkandcargo +1.97.0 clippy -p extenddb-server --all-targets -- -D warningsare clean. The 11request_parseunit tests pass.tests/test_request_nesting_depth.pyandtests/test_syntax_fault_message.pypass 88 tests against SQLite.pytest --collect-onlycollectstests/(6725) andtests/python(672) with no error.Merge fix/request-nesting-depth into fix/1195-syntax-fault-message. It merges fix(server): parse request bodies nested to the depth the service validates #807 at 4c2995c, which has fix(server): parse request bodies nested to the depth the service validates #807's fix round (the syntax scanrequest_syntax::skip_value, the manual paragraph and the module split) and main at 6aef346. Two files conflicted. Incrates/server/src/request_parse.rs,check_request_syntaxkeeps one argument and now callsskip_value, with every fault sent toserialization_refusal. fix(server): parse request bodies nested to the depth the service validates #807's depth branch,over_ceiling_refusalandserialization_errorgo. The unit test keeps this PR's(body, read)rows and gains fix(server): parse request bodies nested to the depth the service validates #807's seven leaf faults as refused rows. fix(server): parse request bodies nested to the depth the service validates #807's two rows of 5200 and 5201 openers go, since they pinned where the message stopped and no refusal has a message now. Intests/test_request_nesting_depth.py, the refusal test keeps fix(server): parse request bodies nested to the depth the service validates #807'sleafrows and this PR's_is_messageless_serialization_errorcheck. At 748d21e,cargo fmt --all -- --checkandcargo +1.97.0 clippy -p extenddb-server --all-targets -- -D warningsare clean. The 11request_parseunit tests pass.tests/test_request_nesting_depth.pyandtests/test_syntax_fault_message.pypass 88 tests against SQLite.What
For a request body with a JSON syntax fault, ExtendDB now sends HTTP 400 and
{"__type":"com.amazon.coral.service#SerializationException"}with no message, as DynamoDB does. Before this change, the body also had a message. It was "Start of structure or map found where not expected: " and the JSON parser's error text.The change is in
crates/server/src/request_parse.rs:over_ceiling_refusalis nowserialization_refusal. It already wrote the body with no message for a body nested past the depth ceiling.parse_request_valueandcheck_request_syntaxsend each syntax fault toserialization_refusal.check_request_syntaxhas nodepthparameter now. The parameter only chose between the two refusals.serialization_error, which wrote the old message.The README describes how the WebAssembly build refuses the PartiQL operations. Its item now says that a server answers a body that does not parse with no message. That build parses a body with serde_json's defaults, so it still sends the message (#1471).
REQ-ERR-002 in
docs/design/01-requirements.mdnow says that theSerializationExceptionfor a syntax fault or for a body past the depth ceiling has no message field.parse_request_valuealso sends bytes after a complete JSON value to the same refusal. DynamoDB reads such a body (#1008), so no test checks this answer.The base of this PR is #807, which adds
check_request_syntaxand the depth ceiling.Why
DynamoDB's answers, measured in us-east-1 on 20 November 2026. Each body went to DescribeTable or PutItem for a table that does not exist, signed, at least twice:
{not jsonNaNas a numbertruas a valuexand then 200[xand then 6000[]for its last}\qEach send got HTTP 400 and
{"__type":"com.amazon.coral.service#SerializationException"}, with no message field. On 19 November, unsigned sends of bodies cut short and of bodies with a bad literal got the same answer.ExtendDB on #807 gave DynamoDB's answer for one of these 15 bodies:
xand then 6000[, which is past its ceiling of 5200 levels. For the other 14 it sent the message. With this change, it gives DynamoDB's answer for all 15.Fixes #1195
Testing done
run-testsjobs, on stable and on 1.91.1, rancargo test --locked --workspace --exclude extenddb-backup-storeandcargo test --locked -p extenddb-backup-store. In each job, the server crate's unit tests gave 530 passed and 0 failed.cargo +1.97.0 clippy -p extenddb-server --all-targets -- -D warningsandcargo +1.97.0 fmt --all -- --checkare clean at e7ef4ad and at 748d21e.a_body_with_a_syntax_fault_is_refused_with_no_messagehas 19 rows. They are a body that parses, an empty body, bodies cut short within and past the ceiling, and seven leaf faults from fix(server): parse request bodies nested to the depth the service validates #807. The other eight are fix(server): parse request bodies nested to the depth the service validates #807's four edge faults at 63 and at 20000 wrappers. With the old message put back, the test fails at the empty body.tests/test_syntax_fault_message.py(15 rows) andtests/test_request_nesting_depth.pypassed 42 tests. Against a server built from fix(server): parse request bodies nested to the depth the service validates #807's head 71b3e1b, 13 of the 15 rows of the new file fail. So do 28 rows of the nesting test. Three of their bodies are 63, 200 and 2000 nested maps without the last byte. Seven have a fault in a leaf at 200 maps, and four have fix(server): parse request bodies nested to the depth the service validates #807's edge faults at 63 maps. Each body has an unsigned row and a badly signed row.test_request_nesting_depth.pynow expects{"__type":"com.amazon.coral.service#SerializationException"}alone for each malformed deep body, unsigned or badly signed, within the ceiling and past it.Line counts of this PR's own change at 600726b: production +21 -34, tests +142 -94, README +4 -5 and the requirements doc +1 -1.
With
mainat c057660 and at 5826e1b (3 December 2026),git merge-treeof this head reports conflicts inREADME.md,crates/engine/src/lib.rsandcrates/wasm-adapter/src/runtime.rs. #807 at 71b3e1b has the same three conflicts, in files that #807 changes. Of the three, this PR changes onlyREADME.md. Its sentence on the PartiQL operations of the WebAssembly build is inside the conflict hunk, because #1521 onmainmoved that section todocs/webassembly.md. There the sentence still has the old message, in the PartiQL item (lines 166 to 174 at 5826e1b). This branch takesmainthrough #807, so the merge ofmainstarts at #807. When this branch then merges #807's new head, this PR's change to the sentence goes into that item ofdocs/webassembly.md.This PR adds a conflict with the open PR #530 in
README.md. #530 changes the first line of theDescribeEndpointsitem in the WebAssembly section, which comes right after the lines this PR changes. #537 sits on #530's branch and contains #530's head 469669e, so its head gets the same conflict. #537's own change leavesREADME.mdas it is. Each other open PR that conflicts with this PR has the same conflicting files with #807. #200, #547, #549, #557, #587, #850 and #854 conflict with #807 and with this PR incrates/server/src/handler.rs. For #200, #850 and #854, the hunks are the same, and the changedcheck_request_syntaxcall is in none of them. For #547, #549, #557 and #587, one hunk holds the handler's body checks on #807 too, and the changed call is inside it.Not in this PR, each in an open issue:
{...} xor{...}{}. DynamoDB reads the object (ExtendDB refuses a request body with bytes after its closing brace, which the service accepts #1008). ExtendDB still refuses the body, now with no message.[],5,"x"ornull). It goes through the engine'sdeserialize_errorand keeps its text (A request member of the wrong JSON type gets serde_json's error text, where the service sends its own #1012).Checklist
cargo test --workspace)cargo fmt --check)cargo clippy -- -W clippy::pedantic)Storagetrait, auth model, on-diskformat, or public CLI surface, an RFC has been accepted or is linked
below. Otherwise, an ADR captures the decision (link below).
ADR / RFC: n/a
Breaking changes
A request whose body does not parse as JSON still gets HTTP 400 and a
SerializationException. The error now has no message field. Before this change, it had the message "Start of structure or map found where not expected: " and the JSON parser's error text.By submitting this pull request, I confirm that my contribution is made under
the terms of the Apache License 2.0 and I agree to the Developer Certificate of
Origin (DCO). See CONTRIBUTING.md for details.