Exploit databaseDownload repository ZIP
GH-1a20f837c010c44c4376b2cd46cc5150
fastify/send
Sources for CVE-2017-20165
1 sourcePreferred order: Exploit-DB, Metasploit, then GitHub repositories by stars.
Repository files2
fastify/sendRevision 789c51df089e
Files from this repository share one source choice. Supporting files may cover other vulnerabilities.
types/index.tst.ts
TypeScript · 2,021 bytesimport { Stats } from 'node:fs'
import { resolve } from 'node:path'
import { Readable } from 'node:stream'
import { expect } from 'tstyche'
import send, {
DirectorySendResult,
ErrorSendResult,
FileSendResult,
SendOptions,
SendResult
} from '..'
send.mime.define({
'application/x-my-type': ['x-mt', 'x-mtt']
})
expect(send.isUtf8MimeType).type.toBe<(value: string) => boolean>()
expect(send.isUtf8MimeType('application/json')).type.toBe<boolean>()
expect<SendOptions['onFile']>().type.toBe<
((path: string, stat: Stats) => void | Promise<void>) | undefined
>()
const req: any = {};
(async () => {
{
const result = await send(req, '/test.html', {
acceptRanges: true,
maxContentRangeChunkSize: 10,
immutable: true,
maxAge: 0,
root: resolve(__dirname, '/wwwroot')
})
expect(result).type.toBe<SendResult>()
expect(result.statusCode).type.toBe<number>()
expect(result.headers).type.toBe<Record<string, string>>()
expect(result.stream).type.toBe<Readable>()
}
{
const result = await send(req, '/test.html', {
contentType: true,
maxAge: 0,
root: resolve(__dirname, '/wwwroot')
})
expect(result).type.toBe<SendResult>()
expect(result.statusCode).type.toBe<number>()
expect(result.headers).type.toBe<Record<string, string>>()
expect(result.stream).type.toBe<Readable>()
}
const result = await send(req, '/test.html')
switch (result.type) {
case 'file': {
expect(result).type.toBe<FileSendResult>()
expect(result.metadata.path).type.toBe<string>()
expect(result.metadata.stat).type.toBe<Stats>()
break
}
case 'directory': {
expect(result).type.toBe<DirectorySendResult>()
expect(result.metadata.path).type.toBe<string>()
expect(result.metadata.requestPath).type.toBe<string>()
break
}
case 'error': {
expect(result).type.toBe<ErrorSendResult>()
expect(result.metadata.error).type.toBe<Error>()
break
}
}
})()