Security News
Research
Data Theft Repackaged: A Case Study in Malicious Wrapper Packages on npm
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
A lean, modular web server for rapid full-stack development.
Lws is an application core for quickly launching a local web server. Behaviour is added via plugins giving you full control over how requests are processed and responses created.
Launch an HTTP server on the default port of 8000.
$ lws
Listening at http://mba4.local:8000, http://127.0.0.1:8000, http://192.168.0.200:8000
For HTTPS or HTTP2, pass the --https
or --http2
flags respectively.
$ lws --http2
Listening at https://mba4.local:8000, https://127.0.0.1:8000, https://192.168.0.200:8000
Now your server is running, the next step is to attach some middleware to process requests.
Install and use some middleware (lws-static and lws-index) to serve static files and directory listings.
$ npm install --save-dev lws-static lws-index
$ lws --stack lws-static lws-index
Listening at http://mba4.local:8000, http://127.0.0.1:8000, http://192.168.0.200:8000
The current directory will now be available to explore at http://127.0.0.1:8000
.
Install and use logging middleware. Note the lws-
prefix is optional when supplying module names to --stack
.
$ npm install --save-dev lws-log
$ lws --stack log static index --log.format combined
Listening at http://mba4.local:8000, http://127.0.0.1:8000, http://192.168.0.200:8000
::ffff:127.0.0.1 - GET /lws.config.js HTTP/1.1 200 52 - 8.259 ms
::ffff:127.0.0.1 - GET /package.json HTTP/1.1 200 399 - 1.478 ms
Lws uses Koa as its middleware engine. Here is a trivial plugin example, save the following code as example-middleware.js
:
class ExamplePlugin {
middleware () {
return async (ctx, next) => {
ctx.body = 'Hello from lws!'
await next()
}
}
}
export default ExamplePlugin
Now launch an HTTP server using this middleware.
$ lws --stack example-middleware.js
Listening at http://mba4.local:8000, http://127.0.0.1:8000, http://192.168.0.200:8000
$ curl http://127.0.0.1:8000
Hello from lws!
$ npm install --save-dev lws
© 2016-24 Lloyd Brookes <75pound@gmail.com>.
Tested by test-runner. Documented by jsdoc-to-markdown.
FAQs
A lean, modular web server for rapid full-stack development
We found that lws 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.
Security News
Research
The Socket Research Team breaks down a malicious wrapper package that uses obfuscation to harvest credentials and exfiltrate sensitive data.
Research
Security News
Attackers used a malicious npm package typosquatting a popular ESLint plugin to steal sensitive data, execute commands, and exploit developer systems.
Security News
The Ultralytics' PyPI Package was compromised four times in one weekend through GitHub Actions cache poisoning and failure to rotate previously compromised API tokens.