
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 robust Python module to safely source a bash script in a sandboxed environment and collect its variables.
BashVar Sentry is a Python utility module that securely extracts Bash variable declarations from scripts by sourcing them in a sandboxed environment. It supports sandboxing via chroot
, bwrap
, or fakechroot
to reduce risk from untrusted content.
Install from PyPI:
pip install bashvar-sentry
from bashvar_sentry import source_and_get_vars
variables = source_and_get_vars(
"example.sh",
sandbox_method="auto", # "auto", "chroot", "bwrap", "fakechroot", "empty"
jail_dir="/", # Optional: target root dir for sandbox
extra_env={"MYVAR": "from_python"},
additional_args=["one", "two"]
)
print(variables)
Your script must be syntactically valid (bash -n
is run first).
example.sh
#!/bin/bash
ARG1=$1
ARG2=$2
ENV_CAPTURED="$MYVAR"
declare -a FRUITS=("apple" "banana split")
declare -A CONFIG=([host]="localhost" [port]="8080")
{
"ARG1": "one",
"ARG2": "two",
"ENV_CAPTURED": "from_python",
"FRUITS": ["apple", "banana split"],
"CONFIG": {"host": "localhost", "port": "8080"}
}
Method | Isolation | Root Required | Notes |
---|---|---|---|
chroot | Full | Yes | Needs /usr/sbin/chroot |
bwrap | Strong | No | Needs bwrap binary |
fakechroot | Simulated | No | Must have fakechroot |
empty | Minimal | No | Sets PATH="" |
auto | Best fit | No | Picks the first available |
Run tests with:
python -m pytest
To test sandbox fallbacks, install:
/usr/sbin/chroot
and run as root (for chroot) - This auto skips if not rootbwrap
fakechroot
Apache-2.0
FAQs
A robust Python module to safely source a bash script in a sandboxed environment and collect its variables.
We found that bashvar-sentry 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.