Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

validate request body objects before parsing as JSON #2438

Closed
g-k opened this issue Mar 20, 2017 · 1 comment
Closed

validate request body objects before parsing as JSON #2438

g-k opened this issue Mar 20, 2017 · 1 comment
Labels
security Security issue: can be an active issue, or related to security hygene server wontfix Closed (without being fixed) because we are discontinuing the server
Milestone

Comments

@g-k
Copy link
Contributor

g-k commented Mar 20, 2017

refs APP-INPUTVAL

Nice to have.

To prevent insecure property access where a post body like {"name":{"toString":"OVERWRITE"}} handled by code like:

var o = {};
try {
   o = JSON.parse(req.body)
} catch (error) {
   // silently
}
o.name + ' ok'

triggers an error.

It'd be good to validate the incoming objects before parsing (e.g. with joi and celebrate.

https://github.com/mozilla-services/pageshot/blob/master/server/src/server.js#L593-L603 is great because it resets the object or throws from the catch block preventing the insecure property access, but we could fail earlier and provide more detailed error messages by validating the object in advance.

@jvehent jvehent added the security Security issue: can be an active issue, or related to security hygene label Mar 21, 2017
@ghost ghost added this to the Stretch milestone Mar 22, 2017
@ianb ianb added the server wontfix Closed (without being fixed) because we are discontinuing the server label Feb 7, 2019
@ianb
Copy link
Contributor

ianb commented Feb 7, 2019

This issue is being closed (without being fixed) because we are discontinuing the Screenshots server.

@ianb ianb closed this as completed Feb 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
security Security issue: can be an active issue, or related to security hygene server wontfix Closed (without being fixed) because we are discontinuing the server
Projects
None yet
Development

No branches or pull requests

3 participants