
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).
A Python library that imbues the standard ArgumentParser with an API for the Python script.
This library is intended as a replacement for the ArgumentParser of the standard argparse library, providing an additional TCP based API for handling the arguments of the script.
A minimal example minimal.py
with the ArgumentParser could be
from argparse import ArgumentParser
def add_one(args):
new_number = args.x + 1
print(new_number)
return new_number
parser = ArgumentParser()
parser.add_argument("-x", type=int, required=True)
args = parser.parse_args()
add_one(args)
and running the script results in
$ python minimal.py -x 5
6
Replacing the ArgumentParser with the NetArgumentParser from this library:
from netargparse import NetArgumentParser
def add_one(args):
new_number = args.x + 1
print(new_number)
return {"new_number": new_number}
parser = NetArgumentParser()
parser.add_argument("-x", type=int, required=True)
parser(add_one)
The script can now be run in two modes:
main
- standalone, same behaviour as abovenap
- enable the APIAll arguments must be passed from the CLI after the main
argument.
$ python minimal.py main -x 5
6
nap
makes the script listen on a port and wait for the arguments.
$ python minimal.py nap --port 7000 --http
It is then possible to run the main function of the script by sending an HTTP get request with url parameters as arguments.
For example visit http://localhost:7000/?-x=5 with a browser and receive the script's return as json.
{"response": {"new_number": 6}, "exception": "", "finished": 1}
pip install netargparse
No additional libraries will be installed. All libraries used are part of The Python Standard Library.
More documentation can be found in docs.
FAQs
Enhance ArgumentParser with a TCP-based API for argument handling.
We found that netargparse 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.