Skip to content
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

How to actually recover value form stringified form? #29

Closed
elderapo opened this issue Jul 11, 2021 · 1 comment
Closed

How to actually recover value form stringified form? #29

elderapo opened this issue Jul 11, 2021 · 1 comment

Comments

@elderapo
Copy link

Not sure if I am dumb or just tired but I couldn't figure out how to get the actual value from the stringified/encoded input...

import devalue from "devalue";

const obj = { someDate: new Date() };

const serialized = devalue(obj); // equivalent of JSON.stringify
const parsed = ...; // equivalent of JSON.parse?
parsed.someDate.getTime(); 
@coyotte508
Copy link

const parsed = (0,eval)('(' + serialized + ')');

At the bottom of the XSS mitigation section: https://www.npmjs.com/package/devalue#xss-mitigation

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants