Skip to main content

glovebox-core

Glovebox's security decisions as pure functions: the host rules, the JSON reader and the egress verdict. No module here reads a file, a socket, a subprocess, the clock, a thread or the environment. An input that needs one arrives as an argument: a Protocol the caller implements, or a value the caller read. tests/core/test_purity.py refuses any other import.

Host rules

glovebox_core.host_rules is the one answer to "which host is this" that every part of glovebox uses: the egress proxy's verdict service, the launcher, the WebFetch hook, the session driver and the evals. A host is compared in one spelling: ASCII only, surrounding whitespace removed, lowercased, and an IP literal in its standard form. A name that is not ASCII, or that starts or ends with a dot, is refused rather than folded, so two readers can never disagree about it.

pod_grants is the one reader of a Kata pod's glovebox.dev/egress-grants annotation, and the node calls it. It returns the granted hosts at their tiers, the address grants and the port grants. It raises GrantRefused with the node's own message for the first entry the node refuses. How wide an address grant may be is each node's own setting, so it is not checked here.

A host with a port, such as {"host": "git.example.com:22", "rw": true}, is a port grant. The node relays a raw stream to that port on the name's public addresses, so it needs "rw": true. A host without a port keeps its plain host meaning.

A grant may not name a *. wildcard over a public suffix, or over a name with one below it. pod_grants takes the Public Suffix List as an argument: glovebox_hosts.BUNDLED_SUFFIXES is the list tldextract bundles. Where the list cannot be read, every name is refused.

>>> from glovebox_core.host_rules import pod_grants
>>> from glovebox_hosts import BUNDLED_SUFFIXES
>>> granted = pod_grants('["httpbin.org", {"host": "git.example.com:22", "rw": true}]', BUNDLED_SUFFIXES)
>>> granted.hosts
{'httpbin.org': 'ro'}
>>> granted.ports
[PortGrant(host='git.example.com', port=22)]
>>> pod_grants('["*.amazonaws.com"]', BUNDLED_SUFFIXES)
Traceback (most recent call last):
...
glovebox_core.host_rules.GrantRefused: glovebox.dev/egress-grants: '*.amazonaws.com' is a wildcard over a name with the public suffix ...

encode_pod_grants is the writer for the same annotation. It writes each entry as a bare read-only string, sorted and once, and never adds "rw". It raises GrantRefused for an address or HOST:PORT, which opens a raw tunnel that only a person grants, read-write, on the node. It reads its text back with pod_grants, so it also raises for any other entry the node would refuse.

A runner that writes the annotation checks each entry before it asks for a pod. grant_host_refusal(host, suffixes) gives the node's reason for refusing a host name, or None. address_grant(entry) reads an address entry as an AddressGrant, returns None for a host name, and raises GrantRefused for a malformed one.

The host rules and glovebox_core.json_object import only the standard library, so they run under Python 3.9. The egress modules need Python 3.11.

Egress verdict

glovebox_core.verdict.decide rules where one request Envoy asks about may go. The caller passes what it read as Facts, such as the setup window, and every address screen as a Screen. The verdict resolves no name and writes no record.

Metadata

Release files for glovebox-core 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for glovebox-core 0.1.2
File Size Uploaded Provenance Actions
glovebox_core-0.1.2.tar.gz 82.2 kB Without provenance Details for glovebox_core-0.1.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for glovebox-core 0.1.2
File Interpreter ABI Platform Actions
glovebox_core-0.1.2-py3-none-any.whl Python 3 none any Details for glovebox_core-0.1.2-py3-none-any.whl

Total release size: 171.9 kB

Release files / glovebox_core-0.1.2.tar.gz

Download URL glovebox_core-0.1.2.tar.gz
Size 82.2 kB
Tags Source
SHA-256 checksum
How to use checksums
d0c25ff042a3f498733507069987c0a98b1a6633f94fc9b05cc230eb4d493761
BLAKE2b-256 checksum
How to use checksums
aad6c35bfe47cde934f2fd377f3bfacca8ac996c73a38f1b60597e56064025cf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / glovebox_core-0.1.2-py3-none-any.whl

Download URL glovebox_core-0.1.2-py3-none-any.whl
Size 89.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
43603a5df50363779a58f43785cc7ff1b1b61c5afc6854d1aebf67dddd49d562
BLAKE2b-256 checksum
How to use checksums
a525aba3ab8675da7a3a761e07fd9fab71bf76c0f9f15d4f38b7a452cd986854
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for glovebox-core 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.

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