Introducing The Sweep: OX’s New Live Security Research Series
Register Now
Breaking: The 2026 Vulnpocalypse Hits PHP: Four Critical RCEs, but How Dangerous Are They?
Read the Report
Are you exposed? Connect your apps in minutes.
Scan your apps free

xtr-service-contracts

Latest version: v7.3.0

Overview

Last scanned
26 Nov 2026
Published
26 Nov 2026
PyPI package Publisher: xterr
25 Versions
6.1K Downloads

Scan summary

xtr-service-contracts was last scanned on 26 Nov 2026 at version 7.3.0. Risk score 0 of 100. No malicious behavior was detected.

  • Releases: 25 versions; the latest 2 were published within 2 days (25 and 26 Nov 2026).
  • Findings: No rules fired in version 7.3.0.
  • Downloads: 6,143 downloads.

Versions

25 versions published
Versions and the rules that fired in each
VersionPublishedStatus
7.3.0 LATEST 26 Nov 2026 No rules fired
7.2.0 25 Nov 2026 No rules fired
7.1.0 19 Nov 2026 No rules fired
7.0.0 19 Nov 2026 Not shown
6.8.1 13 Nov 2026 Not shown

No rules fired in 7.3.0

Findings

Findings for v7.3.0. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.

The score describes 7.3.0; other versions have their own rules, not their own score.

README

The publisher’s own README, as collected from the registry.

xtr-service-contracts

What a container drives, not what a service does.


Why?

A service's own contract says what it is for — a logger logs, a lock locks, a bus dispatches. This package holds the other kind: what something built by a container must answer to so the container can manage it, whatever it is for.

Keeping the two apart matters. reset() is not a logging idea, so a logging contract that ships it makes every consumer of that contract inherit a concern belonging to the container. Here it is declared once, and any contract or library that needs it depends on a package with no dependencies at all.

That last part is the whole design: this is a leaf, and it should stay one. Every other contract package in the ecosystem is free to depend on it, which only remains true while nothing here can drag anything in.

Install

uv add xtr-service-contracts

Requires Python 3.14.4+.

ResetInterface

@runtime_checkable
class ResetInterface(Protocol):
    async def reset(self) -> None: ...

A long-running process — a worker consuming messages, a server answering requests — builds its services once and uses them many times. Buffers, caches, accumulated state and generated ids belong to one unit of work rather than to the service holding them. reset() ends that unit, so the next starts clean while configuration survives:

It is awaited, because clearing state is not always a local assignment: a rate limiter's count or a cache's entries may live in another process, and reaching them is I/O. A service whose state is its own awaits nothing and returns at once; one whose state lives elsewhere awaits the trip, and the caller — a worker between messages — is already somewhere it can wait.

reset() fits a unit of work that runs alone — one message, one command — where the service sits idle between units and clearing its state is the whole story. When units overlap, as when one set of services answers concurrent requests, there is no single "between" to reset into: each unit's state belongs to its own execution context and is ended by whatever opened the unit, not by a container calling reset(). A service that must serve overlapping units keeps its per-unit state in context, and reset() stays for the standalone case.

from xtr_service_contracts import ResetInterface


class Buffer:
    def __init__(self, capacity: int) -> None:
        self.capacity = capacity  # configuration — survives
        self.items: list[str] = []  # this unit of work — does not

    async def reset(self) -> None:
        self.items.clear()


assert isinstance(Buffer(10), ResetInterface)

The protocol is structural and @runtime_checkable, so a class that already has a reset() satisfies isinstance as it stands. Being @runtime_checkable costs precision, though: the check confirms a reset attribute is present, not that it is callable, so an object whose reset is a plain value passes and then fails when called. Guard the call rather than trust the check alone:

for service in container.services:
    if callable(getattr(service, "reset", None)):
        await service.reset()

A container is the usual caller: it knows what it built, so it can reset whatever asks for it between units of work, and neither side has to know anything else about the other. Its autoconfiguration keys on inheritance, so a service that means to be reset inherits this interface; a structural reset() alone matches isinstance but the container never sees it.

ContainerInterface

@runtime_checkable
class ContainerInterface(Protocol):
    async def get(self, service: type[T], /, qualifier: Hashable | None = None) -> T: ...
    def has(self, service: type[object], /, qualifier: Hashable | None = None) -> bool: ...
    def get_parameter(self, name: str, /) -> object: ...
    def has_parameter(self, name: str, /) -> bool: ...

What a dependency-injection container answers to.

A service is identified by its type plus an optional qualifier that chooses between several services registered for that same type. get builds asynchronously and raises a LookupError when has() is false; a registered service that cannot be built raises its own error. get_parameter takes a dotted name and raises a LookupError when has_parameter() is false.

ServiceProviderInterface

@runtime_checkable
class ServiceProviderInterface(Protocol[T_co]):
    async def get(self, name: Hashable, /) -> T_co: ...
    def has(self, name: Hashable, /) -> bool: ...
    def provided_services(self) -> Mapping[Hashable, type[object]]: ...

A source of services keyed by name. It knows every name it can answer to and the type each yields, without building any of them; a service is built lazily, on first request.

ServiceCollectionInterface

@runtime_checkable
class ServiceCollectionInterface(ServiceProviderInterface[T_co], Protocol[T_co]):
    def __len__(self) -> int: ...
    def __aiter__(self) -> AsyncIterator[tuple[Hashable, T_co]]: ...

A provider that is also countable and iterable. Iterating yields (name, service) pairs, each built as it is reached, in provided_services() order:

count = len(collection)
async for name, service in collection:
    ...

All three are @runtime_checkable, which checks method presence only — an implementation inherits the protocol explicitly so a type checker verifies its signatures against the contract.

UnitParticipantInterface

Something that takes part in every unit of work a container opens: unit_began() runs as each unit opens and returns a token, and unit_ended(token) runs as that unit closes, in the unit's own context. A container calls every registered participant; xtr-dependency-injection registers each service tagged kernel.unit_participant. State that lives for one unit — its log unit, its read-your-writes routing — belongs here rather than in a context variable someone must remember to reset.

Why providers are not containers

A container is keyed by type (plus an optional qualifier) and carries parameters: it is what an application resolves services from. A provider is keyed by name and carries nothing else: a small, fixed, named collection, the shape a ServiceLocator or a tagged-iterator locator takes. Splitting them keeps each contract about one thing, and lets ContainerInterface speak in types rather than being pinned to string ids.

Who uses it

Package Uses it for
xtr-dependency-injection ContainerInterface, ServiceProviderInterface and ServiceCollectionInterface as its container, locator and tagged-collection contracts, and ResetInterface for kernel.reset
xtr-logging Buffered and fingers-crossed handlers, generated ids, and LoggerFactory.reset() between requests or messages

Upgrading

What changes for an application moving to 7.0, and how to keep the old behaviour where that is still possible: Upgrading to 7.0.

Development

Developed in the python-xtr monorepo, under packages/xtr-service-contracts; run the commands below from there. The python-xtr-service-contracts repository is a read-only copy, so send issues and pull requests to the monorepo.

uv sync
uv run ruff check . && uv run ruff format --check .
uv run basedpyright
uv run ty check
uv run pytest

License

MIT — see LICENSE.

OX Radar and Response Center

Find threats in your stack.

OX Radar can check high-priority threats, like critical package CVEs, against your context.

Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.

Where it’s listed

The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).

  • pypi-releases xtr-service-contracts

References

The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.

Powered by Read the latest findings

Scan your whole stack

Group 1261154050 1
Group 1261154050
 

From OX Research Newsroom

Microsoft's Official agent framework Hijacked
AI & VibeSec

BREAKING: Hijacked Releases of Microsoft’s Official agent-framework Steals Azure and CI Credentials

PolinRider Returns
Research

PolinRider Returns: Hijacked npm Packages Use Ethereum Blockchain to Conceal Malware Infrastructure

Vulnerability Insights

Compromised Claude Code extensions (versions 2.1.312 & 2.1.313) in Cursor try to install a backdoor

Frame 2085668439 (1)
Group 1261154229