oubliette-sec-utils
Shared security helpers for the Oubliette product family (Shield, Sentinel, Dungeon, Trap, sift-guard).
Extracted from duplicated inline code that was flagged in the 2026-04-22 red-team audit as the source of recurring cross-repo security fixes:
- Path scope —
contained_in()+safe_realpath()replace the brokenstartswith/normpathpattern. A sibling directory like/evidence-stolenno longer passes the scope check for/evidence. - Argument injection —
validate_argument()/validate_allowlist()reject strings that start with-, contain shell metacharacters, or aren't in a whitelisted set.shell=Falsedoes NOT protect against argv-level injection. - SSRF —
is_ip_safe()/validate_outbound_url()reject private, loopback, link-local, reserved, multicast, IPv6-mapped IPv4, and the Fly.io 6PN ULA range (fdaa::/16), whichipaddress.is_privatemisses. URL validation performs DNS resolution and checks every resolved IP (rebinding defence).
Install
pip install oubliette-sec-utils
Usage
from oubliette_sec_utils import (
contained_in, safe_realpath,
validate_argument, validate_allowlist,
is_ip_safe, validate_outbound_url,
)
# Path scope
assert contained_in("/evidence/disk.E01", "/evidence") is True
assert contained_in("/evidence-stolen/disk.E01", "/evidence") is False
# Argv injection -- validate_argument catches flag-prefixed strings
assert validate_argument("--plugins /tmp/evil.pl", allow_spaces=True).blocked is True
# validate_argument does NOT catch flags embedded mid-string (by design;
# a single argv entry is passed whole to the callee). For finite-set
# parameters like registry hive names, use validate_allowlist:
assert validate_allowlist(
"SYSTEM --plugins /tmp/evil.pl", ["SYSTEM", "SOFTWARE"]
).blocked is True
# SSRF
d = validate_outbound_url("http://169.254.169.254/latest/meta-data/")
assert d.safe is False
Scope and non-goals
This package is a helper library, not a framework. It does not know about Flask, FastAPI, MCP, or any specific subsystem — callers wrap these helpers into their own request pipelines. That separation is deliberate: Shield, Sentinel, Dungeon, Trap, and sift-guard all have different framework shapes, but they share the same underlying validation needs.
License
Apache 2.0
Metadata
Release files for oubliette-sec-utils 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| oubliette_sec_utils-0.1.2.tar.gz | 16.3 kB | Without provenance | Details for oubliette_sec_utils-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| oubliette_sec_utils-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for oubliette_sec_utils-0.1.2-py3-none-any.whl |
Total release size: 29.7 kB
Release files / oubliette_sec_utils-0.1.2.tar.gz
| Download URL | oubliette_sec_utils-0.1.2.tar.gz |
|---|---|
| Size | 16.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e2f443b493bc55ab71eedf4be413dbbe751fc4f8c8debd3494687697926f8c52
|
|
BLAKE2b-256 checksum How to use checksums |
8a62c6bd2f5c4d1394732e2a97c5287b7e1710b6528d776bf10421ca2918bd7d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|
Release files / oubliette_sec_utils-0.1.2-py3-none-any.whl
| Download URL | oubliette_sec_utils-0.1.2-py3-none-any.whl |
|---|---|
| Size | 13.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
04f958db0b67ada51fd69887dd4b8e00e0359a8cb6eb09985bdc017fd4766e36
|
|
BLAKE2b-256 checksum How to use checksums |
782048a66257a1804098f3b1e2b12662c29933d82598c4ad646e2a0483cbd9aa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.2
|
Security for oubliette-sec-utils 0.1.2
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.