Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

INTEGRATION [PR#578 > development/8.1] Bugfix/zenko 1197/s3 data leak #580

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/network/http/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,8 @@ class Server {
error: err.stack || err,
address: sock.address(),
});
// socket is not systematically destroyed
sock.destroy();
}

/**
Expand Down
9 changes: 9 additions & 0 deletions lib/storage/data/file/DataFileStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,15 @@ class DataFileStore {
return cbOnce(errors.InternalError.customizeDescription(
`read stream error: ${err.code}`));
});
dataStream.on('close', () => {
// this means the underlying socket has been closed
log.debug('Client closed socket while streaming',
{ method: 'put', key, filePath });
// destroying the write stream forces a close(fd)
fileStream.destroy();
// we need to unlink the file ourselves
fs.unlinkSync(filePath);
});
return undefined;
});
}
Expand Down