
Research
/Security News
Critical Vulnerability in NestJS Devtools: Localhost RCE via Sandbox Escape
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
PyAwaitable is the only library to support defining and calling asynchronous Python functions from pure C code.
It was originally designed to be directly part of CPython; you can read the scrapped PEP about it. But, since this library only uses the public ABI, it's better fit outside of CPython, as a library.
Add it to your project's build process:
# pyproject.toml example with setuptools
[build-system]
requires = ["setuptools", "pyawaitable"]
build-backend = "setuptools.build_meta"
Include it in your extension:
from setuptools import setup, Extension
import pyawaitable
if __name__ == "__main__":
setup(
...,
ext_modules=[Extension(..., include_dirs=[pyawaitable.include()])]
)
/*
Equivalent to the following Python function:
async def async_function(coro: collections.abc.Awaitable) -> None:
await coro
*/
static PyObject *
async_function(PyObject *self, PyObject *coro)
{
// Create our transport between the C world and the asynchronous world.
PyObject *awaitable = PyAwaitable_New();
if (awaitable == NULL) {
return NULL;
}
// Mark our Python coroutine, *coro*, for being executed by the event loop.
if (PyAwaitable_AddAwait(awaitable, coro, NULL, NULL) < 0) {
Py_DECREF(awaitable);
return NULL;
}
// Return our transport, allowing *coro* to be eventually executed.
return awaitable;
}
pyawaitable
is distributed under the terms of the MIT license.
FAQs
Call asynchronous code from an extension module.
We found that pyawaitable 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
A flawed sandbox in @nestjs/devtools-integration lets attackers run code on your machine via CSRF, leading to full Remote Code Execution (RCE).
Product
Customize license detection with Socket’s new license overlays: gain control, reduce noise, and handle edge cases with precision.
Product
Socket now supports Rust and Cargo, offering package search for all users and experimental SBOM generation for enterprise projects.