-
Notifications
You must be signed in to change notification settings - Fork 29.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
http2: implement support for max settings entries
Adds the maxSettings option to limit the number of settings entries allowed per SETTINGS frame. Default 32 Fixes: https://hackerone.com/reports/446662 CVE-ID: CVE-2020-11080 PR-URL: nodejs-private/node-private#204 Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
- Loading branch information
Showing
6 changed files
with
70 additions
and
3 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
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,35 @@ | ||
'use strict'; | ||
|
||
const common = require('../common'); | ||
if (!common.hasCrypto) | ||
common.skip('missing crypto'); | ||
|
||
const http2 = require('http2'); | ||
|
||
const server = http2.createServer({ maxSettings: 1 }); | ||
|
||
// TODO(@jasnell): There is still a session event | ||
// emitted on the server side but it will be destroyed | ||
// immediately after creation and there will be no | ||
// stream created. | ||
server.on('session', common.mustCall((session) => { | ||
session.on('stream', common.mustNotCall()); | ||
session.on('remoteSettings', common.mustNotCall()); | ||
})); | ||
server.on('stream', common.mustNotCall()); | ||
|
||
server.listen(0, common.mustCall(() => { | ||
// Specify two settings entries when a max of 1 is allowed. | ||
// Connection should error immediately. | ||
const client = http2.connect( | ||
`http://localhost:${server.address().port}`, { | ||
settings: { | ||
// The actual settings values do not matter. | ||
headerTableSize: 1000, | ||
enablePush: false, | ||
} }); | ||
|
||
client.on('error', common.mustCall(() => { | ||
server.close(); | ||
})); | ||
})); |
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