Skip to main content

Shared security helpers for Oubliette Shield / Sentinel / Dungeon / Trap / sift-guard.

Project description

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
d = validate_argument("SYSTEM --plugins /tmp/evil.pl", allow_spaces=True)
assert d.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

Project details


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.0.tar.gz (12.6 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.0-py3-none-any.whl (11.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: oubliette_sec_utils-0.1.0.tar.gz
  • Upload date:
  • Size: 12.6 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.0.tar.gz
Algorithm Hash digest
SHA256 d2dcd5842226fae7784faa7f7f6a2621ece7440f22bcef5bc8825129cdd24319
MD5 14c4a65c7031759a47d39418488a5d6a
BLAKE2b-256 7dbe9074983d491767b678fe61ecbab7fabed04d31f8af8818e9ff08dc6ff779

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for oubliette_sec_utils-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a1ae6876bad53a92ee1413229c68ffbe0e51c39b5caba2671cb3e6efae929e4d
MD5 3192f41ee31585b9bc6a8ca8d9a1d107
BLAKE2b-256 561dc145a6d2774d79914e4e81b70b293c79393bcd53520a960e037a882b2484

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page