react-starter-kit icon indicating copy to clipboard operation
react-starter-kit copied to clipboard

How to secure redux data-initial-state

Open fchienvuhoang opened this issue 10 years ago • 15 comments

Hi all, Have any way to secure redux data-init-state below image: screen shot 2016-07-12 at 2 18 11 am

fchienvuhoang avatar Jul 11 '16 19:07 fchienvuhoang

+1 it feels odd seeing everything just laid out there for everybody. I know you can get that data if you want but at least not straight forward like that.

upq avatar Jul 11 '16 23:07 upq

Enable Content Security Policy

frenzzy avatar Jul 12 '16 06:07 frenzzy

Hello @langpavel, how do you think ? :)

fchienvuhoang avatar Jul 12 '16 07:07 fchienvuhoang

+1

voquockhanh avatar Jul 12 '16 09:07 voquockhanh

You need to hide information on the transfer or make not readable?

alexsuslov avatar Jul 12 '16 12:07 alexsuslov

yeh, could hide it ?, or some way to encrypt it. I think data can be leaks when see them in data-initial-state.

fchienvuhoang avatar Jul 12 '16 14:07 fchienvuhoang

may be base64 ? console.log(btoa("test")); dGVzdA== console.log(atob(btoa("test"))); test

alexsuslov avatar Jul 12 '16 15:07 alexsuslov

May be... But encryption - decryption it's the best option ? :)

fchienvuhoang avatar Jul 12 '16 15:07 fchienvuhoang

there is an option to do bit operations. they are fast. or https://www.npmjs.com/package/crypto-js

alexsuslov avatar Jul 12 '16 15:07 alexsuslov

I argee with you, and I think it's the best way. Thanks @alexsuslov

fchienvuhoang avatar Jul 12 '16 15:07 fchienvuhoang

Security by obscurity is no security at all. If you are unhappy to see this in, you can just delete data-initial-state attribute in DOM after it value is readed here. But this will do not protect your data.

langpavel avatar Jul 12 '16 21:07 langpavel

@alexsuslov If you need decrypt data on client, you need key on client. It is not secure because all you need for decrypting can be achieved

langpavel avatar Jul 12 '16 21:07 langpavel

how to ! :|

fchienvuhoang avatar Jul 12 '16 21:07 fchienvuhoang

Closing this with only real solution from @frenzzy: Enable Content Security Policy

langpavel avatar Jul 12 '16 21:07 langpavel

Thanks @langpavel

fchienvuhoang avatar Jul 12 '16 21:07 fchienvuhoang