Skip to content

Commit

Permalink
throw at invalid profile name in shared ini file (#3585)
Browse files Browse the repository at this point in the history
  • Loading branch information
AllanZhengYP authored Dec 18, 2020
1 parent ee0c5a3 commit dd83d67
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changes/next-release/bugfix-Credentials-74d3274e.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"type": "bugfix",
"category": "Credentials",
"description": "SDK will throw if shared ini file's profile name can be resolved to __proto__"
}
5 changes: 5 additions & 0 deletions lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,11 @@ var util = {
var section = line.match(/^\s*\[([^\[\]]+)\]\s*$/);
if (section) {
currentSection = section[1];
if (currentSection === '__proto__' || currentSection.split(/\s/)[1] === '__proto__') {
throw util.error(
new Error('Cannot load profile name \'' + currentSection + '\' from shared ini file.')
);
}
} else if (currentSection) {
var item = line.match(/^\s*(.+?)\s*=\s*(.+?)\s*$/);
if (item) {
Expand Down
31 changes: 27 additions & 4 deletions test/util.spec.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit dd83d67

Please sign in to comment.