$processModelValue() cannot pass objects through $formatters properly #17019
Description
I'm submitting a ...
- regression from 1.7.0
- security issue
- issue caused by a new browser version
- other: .
Current behavior:
Currently, $setViewValue(value) function accepts objects as a value, but requires them to be a angular.copy of the previous object - since otherwise it will not detect the change (no deep comparison). This is expected and documented behaviour. The opposite function, however, $processModelValue() function cannot properly process the $modelValue which is an object (an end result of the
This means that $modelValue object is being stored directly from user input, circumventing parsers altogether - which is a security concern.
Expected behavior:
The
Minimal reproduction of the problem with instructions:
AngularJS version: 1.7.9
Browser: should be affecting ALL browsers, explicitly observed in Chrome 81
Anything else:
Can be fixed by replacing the line 1042 of ngModel.js file:
From:
var viewValue = this.$modelValue;
To:
var viewValue = angular.copy(this.$modelValue);