58 Commits

Author SHA1 Message Date
Thomas Brierley
e8ace81449 Use 'in' on root prototype checks
Because on NodeJS <= v0.10 hasOwnProperty returns false for __proto__ on
Object.prototype. Function.prototype and Object.prototype are roots so
it should be safe to use 'in' instead.
2017-07-04 19:43:01 +01:00
Thomas Brierley
cc8b7a2f6d Remove redundant conditions and comments 2017-06-29 15:07:38 +01:00
Thomas Brierley
7951ae221e Use isSafeProperty in set/getSafeProperty 2017-06-29 15:00:40 +01:00
Thomas Brierley
955c72bebf Update isSafeProperty interface 2017-06-29 14:56:47 +01:00
Thomas Brierley
c4951c2143 Refactor isSafe checks to restore inheritance
To safely restore inherited properties and methods on plain objects e.g
with Object.create, some overly broad conditions need to be removed and
others added to more explicitly exclude unsafe properties.

isSafeMethod() has been modified as bellow, roughly the same conditions
are also now used in isSafeProperty() for get/setSafeProperty() which
previously restricted all inherited properties.

- Require __proto__ to have own-method
	Intended to prevent ghosting of class methods, but also prevents
	access to properties from further up the chain.

+ Require any own-method to not be in __proto__
	Explicitly prevents ghosting but not inheritance. Possible to
	defeat only if proto chaining through Object.create is allowed.

- Require object to not be function
	Intended to prevent unsafe function methods like 'bind', but
	also restricts function own-properties.

+ Require method not be in Function.prototype
	Explicitly prevents unsafe function methods like 'bind',
	without restricting function own properties.

Other conditions should be equivalent. The overall affect should be
that inherited properties and methods that are safe and not ghosted
should be allowed.
2017-06-29 14:53:46 +01:00
jos
ed5f2cebaf Security fixes in isSafeMethod and some others 2017-05-27 19:51:12 +02:00
jos
5fbc8edce6 Released v3.13.2 2017-05-26 20:28:59 +02:00
jos
959b010242 Simplified isSafeMethod 2017-05-26 16:43:03 +02:00
jos
11eda850da Fixed security vulnerabilities 2017-05-12 09:01:31 +02:00
jos
73b774a51b Use safe map, forEach, join 2017-05-05 12:32:21 +02:00
jos
f1e2c2e391 Released v3.12.1 2017-04-24 21:45:53 +02:00
jos
4f9fd81fbd Merge branch 'develop' into security 2017-04-24 21:36:05 +02:00
jos
19faeac16c Escape function names and properties 2017-04-24 21:36:00 +02:00
jos
8e8e02bec9 Don't clone config itself, only it's childs 2017-04-22 20:14:52 +02:00
jos
b9c3b334e1 Refactored customs.js into a regular js file instead of factory 2017-04-22 13:04:29 +02:00
jos
bb99a83d4a Removed redundant variable assignment 2017-04-20 19:50:48 +02:00
jos
ee6efa3768 Only allow accessing/assigning properties on plain objects. Only allow calling known methods. 2017-04-08 15:32:10 +02:00
jos
42012688cb Released v3.11.4 2017-04-03 21:09:05 +02:00
jos
25db18caec Fixed a security vulnerability 2017-04-03 20:43:52 +02:00
jos
1092489440 Some refactoring 2017-04-03 01:32:15 +02:00
jos
5c4b105c7e Fixed a security vulnerability in the expression parser 2017-04-03 01:29:13 +02:00
jos
fbe6e62faf Fixed more security vulnerabilities 2017-04-02 19:51:11 +02:00
jos
ebb3c9bd0e Fixed #821, #822: security vulnerabilities in the expression parser 2017-04-02 14:57:21 +02:00
Pat Grasso
8e01076ec9 Merge branch 'matrix.reshape' into develop 2017-02-24 10:12:20 -05:00
Pat Grasso
df83968ec7 Add spec for reshape() in test/function/matrix
This spec tests `reshape()` with more cases than the one in
test/utils/array.test.js, including various types.

Also, in `_reshape()`, throw a brand new `DimensionError` instead of
modifying the caught one (the error message does not change when other
attributes are modified, as it is computed when the error is created).
2017-02-24 10:05:42 -05:00
jos
03b93c508d Fixed math.round not accepting inputs NaN, Infinity, -Infinity 2017-02-20 21:35:27 +01:00
patgrasso
431d58ac4e Fix issue with thrown exceptions on edge cases
Return DimensionError when `sizes = []` and a TypeError if either type
presented is incorrect.
2016-10-15 21:28:00 -04:00
patgrasso
014e0e3ec0 Introduce reshape() to utils.array
`reshape()` takes an n-d array and a list of sizes for each dimension,
and fits the data into the specified shape. If the product of the sizes
of the new dimensions does not match that of the old, a DimensionError
is thrown.
2016-10-15 20:36:23 -04:00
jos
b016385fe0 Fixed #665: functions map, forEach, and filter now invoke callbacks which are a typed-function with the correct number of arguments 2016-05-18 22:10:34 +02:00
jos
e9eda030ee Fixed matrix.subset mutating the replacement matrix when unsqueezing it 2016-04-26 09:11:59 +02:00
jos
b60fa54d43 Fixed #645: Added documentation about engineering notation of function math.format 2016-04-11 20:28:47 +02:00
jos
bbfa7d51df Fixed #484, #555: inaccuracy of math.sinh. Also using ES6 Math functions when available 2016-04-03 13:47:57 +02:00
jos
b3c1d63133 Throw an error when functions min, max, mean, or median are invoked with multiple matrices as arguments (see #598) 2016-03-24 21:22:33 +01:00
jos
41949b2253 Fixed IndexError not always providing a max property 2016-02-29 20:41:52 +01:00
jos
a1d91e0f84 Implemented nearly equal comparison for relational functions (equal, larger, smaller, etc.) when using BigNumbers 2016-02-28 14:03:40 +01:00
jos
fb141fb885 Merge branch 'decimal_v5' into develop
Conflicts:
	HISTORY.md
	test/function/trigonometry/cot.test.js
2016-02-27 11:39:56 +01:00
jos
e0c82f1b01 Removed a few redundant clone operations 2016-02-26 21:08:37 +01:00
jos
034b74c3f2 Removed redundant trigonometric util functions 2016-02-21 13:23:28 +01:00
jos
c558cf496e Fixed all broken unit tests 2016-02-14 21:51:37 +01:00
jos
60cf4781e8 Upgraded to decimal.js v5. Replaced .constructor with .clone. Still lots of issues to fix 2016-02-13 15:48:54 +01:00
jos
61f6ab0667 Merge branch 'develop' into feature/objectsupport
Conflicts:
	HISTORY.md
2016-01-03 19:49:06 +01:00
jos
96891dd6c5 Implemented support for JSON objects in the function math.format 2016-01-03 19:47:06 +01:00
john marinelli
715efa4ae4 condense long line 2015-12-25 01:02:48 -08:00
john marinelli
4fa19f3adc made algorithm clearer 2015-12-23 12:20:22 -08:00
john marinelli
5b9f8cc90d add comments 2015-12-21 07:49:35 -08:00
john marinelli
47c152d4a3 all tests run 2015-12-20 16:30:18 -08:00
john marinelli
ce1f5c7c60 integers 2015-12-20 16:01:19 -08:00
john marinelli
2e1bbd14e5 initial commit 2015-12-18 18:57:27 -08:00
jos
15724283b1 Fixed #502: Issue with format in some JavaScript engines. 2015-11-13 20:50:55 +01:00
jos
667139f439 Fixed a bug in functions sin and cos, which gave wrong results for BigNumber integer values around multiples of tau (i.e. sin(bignumber(7))). 2015-10-09 09:32:05 +02:00