[bisq-network/bisq] Add irregular txType, add check for total balance, prevent proposal withhold attack (#2587)

sqrrm notifications at github.com
Sun Mar 31 22:10:56 UTC 2019


sqrrm approved this pull request.

utACK

> + * Validator for extraDataMap fields used in network payloads.
+ * Ensures that we don't get the network attacked by huge data inserted there.
+ */
+ at Slf4j
+public class ExtraDataMapValidator {
+    // ExtraDataMap is only used for exceptional cases to not break backward compatibility.
+    // We don't expect many entries there.
+    public final static int MAX_SIZE = 10;
+    public final static int MAX_KEY_LENGTH = 100;
+    public final static int MAX_VALUE_LENGTH = 100000; // 100 kb
+
+    public static Map<String, String> getValidatedExtraDataMap(@Nullable Map<String, String> extraDataMap) {
+        return getValidatedExtraDataMap(extraDataMap, MAX_SIZE, MAX_KEY_LENGTH, MAX_VALUE_LENGTH);
+    }
+
+    public static Map<String, String> getValidatedExtraDataMap(@Nullable Map<String, String> extraDataMap, int maxSize, int maxKeyLength, int maxValueLength) {

Please try to break these long lines, it's harder to read when they're too long.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/bisq-network/bisq/pull/2587#pullrequestreview-220886087
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20190331/4d27fb36/attachment.html>


More information about the bisq-github mailing list