Skip to content

Commit 8cd91f7

Browse files
Add input validation to tailFile function
Co-authored-by: elasticdotventures <35611074+elasticdotventures@users.noreply.github.com>
1 parent 56c9b02 commit 8cd91f7

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

lib/mcp/server.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -361,6 +361,9 @@ function createTransport(options = {}) {
361361
}
362362

363363
async function tailFile(filePath, lineCount) {
364+
if (lineCount <= 0) {
365+
throw new Error('lineCount must be positive');
366+
}
364367
const fh = await fs.promises.open(filePath, 'r');
365368
try {
366369
const stats = await fh.stat();

0 commit comments

Comments
 (0)