@@ -48,6 +48,8 @@ def __line__():
48
48
XSIAM_EVENT_CHUNK_SIZE = 2 ** 20 # 1 Mib
49
49
XSIAM_EVENT_CHUNK_SIZE_LIMIT = 9 * (10 ** 6 ) # 9 MB, note that the allowed max size for 1 entry is 5MB.
50
50
# So if you're using a "heavy" API it is recommended to use maximum of 4MB chunk size.
51
+ MAX_ALLOWED_ENTRY_SIZE = 5 * (10 ** 6 ) # 5 MB, this is the maximum allowed size of a single entry.
52
+ # So if you're using a "heavy" API it is recommended to use maximum of 9MB chunk size.
51
53
ASSETS = "assets"
52
54
EVENTS = "events"
53
55
DATA_TYPES = [EVENTS , ASSETS ]
@@ -60,25 +62,6 @@ def __line__():
60
62
61
63
62
64
def register_module_line (module_name , start_end , line , wrapper = 0 ):
63
- """
64
- Register a module in the line mapping for the traceback line correction algorithm.
65
-
66
- :type module_name: ``str``
67
- :param module_name: The name of the module. (required)
68
-
69
- :type start_end: ``str``
70
- :param start_end: Whether to register the line as the start or the end of the module.
71
- Possible values: start, end. (required)
72
-
73
- :type line: ``int``
74
- :param line: the line number to record. (required)
75
-
76
- :type wrapper: ``int``
77
- :param wrapper: Wrapper size (used for inline replacements with headers such as ApiModules). (optional)
78
-
79
- :return: None
80
- :rtype: ``None``
81
- """
82
65
global _MODULES_LINE_MAPPING
83
66
default_module_info = {'start' : 0 , 'start_wrapper' : 0 , 'end' : float ('inf' ), 'end_wrapper' : float ('inf' )}
84
67
try :
@@ -98,15 +81,6 @@ def register_module_line(module_name, start_end, line, wrapper=0):
98
81
99
82
100
83
def _find_relevant_module (line ):
101
- """
102
- Find which module contains the given line number.
103
-
104
- :type line: ``int``
105
- :param trace_str: Line number to search. (required)
106
-
107
- :return: The name of the module.
108
- :rtype: ``str``
109
- """
110
84
global _MODULES_LINE_MAPPING
111
85
112
86
relevant_module = ''
@@ -121,15 +95,6 @@ def _find_relevant_module(line):
121
95
122
96
123
97
def fix_traceback_line_numbers (trace_str ):
124
- """
125
- Fixes the given traceback line numbers.
126
-
127
- :type trace_str: ``str``
128
- :param trace_str: The traceback string to edit. (required)
129
-
130
- :return: The new formated traceback.
131
- :rtype: ``str``
132
- """
133
98
134
99
def is_adjusted_block (start , end , adjusted_lines ):
135
100
return any (
@@ -8718,11 +8683,11 @@ def is_xsiam():
8718
8683
8719
8684
def is_using_engine ():
8720
8685
"""Determines whether or not the platform is using engine.
8721
- NOTE:
8686
+ NOTE:
8722
8687
- This method works only for system integrations (not custom).
8723
8688
- On xsoar 8, this method works only for integrations that runs on the xsoar pod - not on the engine-0 (mainly long running
8724
8689
integrations) such as: EDL, Cortex Core - IOC, Cortex Core - IR, ExportIndicators, Generic Webhook, PingCastle,
8725
- Publish List, Simple API Proxy, Syslog v2, TAXII Server, TAXII2 Server, Web File Repository, Workday_IAM_Event_Generator,
8690
+ Publish List, Simple API Proxy, Syslog v2, TAXII Server, TAXII2 Server, Web File Repository, Workday_IAM_Event_Generator,
8726
8691
XSOAR-Web-Server, Microsoft Teams, AWS-SNS-Listener.
8727
8692
8728
8693
:return: True iff the platform is using engine.
@@ -8766,7 +8731,7 @@ def is_integration_instance_running_on_engine():
8766
8731
8767
8732
8768
8733
def get_engine_base_url (engine_id ):
8769
- """Gets the xsoar engine id and returns it's base url.
8734
+ """Gets the xsoar engine id and returns it's base url.
8770
8735
For example: for engine_id = '4ccccccc-5aaa-4000-b666-dummy_id', base url = '11.180.111.111:1443'.
8771
8736
8772
8737
:type engine_id: ``str``
@@ -8821,7 +8786,7 @@ def emit(self, record):
8821
8786
8822
8787
def censor_request_logs (request_log ):
8823
8788
"""
8824
- Censors the request logs generated from the urllib library directly by replacing sensitive information such as tokens and cookies with a mask.
8789
+ Censors the request logs generated from the urllib library directly by replacing sensitive information such as tokens and cookies with a mask.
8825
8790
In most cases, the sensitive value is the first word after the keyword, but in some cases, it is the second one.
8826
8791
:param request_log: The request log to censor
8827
8792
:type request_log: ``str``
@@ -12059,8 +12024,14 @@ def split_data_to_chunks(data, target_chunk_size):
12059
12024
yield chunk
12060
12025
chunk = []
12061
12026
chunk_size = 0
12027
+ data_part_size = sys .getsizeof (data_part )
12028
+ if data_part_size >= MAX_ALLOWED_ENTRY_SIZE :
12029
+ demisto .error (
12030
+ "entry size {} is larger than the maximum allowed entry size {}, skipping this entry" .format (data_part_size ,
12031
+ MAX_ALLOWED_ENTRY_SIZE ))
12032
+ continue
12062
12033
chunk .append (data_part )
12063
- chunk_size += sys . getsizeof ( data_part )
12034
+ chunk_size += data_part_size
12064
12035
if chunk_size != 0 :
12065
12036
demisto .debug ("sending the remaining chunk with size: {size}" .format (size = chunk_size ))
12066
12037
yield chunk
0 commit comments