今日のセキュリティ問題 #9
2026-11-09 の問題です。 コードを読んで、最も深刻なセキュリティ脆弱性を選んでください。
ユーザー設定をデフォルト値とマージする関数です。body はリクエストの JSON です。最も深刻な脆弱性はどれですか?
function merge(target, source) {
for (const key in source) {
if (typeof source[key] === 'object' && source[key] !== null) {
target[key] = merge(target[key] ?? {}, source[key]);
} else {
target[key] = source[key];
}
}
return target;
}
const settings = merge({}, req.body);