[pr-fix] policy: a payload wrapped at the encoder's line width is caught #376
Loading…
Reference in a new issue
No description provided.
Delete branch "qnjk/Darner:policy-wrapped-payload"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Contributor role (optional)
What it changes
The problem on main:
longest_encoded_runsplit the content at every byte outside the base64 alphabet and compared the longest fragment withMAX_ENCODED_RUN(512):(
xtask/src/policy.rs:213-215). A line break is not payload, so a payload that an encoder wrapped has no fragment longer than one line: GNUbase64and Python'sbase64.encodebyteswrap at 76 columns andopenssl base64at 64, all far under 512. Any wrapped dump written into a file type the policy allows (txt,md,jsonare on the list) passed. Reproduced with 4096 synthetic bytes ((i*37+11) % 256) as base64: 5464 characters unbroken is refused (5464-character hex/base64 run), the same characters wrapped at 76 columns returned no problem. This check is the static enforcement of the repository's first rule — nothing from the game is ever committed — so a way around it matters more than its size suggests.This change joins a group of lines back into one run when every line of the group is wholly payload and at least as wide as an encoder's line (
WRAPPED_LINE, 24). A wrapped payload is therefore one run again, while wrapped prose (words, spaces) and single-character lines still end the runs they are in. Nothing else in the policy changes.How it was tested
Tested revision:
5b778e0(one commit onf3840d7).Commands and results:
cargo test --locked -p xtask— 9 passed, 0 failed.cargo xtask policyover this tree —asset policy: 555 files ok, so the new rule does not trip anything the repository actually tracks (repository_passes_policyis the unit test for that and still passes).policy::tests::rejects_data_smuggled_across_line_breakswas run against the same tree with only the old function body restored: it fails there with4096 characters of base64 wrapped at 76 columns passed, and passes with the change. The same test asserts that wrapped prose is still accepted and that the unbroken payload is still refused, so it pins the rule and not just the new code.cargo clippy --locked -p xtask --all-targets -- -D warningspasses.Changes a default: no. The repository is policy-clean both before and after; what changes is that a wrapped payload is now refused.
A/B result, for a change of a default (on for everyone) or a speed claim: not applicable — no default changes and no speed claim.
Gates run on that revision:
cargo clippy --workspace --all-targets --locked -- -D warnings: passes.cargo clippy --workspace --all-targets --all-features --locked -- -D warnings: passes.cargo test --workspace --locked: not green on this machine, and not because of this change. Three pre-existing failures, each covered by an open pull request:darner-gpustands still in parallel on the test deadlock #224 describes, and serially it finishes 1772 passed and 1 failed (pipeline::make::tests::a_capped_draw_waits_once_then_drops, which passes on its own) beside the order-dependentwatch::tests::ask_once_by_res_splits_reservations_without_refusalsandtexture::ahead::tests::drain_waits_until_then_callbacks_have_runflakes that #150 is about;darner-shaderfailsemit::waterfall_tests::sampled_marks_restore_early_depth_only_when_safe_in_pixel_shaders, whose fixture #227 fixes. Every other crate passes. This change touches no file of either crate.Gameplay, when relevant: not applicable — this is the pre-commit policy checker, it never runs while the title runs.
Shader wave sizes tested, when relevant: not applicable.
Hardware dependence: none.
Coverage gaps:
xxd/hexdump-shaped dumps (an offset column plus 4-digit groups) are still not caught by the encoded-run check; that is a different shape from a wrapped payload and it is not part of this change. The longest legal base64-ish fixture in the tree is unchanged.Checklist
cargo xtask policy), which never runs while the title runs. It was run over the whole tree instead: 555 files ok.main.docs/asset-policy.md. (cargo xtask policy: 555 files ok.)Checked for overlap
xtask/(checked against the file list of all 161 open pull requests), and no open or closed issue or pull request body mentionslongest_encoded_run,MAX_ENCODED_RUNor a wrapped payload.View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.