[Console] Prototype Hardening (first pass) (#46334) (#46681)

* Remove potential foot-gun function

* Precaution - user input is read against these objects
This commit is contained in:
Jean-Louis Leysens 2019-09-26 12:54:58 +02:00 committed by GitHub
parent a29f8e07f8
commit d7ed4d4ded
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 7 deletions

View file

@ -32,8 +32,8 @@ import { globalsOnlyAutocompleteComponents, compileBodyDescription } from '../a
* @param bodyParametrizedComponentFactories same as urlParametrizedComponentFactories but used for body compilation
*/
function Api(urlParametrizedComponentFactories, bodyParametrizedComponentFactories) {
this.globalRules = {};
this.endpoints = {};
this.globalRules = Object.create(null);
this.endpoints = Object.create(null);
this.urlPatternMatcher = new UrlPatternMatcher(urlParametrizedComponentFactories);
this.globalBodyComponentFactories = bodyParametrizedComponentFactories;
this.name = '';

View file

@ -37,12 +37,13 @@ function resolveUri(base, path) {
return pathToUse;
}
function extendCommaList(obj, property, value) {
obj[property] = (obj[property] ? obj[property] + ',' : '') + value;
}
function getProxyHeaders(req) {
const headers = {};
const headers = Object.create(null);
// Scope this proto-unsafe functionality to where it is being used.
function extendCommaList(obj, property, value) {
obj[property] = (obj[property] ? obj[property] + ',' : '') + value;
}
if (req.info.remotePort && req.info.remoteAddress) {
// see https://git.io/vytQ7