Skip to content

Commit

Permalink
fix: 去掉 err 上附带 req 信息,打印 error 的话可能存在安全内容泄漏 (#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
mansonchor authored Mar 18, 2022
1 parent 448a6db commit 91760de
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 11 deletions.
1 change: 0 additions & 1 deletion lib/server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,6 @@ class RpcServer extends Base {
this._connections.set(key, conn);
conn.on('request', req => {
this._handleRequest(req, conn).catch(err => {
err.req = req;
this.emit('error', err);
});
});
Expand Down
10 changes: 0 additions & 10 deletions test/server/server.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,6 @@ describe('test/server.test.js', () => {
} catch (err) {
console.log(err);
assert(err.message.includes('Cannot read property \'split\' of null'));
assert(err.req);
assert(err.req.packetId === 1);
assert.deepEqual(err.req.data, {
methodName: 'foo',
serverSignature: null,
args: [],
methodArgSigs: [],
requestProps: null,
targetAppName: 'test',
});
}
socket.destroy();
await server.close();
Expand Down

0 comments on commit 91760de

Please sign in to comment.