Repository navigation
Conversation
The v1 Wire struct accepted envelopes with extra keys while the wallets, the SDK, and the NEAR envelope in the same file all refuse them. Add #[serde(deny_unknown_fields)] to match, plus a regression test mirroring the NEAR extra-key test.
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.
Bug
The v1 signing-request envelope (
Wireinsrc/qr/sign_request.rs) accepts envelopes carrying extra keys, while every other reader of this wire format refuses them:v,signer,payload).SigningRequest.decode(quantus-apps,quantus_sdk/lib/src/models/signing_request.dart) enforces exactly that key set for v1 via its exact-keys check.deny_unknown_fields, and has a test that refuses an addedsignerkey.The v1 struct was missed, so it has neither the attribute nor a test. This is not just a formatting nit: the cold-signing flow (
src/cli/cold_signing.rs) decodes a scanned request withAnySignRequest::decodeand signs the payload after checking the signer. A v1 request with extra keys — for example a smuggledchainfield — is signed by this CLI but refused by the mobile app, the cold wallet app, and the Keystone firmware. The readers of a security envelope should agree on what they accept.Fix
Add
#[serde(deny_unknown_fields)]to the v1Wirestruct — one line, matching the NEAR envelope — plus a regression test (refuses_extra_keys_like_the_wallets_do) that mirrors the existing NEAR extra-key test: a v1 envelope with an addedchainkey must fail bothSignRequest::decodeandAnySignRequest::decode.Verification
SKIP_CIRCUIT_BUILD=1 cargo test --lib qr::sign_request— 11 passed / 1 failed without the fix (the new test: the extra-key envelope decoded successfully), 12/12 passed with it. (SKIP_CIRCUIT_BUILDis build.rs's documented flag for jobs that don't need the generated circuit binaries.)cargo test --lib: 422 passed; the only 2 failures (batch-verifier loading, one keystore migration test) fail identically on the unpatched tree in this environment and are unrelated to this change.@Quantus-Network — flagging for the team.
Built by @Kshot9000 (https://x.com/kshot9000) · QTC donations: qznY8nwuvWcCCVys4da1oQdysyh8YUZYRjRqgk3S8Wos8kbau