Skip to content

Draft Proposed module permission model

Alex Willmer edited this page Feb 12, 2026 · 2 revisions

The following is a proposed specification for how a controller (mitogen.master.ModuleResponder) decides whether to serve a Python module requested by a target (mitogen.core.Importer) or deny the request.

fullname
Fully qualified name of a Python module. E.g. foo.bar.baz.
ancestor

A fullname that is a parent, grandparent, etc. of another fullname. E.g.

>>> fullname('foo.bar.baz').ancestors()
{'foo', 'foo.bar'}
allow pattern

Glob style expression. A fullname matches if it directly matches, or it is an ancester of a fullname that would directly match. The ancestor behaviour is intended to match behaviour of Python import (import foo.bar.baz implicitly imports foo, and foo.bar). E.g.

>>> patt = allow_pattern('foo.bar.*')
>>> patt.match('foo.bar.baz')
True
>>> patt.match('foo.bar')
True
>>> patt.match('foo')
True
block pattern

Glob style expression. A fullname matches only if it directly matches, E.g.

>>> patt = block_pattern('foo.bar.*')
>>> patt.match('foo.bar.baz')
True
>>> patt.match('foo.bar')
False
>>> patt.match('foo')
False
allow list
List of allow patterns
block list
List of block patterns
accepted

A fullname that satisfies all the folowing conditions

  1. Matched by atleast one allow list pattern.
  2. Not matched by any block list pattern
denied
Any fullname that is not accepted.

Clone this wiki locally