-
Notifications
You must be signed in to change notification settings - Fork 12
feat(crypto): decrypt secret objects #482
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Adds backward-compatible decryption of both legacy encrypted strings and new JSON‐based encrypted values (including objects and arrays).
- Extends regex and decryption logic to inspect a prefix and decode JSON when needed
- Introduces separate
ENCRYPTED_STRING_VALUE_PREFIX
andENCRYPTED_JSON_VALUE_PREFIX
constants - Updates tests to cover legacy string, JSON string, object, and array decryption
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
tests/unit/actor/test_actor_key_value_store.py | Tests expanded for legacy string and JSON (string, object, array) decryption |
src/apify/_crypto.py | decrypt_input_secrets now distinguishes prefixes and does json.loads for JSON |
src/apify/_consts.py | New constants for string vs JSON prefixes and updated regex to capture both formats |
Comments suppressed due to low confidence (1)
tests/unit/actor/test_actor_key_value_store.py:87
- The helper function
json_dumps
is not defined in this scope. Usejson.dumps(secret_string)
instead to serialize the value.
encrypted_string = public_encrypt(json_dumps(secret_string), public_key=PUBLIC_KEY)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Add support for
isSecret
objects and arrays in input schema and the new form of encrypted value:More context here apify/apify-shared-js#515