Skip to content

Commit 1042a80

Browse files
luluwu2032facebook-github-bot
authored andcommitted
Encode params in URLSearchParams
Summary: URL params are not encoded which could cause a security risk, for more details pls see https://fb.workplace.com/groups/react.technologies.discussions/permalink/3184249088473474/ Changelog: [General][Security] - Encode URL params in URLSearchParams.toString() Reviewed By: yungsters Differential Revision: D34415119 fbshipit-source-id: 83c29df9427ad0adc9b6a2b4d0ff5494247aa5cb
1 parent a3d9892 commit 1042a80

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Libraries/Blob/URL.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,13 @@ export class URLSearchParams {
101101
}
102102
const last = this._searchParams.length - 1;
103103
return this._searchParams.reduce((acc, curr, index) => {
104-
return acc + curr.join('=') + (index === last ? '' : '&');
104+
return (
105+
acc +
106+
encodeURIComponent(curr[0]) +
107+
'=' +
108+
encodeURIComponent(curr[1]) +
109+
(index === last ? '' : '&')
110+
);
105111
}, '');
106112
}
107113
}

0 commit comments

Comments
 (0)