Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@tinyhttp/cors
Advanced tools
tinyhttp CORS module
pnpm i @tinyhttp/cors
import { cors } from '@tinyhttp/cors'
host
Host that is allowed to send cross-origin requests. Defaults to '*'.
methods
Allowed methods for performing a cross-origin request. Default ones are ['GET', 'POST', 'PUT', 'PATCH', 'HEAD']
and can be accessed with defaultMethods
:
import { App } from '@tinyhttp/app'
import { defaultMethods, cors } from '@tinyhttp/cors'
const app = new App()
app.use(
cors({
methods: defaultMethods.filter(m => m !== 'DELETE'),
host: 'https://example.com'
})
)
headers
Allowed HTTP headers that can be sent in a cross-origin request. Default ones are ['Origin', 'X-Requested-With', 'Content-Type']
and can be accessed with defaultHeaders
:
import { App } from '@tinyhttp/app'
import { defaultHeaders, cors } from '@tinyhttp/cors'
const app = new App()
app.use(
cors({
methods: [...defaultHeaders, 'X-Custom-Header'],
host: 'https://example.com'
})
)
import { App } from '@tinyhttp/app'
import { cors } from '@tinyhttp/cors'
const app = new App()
app
.use(
cors({
host: 'https://example.com'
})
)
.get('/', (_, res) => void res.end('Hello World'))
MIT
FAQs
CORS middleware for modern Node.js
The npm package @tinyhttp/cors receives a total of 38,624 weekly downloads. As such, @tinyhttp/cors popularity was classified as popular.
We found that @tinyhttp/cors demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.