Repository navigation
scripts: add the check_decode harness the HARDENING corpus runs - #27
Merged
Merged
Conversation
cross_security_check.sh looks for scripts/check_decode.py and reports the port as not run without it, so no corpus row has reached this port since the file was lost. The harness at 51df4a6 is on no branch here. It is rewritten rather than restored, because that version could pass a row without testing it: SBE was a stub that rejected everything, and every SBE row expects a reject; and Python's exit code for an uncaught exception, 1, is the gate's clean reject. Now SBE goes through the codec, the schema is bound before the input is read, and anything but a decode error exits 2. The schema comes from adversarial.binpb, so Tree's new branches and tags fields (protowire#449) needed no bindings here.
| args = p.parse_args(argv) | ||
| try: | ||
| return _run(args) | ||
| except BaseException as e: # noqa: BLE001 -- exit 1 would read as a clean reject. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The HARDENING security corpus can now run against this port. Until now it could not:
scripts/check_decode.pydoes not exist on any branch here, socross_security_check.shprintedpython: no check-decode harness, not run.Advances trendvidia/protowire#449
All corpus rows pass with no decoder change, on protowire-cpp v1.1.0 or later. That includes the new map-depth rows from protowire PR #465. This PR adds only the harness.
The pin matters
The rows pass only on a build that uses protowire-cpp v1.1.0 or later. This repo's workflows still pin v1.0.0, and on that build 19 of 31 rows pass and one segfaults. #23 has the table, and #26 moves the pin. Until that lands, wheels built from main do not have these limits.
What the rows test
ParseFromString. The limit comes from upb's default.adversarial.binpb, so Tree'sbranchesandtagsneeded no bindings. I checked the file lists both fields. PB cannot be skipping them as unknown:deep-map-101anddeep-scalar-map-101fail withExceeded upb_DecodeOptions_MaxDepth, which needs a descent through those fields.pythoninskipdo not run, mostly because they need--limit.Why this is not the old file
The earlier harness survives only at commit 51df4a6, which is on no branch. I rewrote it because it could pass a row without testing it:
sbe.Codec.Evidence
From the protowire-449 worktree at 819bd78, with protowire-cpp at main (8d0867a):
Exit code 0. Before the harness, the same command printed
no port has a check-decode binary builtand exited 2.The gate discards each row's output, so I also ran every row by hand and read the reason. All 31 match. The new rows:
Failure modes checked: a broken extension build, a missing
.binpband an unknown schema each exit 2.pytest -q:100 passed in 0.59s. No test covers the harness itself, and no decoder changed, so there is no fix to remove and re-test.