sh-expand
A python library for expanding shell ASTs that can be used to construct sound analyses for shell scripts (after having expanded the AST).
Design
There are two implementations of shell expansion:
expand.pydoes an in-python expansion of simple & safe AST nodes. It doesn't support bashisms.bash_expand.pyexpands by conservatively echoing safe commands to a bash process containing the current shell state.
Both, when called via expand_command, recurse down into the words of a shasta AST node to
expand, leave the word as is, or raise an ExpansionError. Examples:
- Process substitutions are unsafe.
- Simple variable substitutions are safe.
- Assignments are considered unsafe, since in Pash they indicate an unparallelizable region.
expand.py interprets the ArgChars libdash parses (ex: for variable and process substitutions)
to check and expand words.
Libbash does not parse ArgChars, so bash_expand.py instead conservatively checks
for the presence of potentially expandable or unsafe literal characters (see should_expand_var)
before expanding.
Not having proper ArgChar parsing causes false positive unsafe errors,
so expand.py should eventually be extended to support bash-only AST nodes,
and libbash and shasta extended to parse ArgChars.
Metadata
Release files for sh-expand 0.2.6
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sh_expand-0.2.6-py3-none-any.whl | Python 3 | none | any | Details for sh_expand-0.2.6-py3-none-any.whl |
Release files / sh_expand-0.2.6-py3-none-any.whl
| Download URL | sh_expand-0.2.6-py3-none-any.whl |
|---|---|
| Size | 16.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
dcc72c732b204729eda9330b077f4f23378bf0681877863f9009cba72ac0fae7
|
|
BLAKE2b-256 checksum How to use checksums |
f91756d6d67b407035de6718571ef9d01d5e9224b265c885f573be868f1df8dd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Security for sh-expand 0.2.6
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.