Repository navigation
fix(fabric): resolve a txID shadowed by a forged envelope in ledger lookups - #2523
Conversation
|
Hey @mbrandenburger 👋 thanks for the PR! This comment updates automatically as you push changes -- think of it as your PR's live scoreboard! PR Checks✅ DCO Sign-off -- All commits have valid sign-offs. Nice work! ❌ GPG Signature -- Heads up! The following commits don't have a verified GPG signature:
You'll need to sign your commits with GPG (e.g. ✅ Merge Conflicts -- No merge conflicts detected. Smooth sailing! ✅ Issue Link -- Linked to #2522 (assigned to you). ⏳ All checks must pass before this PR can be reviewed. You've got this! |
|
CC @Effi-S |
|
This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again. |
…ookups A block can carry an invalid envelope forged with the txID of an honest one that follows it, and the honest envelope still validates. qscc's GetTransactionByID returns the first envelope Fabric indexed for a txID, which is the forgery, so Ledger.GetTransactionByID reported BAD_PROPOSAL_TXID, or UNSUPPORTED_TX_PAYLOAD for a MESSAGE forgery, for a transaction that committed Valid. Panurus recovery then deleted the transaction from the token store. When the lookup returns an invalid envelope, GetTransactionByID fetches its block with GetBlockByTxID and returns the valid endorser transaction with the same txID if the block has one, the rule of committer.ShadowedEnvelopes. Only that block can hold the honest envelope, because Fabric flags a later one DUPLICATE_TXID. - Both queries go to the same peer. PickPeer picks at random, and another peer may not have the block yet. - The twin is looked for before a non-endorser forgery's parse error is returned; without a twin that error is returned as before. - A block that cannot be fetched or parsed is an error, not the invalid verdict, so callers retry instead of acting on a forgery. - A valid lookup is unchanged and issues no block query. The ShadowedEnvelopes Godoc and the security model list ledger lookups among the paths that apply the rule. Fixes hyperledger-labs#2522 Signed-off-by: Marcus Brandenburger <bur@zurich.ibm.com>
75483fd to
3519dcf
Compare
|
👋 Hi @mbrandenburger! Great work on your recent contribution! 🎉 Here are some issues you might want to explore next: Happy coding! 🚀 |
Fixes #2522.
A block can carry an invalid envelope forged with the txID of an honest one that follows it, and the honest envelope still validates (#2482, #2487). qscc's
GetTransactionByIDreturns the first envelope Fabric indexed for a txID:blockIndex.getTxIDValtakes the lowest(blkNum, txNum)key, andkvLedger.GetTransactionByIDreads both the envelope and its flag from that entry. SoLedger.GetTransactionByIDreturned the forgery, flaggedBAD_PROPOSAL_TXIDor, for aMESSAGEforgery,UNSUPPORTED_TX_PAYLOAD, for a transaction that committed Valid. In Panurus, recovery then deletes the transaction from the token store (LFDT-Panurus/panurus#2647).Changes:
GetTransactionByIDfetches its block withGetBlockByTxIDand returns the valid endorser transaction with the same txID if the block has one, the rule ofcommitter.ShadowedEnvelopes. Only that block can hold the honest envelope, because Fabric flags a later oneDUPLICATE_TXID.PickPeerpicks at random, and another peer may not have committed the block yet.NewProcessedTransactionrejects a non-endorser envelope, so the twin is looked for before that error is returned. Without a twin, the error is returned as before.ShadowedEnvelopesGodoc andsecurity-model.mdlist ledger lookups among the paths that apply the rule. The rule is documented on the Fabric implementation, not ondriver.Ledger, which Fabric-x also implements.Tests:
TestGetTransactionByIDShadowedcovers a forged endorser orMESSAGEenvelope ahead of the honest one, an unparsable envelope before the twin, no twin, an invalid twin, a valid config twin, a twin past the validation flags, no flags, aMESSAGEforgery without a twin, a failed or unparsable block, and a valid lookup. Each case checks the number of block queries, and that both queries go to one peer.Not breaking: no signature changes. Once this is in an FSC release, Panurus needs only the FSC bump; LFDT-Panurus/panurus#2653 can shrink to its regression tests.
make checksis clean and theplatform/fabric/...unit tests pass with-race.