You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(storage): enforce API payload size limits and query result caps (#1630)
Add upper bounds at the SQL transaction-store chokepoint so a single
oversized write or unbounded scan cannot monopolise DB resources:
- Write cap: AddTokenRequest/AddTransaction/AddMovement reject payloads
over a max size (DefaultMaxPayloadSize 4 MiB; 0 disables).
- Read caps: QueryTransactions requires bounded pagination (rejects
nil/None); QueryTokenRequests is hard-LIMITed to the max page size
(DefaultMaxPageSize 1000). QueryMovements is intentionally excluded.
- Limits default via consts and are overridable from config
(token.storage.maxPayloadSize / maxPageSize) or WithMax* options.
- Migrate unbounded callers (checks.go, history views) to page loops.
Signed-off-by: AkramBitar <akram@il.ibm.com>
Copy file name to clipboardExpand all lines: docs/services/storage.md
+7Lines changed: 7 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -314,3 +314,10 @@ The cleanup service supports both PostgreSQL and SQLite backends, with different
314
314
Cleanup behavior is controlled by the configuration section. See the [Configuration Guide](../configuration.md) for detailed parameter descriptions and tuning recommendations.
315
315
316
316
See the [Configuration Guide](../configuration.md), Section `Optional: token.tms.<name>.services.network.fabric.recovery`, for detailed parameter descriptions and tuning recommendations.
317
+
318
+
## Transaction Store API Bounds
319
+
320
+
The transaction store enforces upper bounds on its write and read paths (maximum
321
+
serialised write payload, mandatory bounded pagination on transaction queries,
322
+
and a hard cap on token-request queries) so a single oversized write or unbounded
323
+
scan cannot monopolise database resources. See [**Transaction Store API Bounds**](storage/api-bounds.md).
errorMessages=append(errorMessages, fmt.Sprintf("transaction record [%s] is valid for vault but not for the ledger [%d]", transactionRecord.TxID, lVC))
errorMessages=append(errorMessages, fmt.Sprintf("failed to get ledger transaction status for [%s]: [%s]", transactionRecord.TxID, err))
166
+
}
167
+
errorMessages=append(errorMessages, fmt.Sprintf("transaction record [%s] is valid for vault but not for the ledger [%d]", transactionRecord.TxID, lVC))
errorMessages=append(errorMessages, fmt.Sprintf("failed to get ledger transaction status for [%s]: [%s]", transactionRecord.TxID, err))
172
+
}
173
+
errorMessages=append(errorMessages, fmt.Sprintf("transaction record [%s] is invalid for vault but not for the ledger [%d]", transactionRecord.TxID, lVC))
errorMessages=append(errorMessages, fmt.Sprintf("transaction record [%s] is unknown for vault but not for the ledger [%d]", transactionRecord.TxID, lVC))
errorMessages=append(errorMessages, fmt.Sprintf("transaction record [%s] is busy for vault but not for the ledger [%d]", transactionRecord.TxID, lVC))
155
181
}
156
-
errorMessages=append(errorMessages, fmt.Sprintf("transaction record [%s] is invalid for vault but not for the ledger [%d]", transactionRecord.TxID, lVC))
errorMessages=append(errorMessages, fmt.Sprintf("transaction record [%s] is unknown for vault but not for the ledger [%d]", transactionRecord.TxID, lVC))
0 commit comments