Skip to content

Commit

Permalink
fix(lockdown): Disable domain taming
Browse files Browse the repository at this point in the history
  • Loading branch information
kriskowal committed Jan 5, 2022
1 parent 78a2575 commit cefdbec
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 2 deletions.
12 changes: 12 additions & 0 deletions packages/lockdown/commit-debug.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,16 @@ lockdown({
// this may be a development accident that should be fixed before merging.
//
// consoleTaming: 'unsafe',

// Domain taming causes lockdown to throw an error if the Node.js domain
// module has already been loaded, and causes loading the domain module
// to throw an error if it is pulled into the working set later.
// This is because domains may add domain properties to promises and other
// callbacks and that these domain objects provide a means to escape
// containment.
// However, our platform still depends on systems like standardthings/esm
// which ultimately pull in domains.
// For now, we are resigned to leave this hole open, knowing that all
// contract code will be run under XS to avoid this vulnerability.
domainTaming: 'unsafe',
});
24 changes: 22 additions & 2 deletions packages/lockdown/pre.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,17 @@ export const lockdown = defaultOptions => {
console.error('', err, options);
throw err;
}
rawLockdown(options);
rawLockdown({
...options,
// See comment on domainTaming below.
domainTaming: 'unsafe',
});
} else if (defaultOptions) {
rawLockdown(defaultOptions);
rawLockdown({
...defaultOptions,
// See comment on domainTaming below.
domainTaming: 'unsafe',
});
} else {
rawLockdown({
// The default `{errorTaming: 'safe'}` setting, if possible, redacts the
Expand Down Expand Up @@ -138,6 +146,18 @@ export const lockdown = defaultOptions => {
// this may be a development accident that MUST be fixed before merging.
//
// consoleTaming: 'unsafe',

// Domain taming causes lockdown to throw an error if the Node.js domain
// module has already been loaded, and causes loading the domain module
// to throw an error if it is pulled into the working set later.
// This is because domains may add domain properties to promises and other
// callbacks and that these domain objects provide a means to escape
// containment.
// However, our platform still depends on systems like standardthings/esm
// which ultimately pull in domains.
// For now, we are resigned to leave this hole open, knowing that all
// contract code will be run under XS to avoid this vulnerability.
domainTaming: 'unsafe',
});
}

Expand Down

0 comments on commit cefdbec

Please sign in to comment.