apify 2.6.1b7__py3-none-any.whl → 2.6.1b9__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of apify might be problematic. Click here for more details.
- apify/_consts.py +5 -2
- apify/_crypto.py +11 -4
- {apify-2.6.1b7.dist-info → apify-2.6.1b9.dist-info}/METADATA +1 -1
- {apify-2.6.1b7.dist-info → apify-2.6.1b9.dist-info}/RECORD +6 -6
- {apify-2.6.1b7.dist-info → apify-2.6.1b9.dist-info}/WHEEL +0 -0
- {apify-2.6.1b7.dist-info → apify-2.6.1b9.dist-info}/licenses/LICENSE +0 -0
apify/_consts.py
CHANGED
|
@@ -6,5 +6,8 @@ from datetime import timedelta
|
|
|
6
6
|
EVENT_LISTENERS_TIMEOUT = timedelta(seconds=5)
|
|
7
7
|
|
|
8
8
|
BASE64_REGEXP = '[-A-Za-z0-9+/]*={0,3}'
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
ENCRYPTED_STRING_VALUE_PREFIX = 'ENCRYPTED_VALUE'
|
|
10
|
+
ENCRYPTED_JSON_VALUE_PREFIX = 'ENCRYPTED_JSON'
|
|
11
|
+
ENCRYPTED_INPUT_VALUE_REGEXP = re.compile(
|
|
12
|
+
f'^({ENCRYPTED_STRING_VALUE_PREFIX}|{ENCRYPTED_JSON_VALUE_PREFIX}):(?:({BASE64_REGEXP}):)?({BASE64_REGEXP}):({BASE64_REGEXP})$'
|
|
13
|
+
)
|
apify/_crypto.py
CHANGED
|
@@ -3,6 +3,7 @@ from __future__ import annotations
|
|
|
3
3
|
import base64
|
|
4
4
|
import hashlib
|
|
5
5
|
import hmac
|
|
6
|
+
import json
|
|
6
7
|
import string
|
|
7
8
|
from typing import Any
|
|
8
9
|
|
|
@@ -14,7 +15,7 @@ from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
|
|
|
14
15
|
from apify_shared.utils import ignore_docs
|
|
15
16
|
from crawlee._utils.crypto import crypto_random_object_id
|
|
16
17
|
|
|
17
|
-
from apify._consts import ENCRYPTED_INPUT_VALUE_REGEXP
|
|
18
|
+
from apify._consts import ENCRYPTED_INPUT_VALUE_REGEXP, ENCRYPTED_JSON_VALUE_PREFIX, ENCRYPTED_STRING_VALUE_PREFIX
|
|
18
19
|
|
|
19
20
|
ENCRYPTION_KEY_LENGTH = 32
|
|
20
21
|
ENCRYPTION_IV_LENGTH = 16
|
|
@@ -147,14 +148,20 @@ def decrypt_input_secrets(private_key: rsa.RSAPrivateKey, input_data: Any) -> An
|
|
|
147
148
|
if isinstance(value, str):
|
|
148
149
|
match = ENCRYPTED_INPUT_VALUE_REGEXP.fullmatch(value)
|
|
149
150
|
if match:
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
151
|
+
prefix = match.group(1)
|
|
152
|
+
encrypted_password = match.group(3)
|
|
153
|
+
encrypted_value = match.group(4)
|
|
154
|
+
decrypted_value = private_decrypt(
|
|
153
155
|
encrypted_password,
|
|
154
156
|
encrypted_value,
|
|
155
157
|
private_key=private_key,
|
|
156
158
|
)
|
|
157
159
|
|
|
160
|
+
if prefix == ENCRYPTED_STRING_VALUE_PREFIX:
|
|
161
|
+
input_data[key] = decrypted_value
|
|
162
|
+
elif prefix == ENCRYPTED_JSON_VALUE_PREFIX:
|
|
163
|
+
input_data[key] = json.loads(decrypted_value)
|
|
164
|
+
|
|
158
165
|
return input_data
|
|
159
166
|
|
|
160
167
|
|
|
@@ -2,8 +2,8 @@ apify/__init__.py,sha256=HpgKg2FZWJuSPfDygzJ62psylhw4NN4tKFnoYUIhcd4,838
|
|
|
2
2
|
apify/_actor.py,sha256=KB8dwoFzTMdEBDcjcHDeEuYH6EXYspqni4Pp-CvHV_o,51913
|
|
3
3
|
apify/_charging.py,sha256=QysDbvJS25ZVefRTXMyqrSvK5yAh729T-mDOraHBac8,12198
|
|
4
4
|
apify/_configuration.py,sha256=AVztnlaBkHxBs0VkLIUhFHWwvlgHY-koMNUc0aqw9ZI,11908
|
|
5
|
-
apify/_consts.py,sha256=
|
|
6
|
-
apify/_crypto.py,sha256=
|
|
5
|
+
apify/_consts.py,sha256=CjhyEJ4Mi0lcIrzfqz8dN7nPJWGjCeBrrXQy1PZ6zRI,440
|
|
6
|
+
apify/_crypto.py,sha256=UICTbzjhIKV74biisdtr3kx4c9AO-cKGJnP-XlSTe4E,6960
|
|
7
7
|
apify/_models.py,sha256=q2P7q95QOOzjnm3yQV8c1FyLUCtmUQkQXwnnvQK1s9A,7908
|
|
8
8
|
apify/_platform_event_manager.py,sha256=fuI7C-TR8PcHA0yQO7mCoMQWIpr7zmLHA038quSv0Qk,7869
|
|
9
9
|
apify/_proxy_configuration.py,sha256=eMeYr9mr2ITURBmgZw4Cel9kfkiLhdaxE47EDh-3okM,13091
|
|
@@ -38,7 +38,7 @@ apify/scrapy/pipelines/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSu
|
|
|
38
38
|
apify/storages/__init__.py,sha256=FW-z6ubuPnHGM-Wp15T8mR5q6lnpDGrCW-IkgZd5L30,177
|
|
39
39
|
apify/storages/_request_list.py,sha256=vTcd6eU6c_9XRf6NrQFz41ndXPXO5KEKf9Hn9DjwaMk,6039
|
|
40
40
|
apify/storages/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
41
|
-
apify-2.6.
|
|
42
|
-
apify-2.6.
|
|
43
|
-
apify-2.6.
|
|
44
|
-
apify-2.6.
|
|
41
|
+
apify-2.6.1b9.dist-info/METADATA,sha256=xdAlec4MS5WGX1RLTGyd_RYkweE9oIjz_B1dmR72ZLA,21724
|
|
42
|
+
apify-2.6.1b9.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
43
|
+
apify-2.6.1b9.dist-info/licenses/LICENSE,sha256=AsFjHssKjj4LGd2ZCqXn6FBzMqcWdjQre1byPPSypVw,11355
|
|
44
|
+
apify-2.6.1b9.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|