Repository navigation
fix(server): read a trailing point and a lone minus sign in a request number - #1372
LeeroyHannigan wants to merge 8 commits into
Conversation
… number ExtendDB refused a request body with a number that ends in a point, such as 1., with a SerializationException. It refused a minus sign on its own the same way, because serde_json refuses both forms. DynamoDB reads both. Outside its model it skips a number of either form unread. In an integer member it reads 1., 0., -1. and 1000001. as 1, 0, -1 and 1000001, and a minus sign on its own as 0. Measured in us-east-1 on 21 Nov 2026, with Scan Limit and TotalSegments on a table that does not exist. The pass that removes the leading zeros of a refused body now also removes a point that ends a number after its digits. It writes 0 for a minus sign that is a whole number. It is still one pass over the body, and it does not recurse. The bytes of strings and the nesting do not change. Every other number stays as sent, so ExtendDB refuses -., 1e, 1.e, 1e5., 1- and -.5 as before. DynamoDB refuses the first five in an integer member with "Bad number format", and it reads -.5 as a fraction. ExtendDB reads a body that serde_json accepts in one pass, as before. Refs #1343.
Merges 00ccd3b of fix/1257-leading-zero-numbers. That brings in fix/1195-syntax-fault-message at 748d21e and fix/request-nesting-depth at 4c2995c, with the merge commits of both branches. The 4c2995c head holds the syntax scan with the service's grammar in request_syntax.rs and the merges of main at 44cd436 and 6aef346. Conflicts and their resolution, all in crates/server/src/request_parse.rs: - check_request_syntax: this branch's doc comment said a number that rewrite_numbers rewrites passes the check. The check is now request_syntax::skip_value, which passes `01`, `1.`, `1e` and `-` as sent. Kept: the other branch's doc comment. The read_json wrap went in the other branch's merge, so none is here. - rewrite_numbers, the token state: this branch's Token match stays. The other branch's at_start line belonged to without_leading_zeros, which this branch replaced. - a_body_with_a_syntax_fault_is_refused_with_no_message: both branches added rows. Kept: this branch's trailing point and lone minus rows and the other branch's seven leaf faults, with one comment. The second number_byte goes: rewrite_numbers calls request_syntax::number_byte, which has the same body and doc sentence. The refused numbers of the test now run through the parse alone. Before authentication skip_value reads a number as `-` or a digit and then any run of number bytes. So it passes `1e`, `--1` and the other rows that start that way, where serde_json's skip refused them. The parse still refuses each of the seventeen with no message.
The security manual's paragraph on the syntax check names the forms the check passes to authentication. On this branch the parse after authentication reads `1.` as 1 and `-` as 0, beside a number written with leading zeros, and refuses the other forms. The paragraph now says so.
Merges 54ed1f2 of fix/1257-leading-zero-numbers, its merge of fix/1195-syntax-fault-message at 0986467. That brings in fix/request-nesting-depth at b9baaf5, which merges main at 018715e, 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 61eee55 of fix/1257-leading-zero-numbers, its merge of fix/1195-syntax-fault-message at 654fef3. That brings main at b0d1c64 (#1280, #1009 and #596). It also brings the commit that makes the handler call extenddb_engine::check_operation and with_body(input).admit() around the server's parse. The README item on the PartiQL operations now says that a server answers a body that does not parse with no message. No conflicts. None of these commits changes a file of this branch.
Merges 7ad2a44 of fix/1257-leading-zero-numbers, its merge of fix/1195-syntax-fault-message at 7d7a089. That brings three commits: - the merge of fix/request-nesting-depth at 027483d, which changes one sentence of the WebAssembly adapter's module doc - 3f5ccff, after which the helper _is_messageless_serialization_error of tests/test_request_nesting_depth.py compares the whole error document - 7d7a089, after which REQ-ERR-002 in docs/design/01-requirements.md says that a SerializationException for a body that does not parse has no message field No conflicts. None of these commits changes a file of this branch.
Merges 693b815 of fix/1257-leading-zero-numbers, its merge of fix/1195-syntax-fault-message at 600726b. That brings 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. One conflict, in the comment of a_body_with_a_syntax_fault_is_refused_with_no_message in crates/server/src/request_parse.rs. The resolution keeps this branch's text on the rows with a trailing point or a minus sign on its own. It also names the eight new rows with their measurement. The eight rows auto-merged into the table with None. rewrite_numbers rewrites no number in them, so the parse refuses each with no message. tests/test_request_nesting_depth.py auto-merged with the other branch's rows.
navareamol
left a comment
There was a problem hiding this comment.
-
The head does not merge cleanly with current main. A trial merge of 4f689ba with main at 92155f3 conflicts in
README.md,crates/engine/src/lib.rsandcrates/wasm-adapter/src/runtime.rs. This PR changes none of them, and #1344 at 693b815 has the same three conflicts with main, so they come from main moving under the stack. I kept both lines inlib.rs(main'stest_contextmodule and the branch's widerpub use) and the branch side of the two doc comments. That tree builds,test_syntax_fault_message.pyandtest_request_nesting_depth.pypass 138 of 138 on SQLite, and my probes of the new forms answer as on the head. CI ran on the branch, not on a tree with main in it. Could the stack be brought up to date with main when #807, #1261 and #1344 move, so CI runs on the merged code? -
One number in Testing done comes from an older revision. It gives 506 passed for the server crate tests at 90dc032. At the head, the server crate's unit tests give 530 passed and 0 failed here. The checklist ticks
cargo test --workspace, and I could not find a workspace run described for any revision. I think the count should be updated to the head, or the box unticked.
I will approve once the Testing done count matches the head.
|
|
The description now matches the head. It names run 45570893865 at 4f689ba with the two workspace cargo commands, and I read 530 passed and no failed test in both run-tests jobs, stable and 1.91.1. The old 506 count is gone, so the ticked workspace box has a run behind it. The three conflicting files at main c057660 are README.md, crates/engine/src/lib.rs and crates/wasm-adapter/src/runtime.rs, the same ones I get for this head and for the three heads below it, and this PR changes none of them. The stack order you describe is what I would expect. I have no further findings on the code. My earlier checks of the head still hold, since it did not move. I will approve once the stack is rebased onto main and CI has run on the merged tree. |
Changes since the last review
mainat c057660.Merge fix/1257-leading-zero-numbers into fix/1343-number-forms. It merges fix(server): read a number written with leading zeros in a request body #1344 at 693b815, which carries fix(server): send no message for a body with a JSON syntax fault #1261 at 600726b and fix(server): parse request bodies nested to the depth the service validates #807 at 71b3e1b. fix(server): parse request bodies nested to the depth the service validates #807's 71b3e1b 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. One hunk conflicted, in the comment ofa_body_with_a_syntax_fault_is_refused_with_no_messageincrates/server/src/request_parse.rs. The resolution keeps this PR's text on the rows with a trailing point or a minus sign on its own. It also names the eight new rows with their measurement. The eight rows auto-merged into the table withNone.rewrite_numbersrewrites no number in them, so the parse refuses each with no message. At 4f689ba,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, as on fix(server): send no message for a body with a JSON syntax fault #1261.tests/test_request_nesting_depth.py(105) andtests/test_syntax_fault_message.py(33) pass 138 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/(6798) andtests/python(672) with no error.Merge fix/1257-leading-zero-numbers into fix/1343-number-forms. It merges fix(server): read a number written with leading zeros in a request body #1344 at 7ad2a44, which carries fix(server): send no message for a body with a JSON syntax fault #1261 at 7d7a089 and fix(server): parse request bodies nested to the depth the service validates #807 at 027483d. fix(server): parse request bodies nested to the depth the service validates #807's 027483d changes one sentence of the WebAssembly adapter's module doc. After fix(server): send no message for a body with a JSON syntax fault #1261's two new commits, the helper_is_messageless_serialization_erroroftests/test_request_nesting_depth.pycompares the whole error document. REQ-ERR-002 indocs/design/01-requirements.mdnow says that aSerializationExceptionfor a body that does not parse has no message field. No file conflicted, and none of these commits changes a file of this PR. This PR's change over fix(server): read a number written with leading zeros in a request body #1344 is byte for byte its change before the merge. At a74506a,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 106 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/(6766) andtests/python(672) with no error. The Why section now gives DynamoDB's answers to a request body that is only-or1., with or without a space after it. They were measured on 25 November 2026.Merge fix/1257-leading-zero-numbers into fix/1343-number-forms. It merges fix(server): read a number written with leading zeros in a request body #1344 at 61eee55, which carries fix(server): send no message for a body with a JSON syntax fault #1261 at 654fef3, fix(server): parse request bodies nested to the depth the service validates #807 at 1a9efd7 and 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_operationandwith_body(input).admit()around the server's parse. fix(server): send no message for a body with a JSON syntax fault #1261's merge edits the README item on the PartiQL operations. The item now says that a server answers a body that does not parse with no message. No file conflicted, and none of these commits changes a file of this PR. This PR's change over fix(server): read a number written with leading zeros in a request body #1344 is byte for byte its change before the merge. At 4a7a5b8,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 106 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/(6766) andtests/python(672) with no error.Merge fix/1257-leading-zero-numbers into fix/1343-number-forms. It merges fix(server): read a number written with leading zeros in a request body #1344 at 54ed1f2, which carries fix(server): send no message for a body with a JSON syntax fault #1261 at 0986467, fix(server): parse request bodies nested to the depth the service validates #807 at b9baaf5 and 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): read a number written with leading zeros in a request body #1344 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 4ea3c0d,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 106 tests against SQLite.pytest --collect-onlycollectstests/(6743) andtests/python(672) with no error.docs(server): say that the parse reads a trailing point and a lone minus. The security manual's paragraph on the syntax check names the forms the check passes to authentication. It now says that the parse after authentication reads1.as 1 and-as 0, beside a number written with leading zeros. The parse refuses the other forms.Merge fix/1257-leading-zero-numbers into fix/1343-number-forms. It merges 68f0379, the commit of fix(server): read a number written with leading zeros in a request body #1344 that changes one sentence of the security manual. No file conflicted.Merge fix/1257-leading-zero-numbers into fix/1343-number-forms. It merges fix(server): read a number written with leading zeros in a request body #1344 at 00ccd3b, which carries fix(server): send no message for a body with a JSON syntax fault #1261 at 748d21e, fix(server): parse request bodies nested to the depth the service validates #807's fix round (the syntax scanrequest_syntax::skip_value) and main at 6aef346. Three hunks ofcrates/server/src/request_parse.rsconflicted.check_request_syntaxkeeps fix(server): send no message for a body with a JSON syntax fault #1261's one-line call ofskip_value, whose number lexeme reads1.,-and01as sent, so this PR's wrap of the check went with fix(server): read a number written with leading zeros in a request body #1344's.rewrite_numberskeeps itsTokenstate. The unit test keeps this PR's rows beside fix(server): parse request bodies nested to the depth the service validates #807's seven leaf faults. This PR's ownnumber_bytegoes:rewrite_numberscallsrequest_syntax::number_byte, which has the same body and doc sentence. The 17 refused numbers of the unit test now run through the parse alone. Before authenticationskip_valuepasses1e,--1and the other rows that start with-or a digit, where serde_json's skip refused them. The parse still refuses each of the 17 with no message. At 3f1be69,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 106 tests against SQLite.What
The server now reads two more number forms in a request body as DynamoDB reads them. It reads a number that ends in a point after its digits, such as
1.or-1., as the digits. It reads a minus sign on its own,-, as 0. Before, a body with either form got aSerializationExceptionwith no message, because serde_json refuses both.The change is in
crates/server/src/request_parse.rs.without_leading_zerosfrom #1344 is nowrewrite_numbers, and it adds two rules to the leading zero rule:-that starts a number and has no number byte after it as0..after an optional-and digits when no number byte comes after it.It is still one pass over the body with
StringScan, and it does not recurse. The bytes of every string and the nesting do not change. When the pass changes nothing, it returns nothing, and the body is not read again. The two new rules need to know what the number so far holds. One flag cannot carry that, so a four-stateTokentakes its place. The number bytes come fromrequest_syntax::number_byte, which #1344 at 00ccd3b already calls in place of an inlinematches!.Every other number form stays as sent and gets the refusal it gets now. DynamoDB skips those forms in a member outside its model. In an integer member, it refuses
-.,1e,1.e,1e5.and1-with"Message":"Bad number format", and it reads-.5and1.e7as numbers. The step that rewrites the body does not know the member type, so it cannot give both answers. #1343 stays open for those forms.The security manual's paragraph on the syntax check (
docs/manuals/10-security-model.md) now says that the parse after authentication reads1.as 1 and-as 0.The WebAssembly build parses a body with serde_json's defaults, so it still refuses both forms (#1471).
The base of this PR is #1344.
Why
These are DynamoDB's answers, measured in us-east-1 on 21 and 22 November 2026 with signed requests. Each request went out twice and got the same answer both times. Every request names a table that does not exist.
ResourceNotFoundException.SerializationExceptionwith no message.ValidationException.xthat is not in the model, of value1.or-Limit1.Limit0.or-Value '0' at 'limit'Limit-1.Value '-1' at 'limit'Segment0andTotalSegments1000001.Value '1000001' at 'totalSegments'Segment0andTotalSegments-Value '0' at 'totalSegments'The rows where DynamoDB answers VE do not match on a missing table. ExtendDB's Scan looks up the table before it checks
Limit,SegmentandTotalSegments, and DynamoDB checks these ranges first (#850). On a table that exists, each of these Scan rows gets DynamoDB's text. TheTotalSegments-row is different: it gets ExtendDB's sentenceThe parameter TotalSegments should be greater than or equal to 1(#563).These answers still differ from DynamoDB, or were not measured:
Limit-0.becomes-0. serde_json reads-0as a float, so it gets the answer that the valid JSON-0already gets. DynamoDB reads both as 0. fix(scan): report every Limit, Segment and TotalSegments range fault in the service's two forms #850 reads these members from any JSON number.1.and-now get theSerializationExceptiontext that a plain number gets in that member. Before, they got no message. DynamoDB sends a type text, such asDECIMAL_VALUE cannot be converted to String(A request member of the wrong JSON type gets serde_json's error text, where the service sends its own #1012). After the rewrite, ExtendDB cannot tell1.from1.-or1., with or without white space after it, now reaches authentication, as on DynamoDB (unsigned, MissingAuthenticationTokenException, measured 25 November 2026). Signed, DynamoDB answers it as it answers a body of5, withSerializationException"Unexpected value type in payload". ExtendDB gives it the text it gives5(A request member of the wrong JSON type gets serde_json's error text, where the service sends its own #1012), where fix(server): read a number written with leading zeros in a request body #1344 gave a SerializationException with no message.Refs #1343
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 90dc032 and at 3f1be69.a_body_with_a_syntax_fault_is_refused_with_no_messagehas rows for the two new forms, a body 1127 levels deep, and the 17 forms that stay refused. At 3f1be69 the 17 run through the parse alone.tests/test_syntax_fault_message.pyhas 6 new rows.request_parse.rsfrom fix(server): read a number written with leading zeros in a request body #1344 and the tests of this PR,a_body_with_a_syntax_fault_is_refused_with_no_messagefails at its first new row.tests/test_syntax_fault_message.pypassed 33 tests at 90dc032, and 3 of them failed on fix(server): read a number written with leading zeros in a request body #1344's head.Limit1.returned 1 item. Each other Scan row of the table got the answer that the same body gets with the plain number.request_parsetests ran on the last commit.Line counts of this PR's own change at 4f689ba: production +63 -25, of which +33 -8 is code and the rest is comments. The tests are +60 -18. One line of the security manual changes.
git merge-treeof 4f689ba shows no conflict with #1265 at 53d0c75. The branch contains #1344 at 693b815, #1261 at 600726b, #807 at 71b3e1b andmainat b0d1c64. 28 open PRs outside #807, #1261, #1265, #1344 and #1372 changedocs/manuals/10-security-model.md. Of these, only #140 conflicts with this branch in that file, and it has the same four conflict hunks withmain.With
mainat c057660 (3 December 2026),git merge-treeof 4f689ba reports conflicts inREADME.md,crates/engine/src/lib.rsandcrates/wasm-adapter/src/runtime.rs. #1344 at 693b815, #1261 at 600726b and #807 at 71b3e1b have the same three conflicts. This PR changes none of the three files.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
The server now reads a number that ends in a point after its digits, such as
1.or-1., as the digits. It reads a minus sign alone,-, as 0. A request with either form now gets the answer of the same request with the plain number. Before this change, it got aSerializationExceptionwith no message. For example, on a table with two items, a Scan withLimit1.now returns 1 item. In a string, boolean or map member, the two forms now get theSerializationExceptiontext that a plain number gets in that member. A body that is only-or1.now reaches authentication, and signed it gets the text that a body of5gets (#1012).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.