-
Notifications
You must be signed in to change notification settings - Fork 60
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
[SFT-671] - Support ability to encrypt/decrypt submission data #882
Conversation
72f8b0f
to
56bc358
Compare
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.
When I try viewing the submission data inside the CP, front end and "Updating Search Indexes" in Craft Queue, I get an error:
base64_decode(): Argument #1 ($string) must be of type string, array given
When attempting to submit a multipage form (not sure if it's the fact that it's multipage or something else), the form fails at the final submit and has this error:
Exception 'TypeError' with message 'openssl_encrypt(): Argument #1 ($data) must be of type string, array given'
in /YOINK/freeform5.c4/vendor/yiisoft/yii2/base/Security.php:218
On a single page form it appeared to work ok for submit.
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.
Adding some commentary.
packages/plugin/src/Bundles/Fields/Types/FieldTypesProvider.php
Outdated
Show resolved
Hide resolved
I think we need to spend some time refactoring how exports work. Multiple export routes with multiple options. |
I cannot replicate these issues in latest changes. Can you please test again. |
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.
Array type fields seem to have issues with this feature. Affected fields are:
- Checkboxes
- Multiple Select
- File Upload
- File Upload Drag & Drop
- When the form contains ANY fields that contain an array of options, when submitting the form (and that field has data), the form submit fails with an error:
Exception 'TypeError' with message 'openssl_encrypt(): Argument #1 ($data) must be of type string, array given' in /PATH/vendor/yiisoft/yii2/base/Security.php:218
- When the form contains ANY fields that contain an array of field data, it errors when loading the submission, even if it is NOT set to be encrypted.
TypeError base64_decode(): Argument #1 ($string) must be of type string, array given
…d new field type for control and for better management
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.
Much closer to working correctly now. However... 😅
- Exporting via Quick Export and Export Profiles does not correctly decrypt the array fields (Checkboxes, Multiple Select, File Upload, File Upload Drag & Drop.
Seems good now. We should just wait on @gustavs-gutmanis's review when he gets back. 🙂 |
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.
A couple more issues I found with editions:
- Encryption is only supposed to be available for Pro, but appears on Lite as well (correctly hidden on Express).
- Decryption should happen regardless of edition. For example, if I was using Pro and encrypted some data and then later on downgraded to Lite (or Express) edition, I should still be able to access/view the decrypted submission data. Currently, it shows old data as encrypted still.
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.
Latest Changes:
- Encryption still shows for
Lite
when it should only appear for Pro (correctly hidden on Express).
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.
Looking real nice now,
Just a couple of more questions before the approval.
I guess it's better to have this attribute than to get rid of the inheritance.
…--
Gustavs Gutmanis
On 6 November 2023 at 21:03:29, Sean Delaney ***@***.*** ***@***.***)) wrote:
@seandelaney commented on this pull request.
In packages/plugin/src/Fields/Implementations/Pro/PasswordField.php (#882 (comment)):
> @@ -26,6 +27,9 @@ )] class PasswordField extends TextField implements NoStorageInterface, ExtraFieldInterface, RememberPostedValueInterface { + #[Input\Hidden]
TBH, I'm not 100% happy with this as a solution. Setting encrypted to false alone doesn't hide it. Unless you know why, a dev would be very confused. What do you think about making Password not extend Text?
—
Reply to this email directly, view it on GitHub (#882 (comment)), or unsubscribe (https://github.com/notifications/unsubscribe-auth/AAFNEPIY3EHJCIKGDRJ6O5LYDEYADAVCNFSM6AAAAAA55662UGVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMYTOMJWGAYDANBXG4).
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
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.
Looks great, thanks!
Submission
element to encrypt submission fields onbeforeSave
if field can be encrypted and setting enabled.SubmissionQuery
to trigger decrypt submission fields onafterPopulateElement
if field can be decrypted.EncryptionInterface
andEncryptionTrait
to control which fields can be encrypted/decrypted.