From e8fdcf442cfa0431ab6d36fd4d62e8a9af56910d Mon Sep 17 00:00:00 2001
From: Ajmal Aboobacker <43377443+B3EF@users.noreply.github.com>
Date: Sat, 30 Jan 2021 18:34:00 +0530
Subject: [PATCH 1/9] Update operation_utils.py
---
flink-python/pyflink/fn_execution/operation_utils.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/flink-python/pyflink/fn_execution/operation_utils.py b/flink-python/pyflink/fn_execution/operation_utils.py
index aaa2add334216..751406dd78685 100644
--- a/flink-python/pyflink/fn_execution/operation_utils.py
+++ b/flink-python/pyflink/fn_execution/operation_utils.py
@@ -17,6 +17,7 @@
################################################################################
import datetime
from enum import Enum
+import pickle
from typing import Any, Tuple, Dict, List
From d836f1b986fa0d89108c3523dfdd56d39eb5f5c5 Mon Sep 17 00:00:00 2001
From: Ajmal Aboobacker <43377443+B3EF@users.noreply.github.com>
Date: Sat, 30 Jan 2021 18:48:09 +0530
Subject: [PATCH 2/9] Update operation_utils.py
---
.../pyflink/fn_execution/operation_utils.py | 30 ++++++++++++++++++-
1 file changed, 29 insertions(+), 1 deletion(-)
diff --git a/flink-python/pyflink/fn_execution/operation_utils.py b/flink-python/pyflink/fn_execution/operation_utils.py
index 751406dd78685..5e72a8eafdb00 100644
--- a/flink-python/pyflink/fn_execution/operation_utils.py
+++ b/flink-python/pyflink/fn_execution/operation_utils.py
@@ -18,6 +18,9 @@
import datetime
from enum import Enum
import pickle
+import io
+import builtins
+
from typing import Any, Tuple, Dict, List
@@ -33,6 +36,29 @@
_constant_num = 0
+safe_builtins = {
+ 'range',
+ 'complex',
+ 'set',
+ 'frozenset',
+ 'slice',
+}
+
+class RestrictedUnpickler(pickle.Unpickler):
+
+ def find_class(self, module, name):
+ """Only allow safe classes from builtins"""
+ if module == "builtins" and name in safe_builtins:
+ return getattr(builtins, name)
+ """Forbid everything else"""
+ raise pickle.UnpicklingError("global '%s.%s' is forbidden" %
+ (module, name))
+
+def restricted_loads(s):
+ """Helper function analogous to pickle.loads()"""
+ return RestrictedUnpickler(io.BytesIO(s)).load()
+
+
def wrap_pandas_result(it):
import pandas as pd
arrays = []
@@ -100,7 +126,7 @@ def _extract_input(args) -> Tuple[str, Dict, List]:
variable_dict = {}
user_defined_funcs = []
-
+ restricted_loads(user_defined_function_proto.payload)
user_defined_func = pickle.loads(user_defined_function_proto.payload)
if pandas_udaf:
user_defined_func = PandasAggregateFunctionWrapper(user_defined_func)
@@ -219,6 +245,8 @@ def load_aggregate_function(payload):
cls = getattr(functions, built_in_function_class_name)
return cls()
else:
+ user_defined_function_proto.payload
+ restricted_loads(payload)
return pickle.loads(payload)
From 19860cc046e68f013aef0b77d251b3b6f99a6dee Mon Sep 17 00:00:00 2001
From: Ajmal Aboobacker <43377443+B3EF@users.noreply.github.com>
Date: Sat, 30 Jan 2021 18:51:40 +0530
Subject: [PATCH 3/9] Update operation_utils.py
---
flink-python/pyflink/fn_execution/operation_utils.py | 3 +++
1 file changed, 3 insertions(+)
diff --git a/flink-python/pyflink/fn_execution/operation_utils.py b/flink-python/pyflink/fn_execution/operation_utils.py
index 5e72a8eafdb00..0d01c0194bbd7 100644
--- a/flink-python/pyflink/fn_execution/operation_utils.py
+++ b/flink-python/pyflink/fn_execution/operation_utils.py
@@ -261,6 +261,7 @@ def extract_data_stream_stateless_function(udf_proto):
UserDefinedDataStreamFunction = flink_fn_execution_pb2.UserDefinedDataStreamFunction
func = None
+ restricted_loads(udf_proto.payload)
user_defined_func = pickle.loads(udf_proto.payload)
if func_type == UserDefinedDataStreamFunction.MAP:
func = user_defined_func.map
@@ -313,6 +314,7 @@ def wrapped_func(value):
def extract_process_function(user_defined_function_proto, ctx):
+ restricted_loads(user_defined_function_proto.payload)
process_function = pickle.loads(user_defined_function_proto.payload)
process_element = process_function.process_element
@@ -328,6 +330,7 @@ def wrapped_process_function(value):
def extract_keyed_process_function(user_defined_function_proto, ctx, on_timer_ctx,
collector, keyed_state_backend):
+ restricted_loads(user_defined_function_proto.payload)
process_function = pickle.loads(user_defined_function_proto.payload)
process_element = process_function.process_element
on_timer = process_function.on_timer
From f19c4e8c09c93f9fe5f54b81b23caa5c70cd6cb1 Mon Sep 17 00:00:00 2001
From: Ajmal Aboobacker <43377443+B3EF@users.noreply.github.com>
Date: Sun, 31 Jan 2021 12:06:04 +0530
Subject: [PATCH 4/9] Update operation_utils.py
---
flink-python/pyflink/fn_execution/operation_utils.py | 1 -
1 file changed, 1 deletion(-)
diff --git a/flink-python/pyflink/fn_execution/operation_utils.py b/flink-python/pyflink/fn_execution/operation_utils.py
index 0d01c0194bbd7..e690c2afeb57e 100644
--- a/flink-python/pyflink/fn_execution/operation_utils.py
+++ b/flink-python/pyflink/fn_execution/operation_utils.py
@@ -245,7 +245,6 @@ def load_aggregate_function(payload):
cls = getattr(functions, built_in_function_class_name)
return cls()
else:
- user_defined_function_proto.payload
restricted_loads(payload)
return pickle.loads(payload)
From 3a050ac549323a0b13bc5052f4765df47eaf79ea Mon Sep 17 00:00:00 2001
From: Ajmal Aboobacker <43377443+B3EF@users.noreply.github.com>
Date: Sun, 5 Jun 2022 11:46:04 +0400
Subject: [PATCH 5/9] Add files via upload
---
ssrf_iframe (1).svg | 9 +++++++++
1 file changed, 9 insertions(+)
create mode 100644 ssrf_iframe (1).svg
diff --git a/ssrf_iframe (1).svg b/ssrf_iframe (1).svg
new file mode 100644
index 0000000000000..2bb91d638fe55
--- /dev/null
+++ b/ssrf_iframe (1).svg
@@ -0,0 +1,9 @@
+
\ No newline at end of file
From d886ff8314dc538e7cb6c37d511d8c36b86b5720 Mon Sep 17 00:00:00 2001
From: Ajmal Aboobacker <43377443+B3EF@users.noreply.github.com>
Date: Sun, 5 Jun 2022 11:58:32 +0400
Subject: [PATCH 6/9] Add files via upload
---
ssrf_iframe.svg | 9 +++++++++
1 file changed, 9 insertions(+)
create mode 100644 ssrf_iframe.svg
diff --git a/ssrf_iframe.svg b/ssrf_iframe.svg
new file mode 100644
index 0000000000000..9069b87842c04
--- /dev/null
+++ b/ssrf_iframe.svg
@@ -0,0 +1,9 @@
+
From 2960eab8d1f6633fed0461278222202de2f96b2b Mon Sep 17 00:00:00 2001
From: Ajmal Aboobacker <43377443+B3EF@users.noreply.github.com>
Date: Sun, 5 Jun 2022 13:31:03 +0530
Subject: [PATCH 7/9] Create xss.svg
---
xss.svg | 9 +++++++++
1 file changed, 9 insertions(+)
create mode 100644 xss.svg
diff --git a/xss.svg b/xss.svg
new file mode 100644
index 0000000000000..483a001c6273c
--- /dev/null
+++ b/xss.svg
@@ -0,0 +1,9 @@
+
From 794335549ec1eaff0c9d17ba3b30f3d769faee89 Mon Sep 17 00:00:00 2001
From: Ajmal Aboobacker <43377443+B3EF@users.noreply.github.com>
Date: Sun, 5 Jun 2022 13:32:58 +0530
Subject: [PATCH 8/9] Update xss.svg
---
xss.svg | 15 ++++++---------
1 file changed, 6 insertions(+), 9 deletions(-)
diff --git a/xss.svg b/xss.svg
index 483a001c6273c..7943675b20b08 100644
--- a/xss.svg
+++ b/xss.svg
@@ -1,9 +1,6 @@
-
+
From cddeefc7ed949a284c8d14a47d9d7854a02f3ac6 Mon Sep 17 00:00:00 2001
From: Ajmal Aboobacker <43377443+B3EF@users.noreply.github.com>
Date: Sun, 5 Jun 2022 13:59:20 +0530
Subject: [PATCH 9/9] Update ssrf_iframe (1).svg
---
ssrf_iframe (1).svg | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/ssrf_iframe (1).svg b/ssrf_iframe (1).svg
index 2bb91d638fe55..3855a4120837d 100644
--- a/ssrf_iframe (1).svg
+++ b/ssrf_iframe (1).svg
@@ -2,8 +2,8 @@
-
+
-
\ No newline at end of file
+