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.
pip install aioserver
Start a test server with the examples in the Usage section below:
make test
Make requests against the running test server:
curl -v localhost:8080
curl -v localhost:8080/found
curl -v localhost:8080/not-found
curl -v localhost:8080/server-error
from aioserver import Application
app = Application()
@app.get('/')
async def index(request):
return {'message': 'Hello, world!'}
@app.get('/found')
async def found(request):
return 302, {'Location': 'https://www.example.com/'}, {'message': 'Found'}
@app.get('/not-found')
async def not_found(request):
return 404, {'message': 'Not Found'}
@app.get('/server-error')
async def server_error(request):
return 500
@app.cors('*')
@app.get('/cross-origin-resource-sharing')
async def cross_origin_resource_sharing(request):
return {'message': 'Greetings from a different origin!'}
@app.cors('*', ['X-Custom-Header'])
@app.get('/cross-origin-header-sharing')
async def cross_origin_header_sharing(request):
return 200, {'X-Custom-Header': 'share-this-header-too'}, {'message': 'Hello!'}
from aioserver.middleware import hours
@app.get('/session-cookie')
@app.session(max_age=24 * hours)
async def session_cookie(request):
print(f'session uuid {request.session}')
return 200, {'message': 'Session UUID set as cookie for 24 hours.'}
Route-specific middleware:
@app.middleware
async def always_ok(request, handler):
response = await handler(request)
response.set_status(200, 'OK')
return response
@always_ok
@app.get('/not-found-but-still-ok')
async def not_found_but_still_ok(request):
return 404, {'message': 'Not found but still OK!'}
Global middleware:
async def strict_transport_security(request, handler):
response = await handler(request)
response.headers['Strict-Transport-Security'] = 'max-age=31536000'
return response
app.use(strict_transport_security)
app.run(host='127.0.0.1', port=8080)
app.use(...)
FAQs
An async web framework for humans
We found that aioserver 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.