Clear V1 payload from memory after first read#1335
Clear V1 payload from memory after first read#1335spacebear21 merged 1 commit intopayjoin:masterfrom
Conversation
Pull Request Test Coverage Report for Build 22158884747Details
💛 - Coveralls |
e0a5a73 to
79f9d49
Compare
V1 payjoin requests carry plaintext PSBTs that should not linger in memory longer than necessary. Wrap the V1 payload in Option and take() it on first read so subsequent reads see AlreadyRead instead of the raw transaction data.
2d47e24 to
3504496
Compare
spacebear21
left a comment
There was a problem hiding this comment.
ACK 3504496
I got confused during review (see comment below) but this all seems well-reasoned.
what in the world was the AI running?? there are only 8 total tests in payjoin-directory |
|
I missed this when it got merged
|
|
The plan is to remove BIP 78 support as soon as the v2 BTCPayServer plugin is in production and we're confident the V1 receivers can be thought of as only a legacy solution with a reliable replacement. |
that seems to imply the consequences for reliability of this PR were not intended: v2 receiver starts a mailbox GET, v1 sender posts, directory sends response and deletes the payload, but the connection from the client to the relay is dropped and the response is lost, requiring the sender to time out and try again |
Summary
payloadinOption<Arc<Vec<u8>>>so it can be.take()n after the first read, clearing plaintext PSBT data from memoryAlreadyReaderror variant to distinguish consumed payloads from capacity conflictstest_v1_data_minimizationunit test verifying second read returnsAlreadyReadTest plan
cargo test -p payjoin-directory --features v1 --libpasses (14 tests)