Skip to main content

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 scopecontained_in() + safe_realpath() replace the broken startswith / normpath pattern. A sibling directory like /evidence-stolen no longer passes the scope check for /evidence.
  • Argument injectionvalidate_argument() / validate_allowlist() reject strings that start with -, contain shell metacharacters, or aren't in a whitelisted set. shell=False does NOT protect against argv-level injection.
  • SSRFis_ip_safe() / validate_outbound_url() reject private, loopback, link-local, reserved, multicast, IPv6-mapped IPv4, and the Fly.io 6PN ULA range (fdaa::/16), which ipaddress.is_private misses. 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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

oubliette_sec_utils-0.1.2.tar.gz (16.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

oubliette_sec_utils-0.1.2-py3-none-any.whl (13.4 kB view details)

Uploaded Python 3

File details

Details for the file oubliette_sec_utils-0.1.2.tar.gz.

File metadata

  • Download URL: oubliette_sec_utils-0.1.2.tar.gz
  • Upload date:
  • Size: 16.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.2

File hashes

Hashes for oubliette_sec_utils-0.1.2.tar.gz
Algorithm Hash digest
SHA256 e2f443b493bc55ab71eedf4be413dbbe751fc4f8c8debd3494687697926f8c52
MD5 4a1482690cb05a0686088c63f7536b88
BLAKE2b-256 8a62c6bd2f5c4d1394732e2a97c5287b7e1710b6528d776bf10421ca2918bd7d

See more details on using hashes here.

File details

Details for the file oubliette_sec_utils-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for oubliette_sec_utils-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 04f958db0b67ada51fd69887dd4b8e00e0359a8cb6eb09985bdc017fd4766e36
MD5 4b068bf02893c72bc143c76fee47874b
BLAKE2b-256 782048a66257a1804098f3b1e2b12662c29933d82598c4ad646e2a0483cbd9aa

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 files

0.1.1

2 files

0.1.0

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page