Skip to content

Commit

Permalink
[INTERNAL] lib/jsdoc/ui5/template/publish.js: Avoid prototype polution
Browse files Browse the repository at this point in the history
JIRA: CPOUI5FOUNDATION-728

This change aligns the code with SAP/ui5-builder#960

Change-Id: Ifa446201155ca579a796ddd57dcb2e0d3834546e
  • Loading branch information
d3xter666 committed Nov 24, 2023
1 parent d148655 commit 227731d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/jsdoc/ui5/template/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ function merge(target, source) {
if ( source != null ) {
// simple single source merge
Object.keys(source).forEach((prop) => {
// guarding against prototype pollution. (https://codeql.github.com/codeql-query-help/javascript/js-prototype-pollution-utility/#example)
if (prop === "__proto__" || prop === "constructor") {
return;
}
const value = source[prop];
if ( value != null && value.constructor === Object ) {
merge(target[prop] || {}, value);
Expand Down

0 comments on commit 227731d

Please sign in to comment.