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.1.tar.gz (15.2 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.1-py3-none-any.whl (12.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: oubliette_sec_utils-0.1.1.tar.gz
  • Upload date:
  • Size: 15.2 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.1.tar.gz
Algorithm Hash digest
SHA256 52537481a1f9b744b83a1f0a1e81d65be219d8e86295e4f179d31897684c2c9e
MD5 a552a513434b9c4e3d52dc4cd8b97dbb
BLAKE2b-256 b34872c62dfd9c13dbc0a8861d22c547437a4a661dce511f50bd1a5e3795935d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for oubliette_sec_utils-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 dd6c62448ea0b41da2cc63f5230b2322db64f733bdd81a755fd4ccbcb8090928
MD5 0f1e6d4657621699832791e14c03cd8d
BLAKE2b-256 6170406b852674614186c6cbd80347d2f5e92daeaf1a085933955c056e51aedb

See more details on using hashes here.

Release history Release notifications | RSS feed

0.1.2

2 files

This release

0.1.1 This release

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