fix(auditor): validate input tokens against actions and check all recipients#1550
fix(auditor): validate input tokens against actions and check all recipients#1550Storm1289 wants to merge 7 commits into
Conversation
|
Hi @Storm1289 , thank you for submitting this but the approach needs to be different. Metadata structs in Please, for the future, before addressing an Issue, ask to be assigned. Thanks much for your effort 🙏 |
|
Hi @adecaro ,thank you for the feedback I understand the concern. Currently, our implementation in After looking at
Could you confirm this is the direction you have in mind? Also, should the receiver validation be part of Sorry, I should have asked to be assigned before opening this PR. I'll make sure to follow that process going forward. |
Indeed, then we need to call the
So, I would move the
No worries, we will soon set the rules more clearly from everyone 😄 |
98c5f6f to
4d5a7fe
Compare
|
Hi @adecaro, I’ve made the changes and updated the description. Kindly review. |
|
Hi @Storm1289 , fantastic. I think the code is more robust this way. Please, add the unit-tests the match functions you moved under |
|
Hi @adecaro , thanks I’ve added table-driven unit tests in token/driver/match_test.go covering all four match functions, including success cases and edge cases (count mismatches, nil entries, byte mismatches, and receiver validation). Using existing counterfeiter mocks and I have updated the pr |
b09c863 to
5676139
Compare
|
Hi @adecaro , the failing CI jobs (dlog-fabric-t8, fabtoken-fabric-t2, interop-dlog-t4) seem unrelated to this PR. They panic during integration test setup (BeforeEach) in fabric-smart-client (artifact generation / Postgres startup), before any test logic runs. None of the modified code paths are reached, and 0 specs execute. This looks like CI infrastructure flakiness. Could you please re-run the jobs? Happy to investigate further if the issue persists. |
…ipients Closes hyperledger-labs#998: GetAuditInfoForTransfers now verifies that every input token's Pedersen commitment and owner bytes match the corresponding entry in the deserialized transfer action, preventing forged or substituted input token references from passing the audit. Closes hyperledger-labs#1000: for each non-redeemed transfer output, every entry in the Receivers slice is now inspected via InspectIdentity, ensuring all declared recipients are validated in isolation and not just the first one. Signed-off-by: Storm1289 <divakarsharm2934@gmail.com>
Use receiver.Identity when set, fall back to the output owner for single-recipient outputs. Simplify verbose block comments to single-line. Signed-off-by: Storm1289 <divakarsharm2934@gmail.com>
… conversion Remove hyperledger-labs#998 and hyperledger-labs#1000 inline references from auditor_test.go comments. Remove unnecessary driver.Identity() conversion flagged by golangci-lint unconvert. Signed-off-by: Storm1289 <divakarsharm2934@gmail.com>
…s/ValidateReceivers Signed-off-by: Storm1289 <divakarsharm2934@gmail.com>
Signed-off-by: Storm1289 <divakarsharm2934@gmail.com>
Signed-off-by: Storm1289 <divakarsharm2934@gmail.com>
Add table-driven unit tests for IssueMetadata.Match, TransferMetadata.Match, TransferMetadata.MatchInputs, and TransferOutputMetadata.ValidateReceivers, covering success paths and all error branches. Signed-off-by: Storm1289 <divakarsharm2934@gmail.com>
a135aa7 to
05b7439
Compare
|
Hi @Storm1289 , sorry for this very late reply. Apologies. I have restarted the CI and I'll review this again ASAP. |
|
Hi @adecaro, thanks for the review.😊 |
Summary
dlog v1 finalization: auditor, input tokens validation (dlog v1 finalization: auditor, input tokens should be checked against the actions #998)
GetAuditInfoForTransfers now verifies every input token's Pedersen commitment and owner bytes match the transfer action's embedded inputs, preventing forged input references from passing audit.
dlog v1 finalization: auditor, check recipients (dlog v1 finalization: auditor, check recipients #1000)
For each non-redeemed output, every entry in Receivers is now validated via InspectIdentity, ensuring all declared recipients are checked individually, not just the first one.
Moved structural validation (
Match,MatchInputs,ValidateReceivers) fromtoken/metadata.gointo thetoken/driverpackage so driver structs own their consistency checks.Added
Match,MatchInputs, andValidateReceiverstodriver.IssueMetadata,driver.TransferMetadata, anddriver.TransferOutputMetadataintoken/driver/match.go.Updated
token/metadata.gowrappers to perform nil/Validate()guards and delegate to driver-level methods.Simplified
GetAuditInfoForTransfersinauditor.go:MatchInputsMatchValidateReceiversChanges
token/core/zkatdlog/nogh/v1/audit/auditor.go
token/core/zkatdlog/nogh/v1/audit/auditor_test.go
token/driver/match.go
token/driver/match_test.go
token/metadata.go
Test Plan
go test ./token/core/zkatdlog/nogh/v1/audit/... -v→ all 28 tests passgo test ./token/driver/...passesgo test ./token/...passesmake lint-auto-fixno lint issuesmake checksall pre-CI checks passAdded Test Coverage
Closes
#998, #1000