-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
[WIP] encrypted_ props #254
Conversation
👍 on encrypted props!
Instead of putting this in
Some background: Right now, a components properties are serialized directly as JSON: dash/dash/development/base_component.py Lines 40 to 60 in 6a1809f
with the here: Lines 163 to 167 in 6a1809f
and here: Lines 511 to 530 in 6a1809f
Now, if we added If we put this
With both methods, we would need to add a custom JSON decoder when deserializing (Instead of Pros of making dash's base component class extensible and putting
Pros of putting
In both cases, we'd need some way to transfer the secret keys over to the component. The only coupling between the base component and the |
OK, so this PR is a dead-end basically :) I don't think the "pro" of the base_component option is particularly compelling: I haven't been able to think of a single use-case for encrypted props other than a I'm going to close this PR and create a proper issue for the need for a |
This PR is definitely incomplete but shows a possible direction for built-in support for server-side encrypted props: basically transparently encrypting and decrypting any prop whose name starts with
encrypted_
. This would go hand in hand with a newdcc.Store
component which would acceptencrypted_*
props and render into the DOM asnull
, as a safer replacement for using hidden<div>
elements to store data on the client. The current downsides of using hidden<div>
s are that 1) data is sent to the client in the clear which developers might not want clients to have access to and 2) data can be manipulated by the client to trick the app into doing undesirable things. Encrypting/signing the data solves both of these problems.If any prop is to be encrypted, the user will need to provide either an
encryption_keystring
which is used to generate afernet_key
or specify thefernet_key
directly if the built-in KDF is somehow insufficient.Major limitations of this PR today:
I'm submitting it here for feedback on the implementation direction (the idea of providing a generic mechanism for encryption, this specific mechanism, the implications for specifying keys etc) rather than the quality of the implementation :) If the direction isn't good, I won't invest more time in finishing it!