forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
policy: disable process.binding() when enabled
process.binding() can be used to trivially bypass restrictions imposed through a policy. Since the function is deprecated already, simply replace it with a stub when a policy is being enabled. Fixes: https://hackerone.com/bugs?report_id=1946470 PR-URL: nodejs-private/node-private#397 Reviewed-By: Rafael Gonzaga <[email protected]> CVE-ID: CVE-2023-32559
- Loading branch information
Showing
6 changed files
with
65 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
'use strict'; | ||
|
||
const assert = require('assert'); | ||
|
||
assert.throws(() => { process.binding(); }, { | ||
code: 'ERR_ACCESS_DENIED' | ||
}); | ||
assert.throws(() => { process._linkedBinding(); }, { | ||
code: 'ERR_ACCESS_DENIED' | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
{ | ||
"resources": { | ||
"./app.js": { | ||
"integrity": true, | ||
"dependencies": { | ||
"assert": true | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
'use strict'; | ||
|
||
const common = require('../common'); | ||
common.requireNoPackageJSONAbove(); | ||
|
||
if (!common.hasCrypto) | ||
common.skip('missing crypto'); | ||
|
||
const fixtures = require('../common/fixtures'); | ||
|
||
const assert = require('node:assert'); | ||
const { spawnSync } = require('node:child_process'); | ||
|
||
const dep = fixtures.path('policy', 'process-binding', 'app.js'); | ||
const depPolicy = fixtures.path( | ||
'policy', | ||
'process-binding', | ||
'policy.json'); | ||
const { status } = spawnSync( | ||
process.execPath, | ||
[ | ||
'--experimental-policy', depPolicy, dep, | ||
], | ||
{ | ||
stdio: 'inherit' | ||
}, | ||
); | ||
assert.strictEqual(status, 0); |