Data corruption is the unintended alteration or loss of data, causing it to differ from its correct contents. In a refund workflow, processing a corrupted refunds.json file could send the wrong amount to the wrong credit card. section 4.2
A cryptographic hash detects accidental corruption by producing repeatable output for the same input. The producer stores a file and its hash; the consumer recomputes the hash and compares both values before processing the file. section 4.2.2
Use this validation sequence:
- Compute the SHA-256 hash of refunds.json. section 4.2.2
- Compare the computed value with refunds.json.sha256. section 4.2.2
- Process the file only when the values match; otherwise raise an error and issue no refunds. section 4.2.2
Refund upload
A Java payment endpoint receives the file and a hash header, rejects a missing or mismatched hash, and parses the refunds only after validation. Changing refunds.json without recalculating its hash triggers an exception. section 4.4
Figure 4.2 ACME staff members approve refunds using the warehouse management application. Once a day, the application generates a refunds.json file. The payment service refunds customer credit cards for the amount specified in that file.
Trace the warehouse application’s refunds.json handoff to the payment service and identify where integrity validation belongs. section 4.2


