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

Object's builtin properties are exposed #95

Closed
vogelsgesang opened this issue Apr 1, 2015 · 5 comments
Closed

Object's builtin properties are exposed #95

vogelsgesang opened this issue Apr 1, 2015 · 5 comments

Comments

@vogelsgesang
Copy link
Contributor

The SelectFormat string

{VAR, select,
  male {He}
  female {She}
  other {It}
}

called with VAR = "toString" produces "[object Object]" as result.

Similar results for hasOwnProperty, valueOf, constructor, ... and for PluralFormat and SelectOrdinalFormat.

@vogelsgesang
Copy link
Contributor Author

Oh, and you are able to use plural as a replacement for select:

{VAR, plural,
  male {he}
  female {she}
  other {it}
}

actually works when called with VAR = "male" or VAR = "female".

@eemeli
Copy link
Member

eemeli commented Apr 1, 2015

Yup, that was a bug. Should be fixed now that we check data.hasOwnProperty(value) rather than value in data. Added some tests for that too.

@vogelsgesang
Copy link
Contributor Author

Thanks for your quick response and the fix :) The example which I posted above works smoothly now.

Unfortunately, the following MessageFormat expression would overwrite hasOwnProperty.
I think Object.prototype.hasOwnProperty.call(data, value) should do the trick here.

{VAR, select, hasOwnProperty{true} other {something}}

In addition, there is a similar issue with user provided format functions:

{VAR, __defineSetter__}

@eemeli eemeli reopened this Apr 1, 2015
@eemeli eemeli closed this as completed in 6d8d2ef Apr 2, 2015
@eemeli
Copy link
Member

eemeli commented Apr 2, 2015

I switched the check to {}.hasOwnProperty.call(data, value), and modified one of the new tests to account for this. Thank you for the pentesting!

Regarding the __defineSetter__ case, can you come up with an example that doesn't work like it should? After (admittedly only a little) testing, all I could manage are slightly different errors compared to more common cases. If so, please open another issue for that, as it's really a different thing.

@vogelsgesang
Copy link
Contributor Author

Perfect!

Well, you are right, __defineSetter__ is a separate topic. I am going to open another issue for the discussion of it.

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

2 participants